diff options
Diffstat (limited to 'arch')
52 files changed, 701 insertions, 273 deletions
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c index 0de639d6e60a..04661fef97f5 100644 --- a/arch/arm/mach-ixp4xx/nslu2-pci.c +++ b/arch/arm/mach-ixp4xx/nslu2-pci.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/irq.h> | ||
20 | 21 | ||
21 | #include <asm/mach/pci.h> | 22 | #include <asm/mach/pci.h> |
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c index e2a2230b69f0..a29b3b2b61b6 100644 --- a/arch/arm/mach-ixp4xx/nslu2-power.c +++ b/arch/arm/mach-ixp4xx/nslu2-power.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
22 | #include <linux/irq.h> | ||
22 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
23 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
24 | 25 | ||
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile index 273e05f2b8de..0eadec916214 100644 --- a/arch/arm/mach-s3c2410/Makefile +++ b/arch/arm/mach-s3c2410/Makefile | |||
@@ -28,6 +28,7 @@ obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o | |||
28 | 28 | ||
29 | # S3C2412 support | 29 | # S3C2412 support |
30 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o | 30 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o |
31 | obj-$(CONFIG_CPU_S3C2412) += s3c2412-irq.o | ||
31 | obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o | 32 | obj-$(CONFIG_CPU_S3C2412) += s3c2412-clock.o |
32 | 33 | ||
33 | # | 34 | # |
diff --git a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h index b0ed9d2d141b..be42e4032a6d 100644 --- a/arch/arm/mach-s3c2410/cpu.h +++ b/arch/arm/mach-s3c2410/cpu.h | |||
@@ -8,16 +8,6 @@ | |||
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | ||
12 | * Modifications: | ||
13 | * 24-Aug-2004 BJD Start of generic S3C24XX support | ||
14 | * 18-Oct-2004 BJD Moved board struct into this file | ||
15 | * 04-Jan-2005 BJD New uart initialisation | ||
16 | * 10-Jan-2005 BJD Moved generic init here, specific to cpu headers | ||
17 | * 14-Jan-2005 BJD Added s3c24xx_init_clocks() call | ||
18 | * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} & IODESC_ENT | ||
19 | * 14-Mar-2005 BJD Updated for __iomem | ||
20 | * 15-Jan-2006 LCVR Updated S3C2410_PA_##x to new S3C24XX_PA_##x macro | ||
21 | */ | 11 | */ |
22 | 12 | ||
23 | /* todo - fix when rmk changes iodescs to use `void __iomem *` */ | 13 | /* todo - fix when rmk changes iodescs to use `void __iomem *` */ |
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c index ad3845e329ba..cae35ff76f33 100644 --- a/arch/arm/mach-s3c2410/devs.c +++ b/arch/arm/mach-s3c2410/devs.c | |||
@@ -1,22 +1,14 @@ | |||
1 | /* linux/arch/arm/mach-s3c2410/devs.c | 1 | /* linux/arch/arm/mach-s3c2410/devs.c |
2 | * | 2 | * |
3 | * Copyright (c) 2004 Simtec Electronics | 3 | * Copyright (c) 2004 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 5 | * |
6 | * Base S3C2410 platform device definitions | 6 | * Base S3C24XX platform device definitions |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | 11 | * |
12 | * Modifications: | ||
13 | * 15-Jan-2006 LCVR Using S3C24XX_PA_##x macro for common S3C24XX devices | ||
14 | * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} | ||
15 | * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv | ||
16 | * 29-Aug-2004 BJD Added timers 0 through 3 | ||
17 | * 29-Aug-2004 BJD Changed index of devices we only have one of to -1 | ||
18 | * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources | ||
19 | * 18-Aug-2004 BJD Created initial version | ||
20 | */ | 12 | */ |
21 | 13 | ||
22 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c index 6822dc7f7799..cd6139b35999 100644 --- a/arch/arm/mach-s3c2410/irq.c +++ b/arch/arm/mach-s3c2410/irq.c | |||
@@ -86,7 +86,7 @@ unsigned long s3c_irqwake_intmask = 0xffffffffL; | |||
86 | unsigned long s3c_irqwake_eintallow = 0x0000fff0L; | 86 | unsigned long s3c_irqwake_eintallow = 0x0000fff0L; |
87 | unsigned long s3c_irqwake_eintmask = 0xffffffffL; | 87 | unsigned long s3c_irqwake_eintmask = 0xffffffffL; |
88 | 88 | ||
89 | static int | 89 | int |
90 | s3c_irq_wake(unsigned int irqno, unsigned int state) | 90 | s3c_irq_wake(unsigned int irqno, unsigned int state) |
91 | { | 91 | { |
92 | unsigned long irqbit = 1 << (irqno - IRQ_EINT0); | 92 | unsigned long irqbit = 1 << (irqno - IRQ_EINT0); |
@@ -260,7 +260,7 @@ s3c_irqext_unmask(unsigned int irqno) | |||
260 | s3c_irq_unmask((irqno <= (IRQ_EINT7 - EXTINT_OFF)) ? IRQ_EINT4t7 : IRQ_EINT8t23); | 260 | s3c_irq_unmask((irqno <= (IRQ_EINT7 - EXTINT_OFF)) ? IRQ_EINT4t7 : IRQ_EINT8t23); |
261 | } | 261 | } |
262 | 262 | ||
263 | static int | 263 | int |
264 | s3c_irqext_type(unsigned int irq, unsigned int type) | 264 | s3c_irqext_type(unsigned int irq, unsigned int type) |
265 | { | 265 | { |
266 | void __iomem *extint_reg; | 266 | void __iomem *extint_reg; |
diff --git a/arch/arm/mach-s3c2410/irq.h b/arch/arm/mach-s3c2410/irq.h index 4abf0ca14e00..f7cc4c983de5 100644 --- a/arch/arm/mach-s3c2410/irq.h +++ b/arch/arm/mach-s3c2410/irq.h | |||
@@ -97,3 +97,8 @@ s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group) | |||
97 | __raw_writel(parentmask, S3C2410_INTPND); | 97 | __raw_writel(parentmask, S3C2410_INTPND); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | |||
101 | /* exported for use in arch/arm/mach-s3c2410 */ | ||
102 | |||
103 | extern int s3c_irq_wake(unsigned int irqno, unsigned int state); | ||
104 | extern int s3c_irqext_type(unsigned int irq, unsigned int type); | ||
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 947234df8160..2968fb235f95 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -8,31 +8,6 @@ | |||
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | ||
12 | * Modifications: | ||
13 | * 14-Sep-2004 BJD USB power control | ||
14 | * 20-Aug-2004 BJD Added s3c2410_board struct | ||
15 | * 18-Aug-2004 BJD Added platform devices from default set | ||
16 | * 16-May-2003 BJD Created initial version | ||
17 | * 16-Aug-2003 BJD Fixed header files and copyright, added URL | ||
18 | * 05-Sep-2003 BJD Moved to v2.6 kernel | ||
19 | * 06-Jan-2003 BJD Updates for <arch/map.h> | ||
20 | * 18-Jan-2003 BJD Added serial port configuration | ||
21 | * 05-Oct-2004 BJD Power management code | ||
22 | * 04-Nov-2004 BJD Updated serial port clocks | ||
23 | * 04-Jan-2005 BJD New uart init call | ||
24 | * 10-Jan-2005 BJD Removed include of s3c2410.h | ||
25 | * 14-Jan-2005 BJD Add support for muitlple NAND devices | ||
26 | * 03-Mar-2005 BJD Ensured that bast-cpld.h is included | ||
27 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
28 | * 14-Mar-2005 BJD Updated for __iomem changes | ||
29 | * 22-Jun-2005 BJD Added DM9000 platform information | ||
30 | * 28-Jun-2005 BJD Moved pm functionality out to common code | ||
31 | * 17-Jul-2005 BJD Changed to platform device for SuperIO 16550s | ||
32 | * 25-Jul-2005 BJD Removed ASIX static mappings | ||
33 | * 27-Jul-2005 BJD Ensure maximum frequency of i2c bus | ||
34 | * 20-Sep-2005 BJD Added static to non-exported items | ||
35 | * 26-Oct-2005 BJD Added FB platform data | ||
36 | */ | 11 | */ |
37 | 12 | ||
38 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index aec431b2830a..8c895c077d22 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -9,23 +9,6 @@ | |||
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | 11 | * |
12 | * Modifications: | ||
13 | * 16-May-2003 BJD Created initial version | ||
14 | * 16-Aug-2003 BJD Fixed header files and copyright, added URL | ||
15 | * 05-Sep-2003 BJD Moved to v2.6 kernel | ||
16 | * 06-Jan-2003 BJD Updates for <arch/map.h> | ||
17 | * 18-Jan-2003 BJD Added serial port configuration | ||
18 | * 17-Feb-2003 BJD Copied to mach-ipaq.c | ||
19 | * 21-Aug-2004 BJD Added struct s3c2410_board | ||
20 | * 04-Sep-2004 BJD Changed uart init, renamed ipaq_ -> h1940_ | ||
21 | * 18-Oct-2004 BJD Updated new board structure name | ||
22 | * 04-Nov-2004 BJD Change for new serial clock | ||
23 | * 04-Jan-2005 BJD Updated uart init call | ||
24 | * 10-Jan-2005 BJD Removed include of s3c2410.h | ||
25 | * 14-Jan-2005 BJD Added clock init | ||
26 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
27 | * 20-Sep-2005 BJD Added static to non-exported items | ||
28 | * 26-Oct-2005 BJD Changed name of fb init call | ||
29 | */ | 12 | */ |
30 | 13 | ||
31 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c index 306afc1d7cd3..23d7c052013c 100644 --- a/arch/arm/mach-s3c2410/mach-rx3715.c +++ b/arch/arm/mach-s3c2410/mach-rx3715.c | |||
@@ -9,15 +9,6 @@ | |||
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | 11 | * |
12 | * Modifications: | ||
13 | * 16-Sep-2004 BJD Copied from mach-h1940.c | ||
14 | * 25-Oct-2004 BJD Updates for 2.6.10-rc1 | ||
15 | * 10-Jan-2005 BJD Removed include of s3c2410.h s3c2440.h | ||
16 | * 14-Jan-2005 BJD Added new clock init | ||
17 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
18 | * 14-Mar-2005 BJD Fixed __iomem warnings | ||
19 | * 20-Sep-2005 BJD Added static to non-exported items | ||
20 | * 31-Oct-2005 BJD Added LCD setup for framebuffer | ||
21 | */ | 12 | */ |
22 | 13 | ||
23 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c index 25f7e9f4dcee..b3b0171d5052 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2410.c +++ b/arch/arm/mach-s3c2410/mach-smdk2410.c | |||
@@ -27,10 +27,6 @@ | |||
27 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by | 27 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by |
28 | * Ben Dooks <ben@simtec.co.uk> | 28 | * Ben Dooks <ben@simtec.co.uk> |
29 | * | 29 | * |
30 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
31 | * 20-Sep-2005 BJD Added static to non-exported items | ||
32 | * 01-Apr-2006 BJD Moved init code to common smdk | ||
33 | * | ||
34 | ***********************************************************************/ | 30 | ***********************************************************************/ |
35 | 31 | ||
36 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/mach-smdk2413.c b/arch/arm/mach-s3c2410/mach-smdk2413.c index b7ef7d3c54a9..3a4ca7f6f7b9 100644 --- a/arch/arm/mach-s3c2410/mach-smdk2413.c +++ b/arch/arm/mach-s3c2410/mach-smdk2413.c | |||
@@ -112,7 +112,20 @@ static void __init smdk2413_machine_init(void) | |||
112 | smdk_machine_init(); | 112 | smdk_machine_init(); |
113 | } | 113 | } |
114 | 114 | ||
115 | MACHINE_START(S3C2413, "SMDK2413") | 115 | MACHINE_START(S3C2413, "S3C2413") |
116 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | ||
117 | .phys_io = S3C2410_PA_UART, | ||
118 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | ||
119 | .boot_params = S3C2410_SDRAM_PA + 0x100, | ||
120 | |||
121 | .fixup = smdk2413_fixup, | ||
122 | .init_irq = s3c24xx_init_irq, | ||
123 | .map_io = smdk2413_map_io, | ||
124 | .init_machine = smdk2413_machine_init, | ||
125 | .timer = &s3c24xx_timer, | ||
126 | MACHINE_END | ||
127 | |||
128 | MACHINE_START(SMDK2413, "SMDK2413") | ||
116 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | 129 | /* Maintainer: Ben Dooks <ben@fluff.org> */ |
117 | .phys_io = S3C2410_PA_UART, | 130 | .phys_io = S3C2410_PA_UART, |
118 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, | 131 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index d18efb279d3d..a0d7692cdb2b 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c | |||
@@ -10,25 +10,6 @@ | |||
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | * | 12 | * |
13 | * Modifications: | ||
14 | * 14-Sep-2004 BJD USB Power control | ||
15 | * 04-Sep-2004 BJD Added new uart init, and io init | ||
16 | * 21-Aug-2004 BJD Added struct s3c2410_board | ||
17 | * 06-Aug-2004 BJD Fixed call to time initialisation | ||
18 | * 05-Apr-2004 BJD Copied to make mach-vr1000.c | ||
19 | * 18-Oct-2004 BJD Updated board struct | ||
20 | * 04-Nov-2004 BJD Clock and serial configuration update | ||
21 | * | ||
22 | * 04-Jan-2005 BJD Updated uart init call | ||
23 | * 10-Jan-2005 BJD Removed include of s3c2410.h | ||
24 | * 14-Jan-2005 BJD Added clock init | ||
25 | * 15-Jan-2005 BJD Add serial port device definition | ||
26 | * 20-Jan-2005 BJD Use UPF_IOREMAP for ports | ||
27 | * 10-Feb-2005 BJD Added power-off capability | ||
28 | * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA | ||
29 | * 14-Mar-2006 BJD void __iomem fixes | ||
30 | * 22-Jun-2006 BJD Added DM9000 platform information | ||
31 | * 20-Sep-2005 BJD Added static to non-exported items | ||
32 | */ | 13 | */ |
33 | 14 | ||
34 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
diff --git a/arch/arm/mach-s3c2410/s3c2400-gpio.c b/arch/arm/mach-s3c2410/s3c2400-gpio.c index 5127f39fa9bf..f2a78175a70a 100644 --- a/arch/arm/mach-s3c2410/s3c2400-gpio.c +++ b/arch/arm/mach-s3c2410/s3c2400-gpio.c | |||
@@ -17,10 +17,7 @@ | |||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software | 18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | * | 20 | */ |
21 | * Changelog | ||
22 | * 15-Jan-2006 LCVR Splitted from gpio.c, adding support for the S3C2400 | ||
23 | */ | ||
24 | 21 | ||
25 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
26 | #include <linux/init.h> | 23 | #include <linux/init.h> |
diff --git a/arch/arm/mach-s3c2410/s3c2410.h b/arch/arm/mach-s3c2410/s3c2410.h index 73f1a2474a61..fbed084f26d0 100644 --- a/arch/arm/mach-s3c2410/s3c2410.h +++ b/arch/arm/mach-s3c2410/s3c2410.h | |||
@@ -9,14 +9,6 @@ | |||
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | * | 11 | * |
12 | * Modifications: | ||
13 | * 18-Aug-2004 BJD Created initial version | ||
14 | * 20-Aug-2004 BJD Added s3c2410_board struct | ||
15 | * 04-Sep-2004 BJD Added s3c2410_init_uarts() call | ||
16 | * 17-Oct-2004 BJD Moved board out to cpu | ||
17 | * 04-Jan-2005 BJD Changed uart init | ||
18 | * 10-Jan-2005 BJD Removed timer to cpu.h, moved 2410 specific bits here | ||
19 | * 14-Jan-2005 BJD Added s3c2410_init_clocks call | ||
20 | */ | 12 | */ |
21 | 13 | ||
22 | #ifdef CONFIG_CPU_S3C2410 | 14 | #ifdef CONFIG_CPU_S3C2410 |
diff --git a/arch/arm/mach-s3c2410/s3c2412-irq.c b/arch/arm/mach-s3c2410/s3c2412-irq.c new file mode 100644 index 000000000000..c80ec93dfea9 --- /dev/null +++ b/arch/arm/mach-s3c2410/s3c2412-irq.c | |||
@@ -0,0 +1,130 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/s3c2412-irq.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/ptrace.h> | ||
27 | #include <linux/sysdev.h> | ||
28 | |||
29 | #include <asm/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | #include <asm/io.h> | ||
32 | |||
33 | #include <asm/mach/irq.h> | ||
34 | |||
35 | #include <asm/arch/regs-irq.h> | ||
36 | #include <asm/arch/regs-gpio.h> | ||
37 | |||
38 | #include "cpu.h" | ||
39 | #include "irq.h" | ||
40 | |||
41 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
42 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
43 | * both show the status, they both now need to be acked when the IRQs | ||
44 | * go off. | ||
45 | */ | ||
46 | |||
47 | static void | ||
48 | s3c2412_irq_mask(unsigned int irqno) | ||
49 | { | ||
50 | unsigned long bitval = 1UL << (irqno - IRQ_EINT0); | ||
51 | unsigned long mask; | ||
52 | |||
53 | mask = __raw_readl(S3C2410_INTMSK); | ||
54 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
55 | |||
56 | mask = __raw_readl(S3C2412_EINTMASK); | ||
57 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
58 | } | ||
59 | |||
60 | static inline void | ||
61 | s3c2412_irq_ack(unsigned int irqno) | ||
62 | { | ||
63 | unsigned long bitval = 1UL << (irqno - IRQ_EINT0); | ||
64 | |||
65 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
66 | __raw_writel(bitval, S3C2410_SRCPND); | ||
67 | __raw_writel(bitval, S3C2410_INTPND); | ||
68 | } | ||
69 | |||
70 | static inline void | ||
71 | s3c2412_irq_maskack(unsigned int irqno) | ||
72 | { | ||
73 | unsigned long bitval = 1UL << (irqno - IRQ_EINT0); | ||
74 | unsigned long mask; | ||
75 | |||
76 | mask = __raw_readl(S3C2410_INTMSK); | ||
77 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
78 | |||
79 | mask = __raw_readl(S3C2412_EINTMASK); | ||
80 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
81 | |||
82 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
83 | __raw_writel(bitval, S3C2410_SRCPND); | ||
84 | __raw_writel(bitval, S3C2410_INTPND); | ||
85 | } | ||
86 | |||
87 | static void | ||
88 | s3c2412_irq_unmask(unsigned int irqno) | ||
89 | { | ||
90 | unsigned long bitval = 1UL << (irqno - IRQ_EINT0); | ||
91 | unsigned long mask; | ||
92 | |||
93 | mask = __raw_readl(S3C2412_EINTMASK); | ||
94 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
95 | |||
96 | mask = __raw_readl(S3C2410_INTMSK); | ||
97 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
98 | } | ||
99 | |||
100 | static struct irqchip s3c2412_irq_eint0t4 = { | ||
101 | .ack = s3c2412_irq_ack, | ||
102 | .mask = s3c2412_irq_mask, | ||
103 | .unmask = s3c2412_irq_unmask, | ||
104 | .set_wake = s3c_irq_wake, | ||
105 | .set_type = s3c_irqext_type, | ||
106 | }; | ||
107 | |||
108 | static int s3c2412_irq_add(struct sys_device *sysdev) | ||
109 | { | ||
110 | unsigned int irqno; | ||
111 | |||
112 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
113 | set_irq_chip(irqno, &s3c2412_irq_eint0t4); | ||
114 | set_irq_handler(irqno, do_edge_IRQ); | ||
115 | set_irq_flags(irqno, IRQF_VALID); | ||
116 | } | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static struct sysdev_driver s3c2412_irq_driver = { | ||
122 | .add = s3c2412_irq_add, | ||
123 | }; | ||
124 | |||
125 | static int s3c2412_irq_init(void) | ||
126 | { | ||
127 | return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_irq_driver); | ||
128 | } | ||
129 | |||
130 | arch_initcall(s3c2412_irq_init); | ||
diff --git a/arch/arm/mach-s3c2410/s3c2440-irq.c b/arch/arm/mach-s3c2410/s3c2440-irq.c index acfe3870727b..1667ba1fa43d 100644 --- a/arch/arm/mach-s3c2410/s3c2440-irq.c +++ b/arch/arm/mach-s3c2410/s3c2440-irq.c | |||
@@ -17,9 +17,6 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | * Changelog: | ||
21 | * 25-Jul-2005 BJD Split from irq.c | ||
22 | * | ||
23 | */ | 20 | */ |
24 | 21 | ||
25 | #include <linux/init.h> | 22 | #include <linux/init.h> |
diff --git a/arch/arm/mach-s3c2410/s3c244x-irq.c b/arch/arm/mach-s3c2410/s3c244x-irq.c index 2aadca1ce7eb..44c5affa9b89 100644 --- a/arch/arm/mach-s3c2410/s3c244x-irq.c +++ b/arch/arm/mach-s3c2410/s3c244x-irq.c | |||
@@ -17,9 +17,6 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | * Changelog: | ||
21 | * 25-Jul-2005 BJD Split from irq.c | ||
22 | * | ||
23 | */ | 20 | */ |
24 | 21 | ||
25 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -122,21 +119,24 @@ static int s3c244x_irq_add(struct sys_device *sysdev) | |||
122 | return 0; | 119 | return 0; |
123 | } | 120 | } |
124 | 121 | ||
125 | static struct sysdev_driver s3c244x_irq_driver = { | 122 | static struct sysdev_driver s3c2440_irq_driver = { |
126 | .add = s3c244x_irq_add, | 123 | .add = s3c244x_irq_add, |
127 | }; | 124 | }; |
128 | 125 | ||
129 | static int s3c2440_irq_init(void) | 126 | static int s3c2440_irq_init(void) |
130 | { | 127 | { |
131 | return sysdev_driver_register(&s3c2440_sysclass, &s3c244x_irq_driver); | 128 | return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver); |
132 | } | 129 | } |
133 | 130 | ||
134 | arch_initcall(s3c2440_irq_init); | 131 | arch_initcall(s3c2440_irq_init); |
135 | 132 | ||
133 | static struct sysdev_driver s3c2442_irq_driver = { | ||
134 | .add = s3c244x_irq_add, | ||
135 | }; | ||
136 | 136 | ||
137 | static int s3c2442_irq_init(void) | 137 | static int s3c2442_irq_init(void) |
138 | { | 138 | { |
139 | return sysdev_driver_register(&s3c2442_sysclass, &s3c244x_irq_driver); | 139 | return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver); |
140 | } | 140 | } |
141 | 141 | ||
142 | arch_initcall(s3c2442_irq_init); | 142 | arch_initcall(s3c2442_irq_init); |
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S index 1e89d4080474..44a7a652d625 100644 --- a/arch/arm/mm/proc-arm926.S +++ b/arch/arm/mm/proc-arm926.S | |||
@@ -480,7 +480,7 @@ __arm926_proc_info: | |||
480 | b __arm926_setup | 480 | b __arm926_setup |
481 | .long cpu_arch_name | 481 | .long cpu_arch_name |
482 | .long cpu_elf_name | 482 | .long cpu_elf_name |
483 | .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA | 483 | .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_VFP|HWCAP_EDSP|HWCAP_JAVA |
484 | .long cpu_arm926_name | 484 | .long cpu_arm926_name |
485 | .long arm926_processor_functions | 485 | .long arm926_processor_functions |
486 | .long v4wbi_tlb_fns | 486 | .long v4wbi_tlb_fns |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 95a3892b8d1b..a601a17cf568 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -29,6 +29,10 @@ config GENERIC_HARDIRQS | |||
29 | bool | 29 | bool |
30 | default n | 30 | default n |
31 | 31 | ||
32 | config GENERIC_TIME | ||
33 | bool | ||
34 | default y | ||
35 | |||
32 | config TIME_LOW_RES | 36 | config TIME_LOW_RES |
33 | bool | 37 | bool |
34 | default y | 38 | default y |
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index d5b64e193d92..68a77fe3bb40 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #define TICK_SIZE (tick_nsec / 1000) | 33 | #define TICK_SIZE (tick_nsec / 1000) |
34 | 34 | ||
35 | extern unsigned long wall_jiffies; | ||
36 | |||
37 | unsigned long __nongprelbss __clkin_clock_speed_HZ; | 35 | unsigned long __nongprelbss __clkin_clock_speed_HZ; |
38 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; | 36 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; |
39 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; | 37 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; |
@@ -145,85 +143,6 @@ void time_init(void) | |||
145 | } | 143 | } |
146 | 144 | ||
147 | /* | 145 | /* |
148 | * This version of gettimeofday has near microsecond resolution. | ||
149 | */ | ||
150 | void do_gettimeofday(struct timeval *tv) | ||
151 | { | ||
152 | unsigned long seq; | ||
153 | unsigned long usec, sec; | ||
154 | unsigned long max_ntp_tick; | ||
155 | |||
156 | do { | ||
157 | unsigned long lost; | ||
158 | |||
159 | seq = read_seqbegin(&xtime_lock); | ||
160 | |||
161 | usec = 0; | ||
162 | lost = jiffies - wall_jiffies; | ||
163 | |||
164 | /* | ||
165 | * If time_adjust is negative then NTP is slowing the clock | ||
166 | * so make sure not to go into next possible interval. | ||
167 | * Better to lose some accuracy than have time go backwards.. | ||
168 | */ | ||
169 | if (unlikely(time_adjust < 0)) { | ||
170 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; | ||
171 | usec = min(usec, max_ntp_tick); | ||
172 | |||
173 | if (lost) | ||
174 | usec += lost * max_ntp_tick; | ||
175 | } | ||
176 | else if (unlikely(lost)) | ||
177 | usec += lost * (USEC_PER_SEC / HZ); | ||
178 | |||
179 | sec = xtime.tv_sec; | ||
180 | usec += (xtime.tv_nsec / 1000); | ||
181 | } while (read_seqretry(&xtime_lock, seq)); | ||
182 | |||
183 | while (usec >= 1000000) { | ||
184 | usec -= 1000000; | ||
185 | sec++; | ||
186 | } | ||
187 | |||
188 | tv->tv_sec = sec; | ||
189 | tv->tv_usec = usec; | ||
190 | } | ||
191 | |||
192 | EXPORT_SYMBOL(do_gettimeofday); | ||
193 | |||
194 | int do_settimeofday(struct timespec *tv) | ||
195 | { | ||
196 | time_t wtm_sec, sec = tv->tv_sec; | ||
197 | long wtm_nsec, nsec = tv->tv_nsec; | ||
198 | |||
199 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
200 | return -EINVAL; | ||
201 | |||
202 | write_seqlock_irq(&xtime_lock); | ||
203 | /* | ||
204 | * This is revolting. We need to set "xtime" correctly. However, the | ||
205 | * value in this location is the value at the most recent update of | ||
206 | * wall time. Discover what correction gettimeofday() would have | ||
207 | * made, and then undo it! | ||
208 | */ | ||
209 | nsec -= 0 * NSEC_PER_USEC; | ||
210 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
211 | |||
212 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
213 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
214 | |||
215 | set_normalized_timespec(&xtime, sec, nsec); | ||
216 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
217 | |||
218 | ntp_clear(); | ||
219 | write_sequnlock_irq(&xtime_lock); | ||
220 | clock_was_set(); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | EXPORT_SYMBOL(do_settimeofday); | ||
225 | |||
226 | /* | ||
227 | * Scheduler clock - returns current time in nanosec units. | 146 | * Scheduler clock - returns current time in nanosec units. |
228 | */ | 147 | */ |
229 | unsigned long long sched_clock(void) | 148 | unsigned long long sched_clock(void) |
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index ab98fc21a541..5427a842e841 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile | |||
@@ -39,7 +39,6 @@ obj-$(CONFIG_VM86) += vm86.o | |||
39 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 39 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
40 | obj-$(CONFIG_HPET_TIMER) += hpet.o | 40 | obj-$(CONFIG_HPET_TIMER) += hpet.o |
41 | obj-$(CONFIG_K8_NB) += k8.o | 41 | obj-$(CONFIG_K8_NB) += k8.o |
42 | obj-$(CONFIG_AUDIT) += audit.o | ||
43 | 42 | ||
44 | EXTRA_AFLAGS := -traditional | 43 | EXTRA_AFLAGS := -traditional |
45 | 44 | ||
diff --git a/arch/i386/kernel/audit.c b/arch/i386/kernel/audit.c deleted file mode 100644 index 5a53c6f371ff..000000000000 --- a/arch/i386/kernel/audit.c +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/types.h> | ||
3 | #include <linux/audit.h> | ||
4 | #include <asm/unistd.h> | ||
5 | |||
6 | static unsigned dir_class[] = { | ||
7 | #include <asm-generic/audit_dir_write.h> | ||
8 | ~0U | ||
9 | }; | ||
10 | |||
11 | static unsigned chattr_class[] = { | ||
12 | #include <asm-generic/audit_change_attr.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static int __init audit_classes_init(void) | ||
17 | { | ||
18 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | ||
19 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | __initcall(audit_classes_init); | ||
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 674de8943478..db274da7dba1 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -75,6 +75,10 @@ config DMA_IS_NORMAL | |||
75 | depends on IA64_SGI_SN2 | 75 | depends on IA64_SGI_SN2 |
76 | default y | 76 | default y |
77 | 77 | ||
78 | config AUDIT_ARCH | ||
79 | bool | ||
80 | default y | ||
81 | |||
78 | choice | 82 | choice |
79 | prompt "System type" | 83 | prompt "System type" |
80 | default IA64_GENERIC | 84 | default IA64_GENERIC |
diff --git a/arch/ia64/ia32/audit.c b/arch/ia64/ia32/audit.c index ab94f2e58cdd..92d7d0c8d93f 100644 --- a/arch/ia64/ia32/audit.c +++ b/arch/ia64/ia32/audit.c | |||
@@ -9,3 +9,29 @@ unsigned ia32_chattr_class[] = { | |||
9 | #include <asm-generic/audit_change_attr.h> | 9 | #include <asm-generic/audit_change_attr.h> |
10 | ~0U | 10 | ~0U |
11 | }; | 11 | }; |
12 | |||
13 | unsigned ia32_write_class[] = { | ||
14 | #include <asm-generic/audit_write.h> | ||
15 | ~0U | ||
16 | }; | ||
17 | |||
18 | unsigned ia32_read_class[] = { | ||
19 | #include <asm-generic/audit_read.h> | ||
20 | ~0U | ||
21 | }; | ||
22 | |||
23 | int ia32_classify_syscall(unsigned syscall) | ||
24 | { | ||
25 | switch(syscall) { | ||
26 | case __NR_open: | ||
27 | return 2; | ||
28 | case __NR_openat: | ||
29 | return 3; | ||
30 | case __NR_socketcall: | ||
31 | return 4; | ||
32 | case __NR_execve: | ||
33 | return 5; | ||
34 | default: | ||
35 | return 1; | ||
36 | } | ||
37 | } | ||
diff --git a/arch/ia64/kernel/audit.c b/arch/ia64/kernel/audit.c index f2512931ccaf..04682555a28c 100644 --- a/arch/ia64/kernel/audit.c +++ b/arch/ia64/kernel/audit.c | |||
@@ -8,19 +8,54 @@ static unsigned dir_class[] = { | |||
8 | ~0U | 8 | ~0U |
9 | }; | 9 | }; |
10 | 10 | ||
11 | static unsigned read_class[] = { | ||
12 | #include <asm-generic/audit_read.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static unsigned write_class[] = { | ||
17 | #include <asm-generic/audit_write.h> | ||
18 | ~0U | ||
19 | }; | ||
20 | |||
11 | static unsigned chattr_class[] = { | 21 | static unsigned chattr_class[] = { |
12 | #include <asm-generic/audit_change_attr.h> | 22 | #include <asm-generic/audit_change_attr.h> |
13 | ~0U | 23 | ~0U |
14 | }; | 24 | }; |
15 | 25 | ||
26 | int audit_classify_syscall(int abi, unsigned syscall) | ||
27 | { | ||
28 | #ifdef CONFIG_IA32_SUPPORT | ||
29 | extern int ia32_classify_syscall(unsigned); | ||
30 | if (abi == AUDIT_ARCH_I386) | ||
31 | return ia32_classify_syscall(syscall); | ||
32 | #endif | ||
33 | switch(syscall) { | ||
34 | case __NR_open: | ||
35 | return 2; | ||
36 | case __NR_openat: | ||
37 | return 3; | ||
38 | case __NR_execve: | ||
39 | return 5; | ||
40 | default: | ||
41 | return 0; | ||
42 | } | ||
43 | } | ||
44 | |||
16 | static int __init audit_classes_init(void) | 45 | static int __init audit_classes_init(void) |
17 | { | 46 | { |
18 | #ifdef CONFIG_IA32_SUPPORT | 47 | #ifdef CONFIG_IA32_SUPPORT |
19 | extern __u32 ia32_dir_class[]; | 48 | extern __u32 ia32_dir_class[]; |
49 | extern __u32 ia32_write_class[]; | ||
50 | extern __u32 ia32_read_class[]; | ||
20 | extern __u32 ia32_chattr_class[]; | 51 | extern __u32 ia32_chattr_class[]; |
52 | audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class); | ||
53 | audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class); | ||
21 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); | 54 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); |
22 | audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); | 55 | audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); |
23 | #endif | 56 | #endif |
57 | audit_register_class(AUDIT_CLASS_WRITE, write_class); | ||
58 | audit_register_class(AUDIT_CLASS_READ, read_class); | ||
24 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | 59 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); |
25 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | 60 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); |
26 | return 0; | 61 | return 0; |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 12701cf32d99..fef06571be99 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1605,8 +1605,8 @@ sys_call_table: | |||
1605 | data8 sys_ni_syscall // 1295 reserved for ppoll | 1605 | data8 sys_ni_syscall // 1295 reserved for ppoll |
1606 | data8 sys_unshare | 1606 | data8 sys_unshare |
1607 | data8 sys_splice | 1607 | data8 sys_splice |
1608 | data8 sys_set_robust_list | 1608 | data8 sys_ni_syscall // reserved for set_robust_list |
1609 | data8 sys_get_robust_list | 1609 | data8 sys_ni_syscall // reserved for get_robust_list |
1610 | data8 sys_sync_file_range // 1300 | 1610 | data8 sys_sync_file_range // 1300 |
1611 | data8 sys_tee | 1611 | data8 sys_tee |
1612 | data8 sys_vmsplice | 1612 | data8 sys_vmsplice |
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index 29236f0c62b5..44d540efa6d1 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S | |||
@@ -197,6 +197,11 @@ start_ap: | |||
197 | ;; | 197 | ;; |
198 | srlz.i | 198 | srlz.i |
199 | ;; | 199 | ;; |
200 | { | ||
201 | flushrs // must be first insn in group | ||
202 | srlz.i | ||
203 | } | ||
204 | ;; | ||
200 | /* | 205 | /* |
201 | * Save the region registers, predicate before they get clobbered | 206 | * Save the region registers, predicate before they get clobbered |
202 | */ | 207 | */ |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index c7ccd6ee1ddf..84a7e52f56f6 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -4936,13 +4936,15 @@ abort_locked: | |||
4936 | if (likely(ctx)) { | 4936 | if (likely(ctx)) { |
4937 | DPRINT(("context unlocked\n")); | 4937 | DPRINT(("context unlocked\n")); |
4938 | UNPROTECT_CTX(ctx, flags); | 4938 | UNPROTECT_CTX(ctx, flags); |
4939 | fput(file); | ||
4940 | } | 4939 | } |
4941 | 4940 | ||
4942 | /* copy argument back to user, if needed */ | 4941 | /* copy argument back to user, if needed */ |
4943 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; | 4942 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; |
4944 | 4943 | ||
4945 | error_args: | 4944 | error_args: |
4945 | if (file) | ||
4946 | fput(file); | ||
4947 | |||
4946 | kfree(args_k); | 4948 | kfree(args_k); |
4947 | 4949 | ||
4948 | DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret)); | 4950 | DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret)); |
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 40722d88607a..9ef62a3fbfad 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c | |||
@@ -163,10 +163,25 @@ sys_pipe (void) | |||
163 | return retval; | 163 | return retval; |
164 | } | 164 | } |
165 | 165 | ||
166 | int ia64_mmap_check(unsigned long addr, unsigned long len, | ||
167 | unsigned long flags) | ||
168 | { | ||
169 | unsigned long roff; | ||
170 | |||
171 | /* | ||
172 | * Don't permit mappings into unmapped space, the virtual page table | ||
173 | * of a region, or across a region boundary. Note: RGN_MAP_LIMIT is | ||
174 | * equal to 2^n-PAGE_SIZE (for some integer n <= 61) and len > 0. | ||
175 | */ | ||
176 | roff = REGION_OFFSET(addr); | ||
177 | if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len))) | ||
178 | return -EINVAL; | ||
179 | return 0; | ||
180 | } | ||
181 | |||
166 | static inline unsigned long | 182 | static inline unsigned long |
167 | do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff) | 183 | do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff) |
168 | { | 184 | { |
169 | unsigned long roff; | ||
170 | struct file *file = NULL; | 185 | struct file *file = NULL; |
171 | 186 | ||
172 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 187 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
@@ -188,17 +203,6 @@ do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, un | |||
188 | goto out; | 203 | goto out; |
189 | } | 204 | } |
190 | 205 | ||
191 | /* | ||
192 | * Don't permit mappings into unmapped space, the virtual page table of a region, | ||
193 | * or across a region boundary. Note: RGN_MAP_LIMIT is equal to 2^n-PAGE_SIZE | ||
194 | * (for some integer n <= 61) and len > 0. | ||
195 | */ | ||
196 | roff = REGION_OFFSET(addr); | ||
197 | if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len))) { | ||
198 | addr = -EINVAL; | ||
199 | goto out; | ||
200 | } | ||
201 | |||
202 | down_write(¤t->mm->mmap_sem); | 206 | down_write(¤t->mm->mmap_sem); |
203 | addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 207 | addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |
204 | up_write(¤t->mm->mmap_sem); | 208 | up_write(¤t->mm->mmap_sem); |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index c119e8b620de..5f2dcba7fa8d 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
@@ -565,7 +565,7 @@ static void __init sn_init_pdas(char **cmdline_p) | |||
565 | * Also sets up a few fields in the nodepda. Also known as | 565 | * Also sets up a few fields in the nodepda. Also known as |
566 | * platform_cpu_init() by the ia64 machvec code. | 566 | * platform_cpu_init() by the ia64 machvec code. |
567 | */ | 567 | */ |
568 | void __init sn_cpu_init(void) | 568 | void __cpuinit sn_cpu_init(void) |
569 | { | 569 | { |
570 | int cpuid; | 570 | int cpuid; |
571 | int cpuphyid; | 571 | int cpuphyid; |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4d4b6fb156e1..694b0c63ee50 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -95,6 +95,10 @@ config GENERIC_TBSYNC | |||
95 | default y if PPC32 && SMP | 95 | default y if PPC32 && SMP |
96 | default n | 96 | default n |
97 | 97 | ||
98 | config AUDIT_ARCH | ||
99 | bool | ||
100 | default y | ||
101 | |||
98 | config DEFAULT_UIMAGE | 102 | config DEFAULT_UIMAGE |
99 | bool | 103 | bool |
100 | help | 104 | help |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 956c2e5564b7..7d32ad0194a4 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -70,6 +70,8 @@ obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y) | |||
70 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o | 70 | kexec-$(CONFIG_PPC64) := machine_kexec_64.o |
71 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o | 71 | kexec-$(CONFIG_PPC32) := machine_kexec_32.o |
72 | obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y) | 72 | obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y) |
73 | obj-$(CONFIG_AUDIT) += audit.o | ||
74 | obj64-$(CONFIG_AUDIT) += compat_audit.o | ||
73 | 75 | ||
74 | ifeq ($(CONFIG_PPC_ISERIES),y) | 76 | ifeq ($(CONFIG_PPC_ISERIES),y) |
75 | $(obj)/head_64.o: $(obj)/lparmap.s | 77 | $(obj)/head_64.o: $(obj)/lparmap.s |
diff --git a/arch/powerpc/kernel/audit.c b/arch/powerpc/kernel/audit.c new file mode 100644 index 000000000000..7fe5e6300e9a --- /dev/null +++ b/arch/powerpc/kernel/audit.c | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/types.h> | ||
3 | #include <linux/audit.h> | ||
4 | #include <asm/unistd.h> | ||
5 | |||
6 | static unsigned dir_class[] = { | ||
7 | #include <asm-generic/audit_dir_write.h> | ||
8 | ~0U | ||
9 | }; | ||
10 | |||
11 | static unsigned read_class[] = { | ||
12 | #include <asm-generic/audit_read.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static unsigned write_class[] = { | ||
17 | #include <asm-generic/audit_write.h> | ||
18 | ~0U | ||
19 | }; | ||
20 | |||
21 | static unsigned chattr_class[] = { | ||
22 | #include <asm-generic/audit_change_attr.h> | ||
23 | ~0U | ||
24 | }; | ||
25 | |||
26 | int audit_classify_syscall(int abi, unsigned syscall) | ||
27 | { | ||
28 | #ifdef CONFIG_PPC64 | ||
29 | extern int ppc32_classify_syscall(unsigned); | ||
30 | if (abi == AUDIT_ARCH_PPC) | ||
31 | return ppc32_classify_syscall(syscall); | ||
32 | #endif | ||
33 | switch(syscall) { | ||
34 | case __NR_open: | ||
35 | return 2; | ||
36 | case __NR_openat: | ||
37 | return 3; | ||
38 | case __NR_socketcall: | ||
39 | return 4; | ||
40 | case __NR_execve: | ||
41 | return 5; | ||
42 | default: | ||
43 | return 0; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | static int __init audit_classes_init(void) | ||
48 | { | ||
49 | #ifdef CONFIG_PPC64 | ||
50 | extern __u32 ppc32_dir_class[]; | ||
51 | extern __u32 ppc32_write_class[]; | ||
52 | extern __u32 ppc32_read_class[]; | ||
53 | extern __u32 ppc32_chattr_class[]; | ||
54 | audit_register_class(AUDIT_CLASS_WRITE_32, ppc32_write_class); | ||
55 | audit_register_class(AUDIT_CLASS_READ_32, ppc32_read_class); | ||
56 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ppc32_dir_class); | ||
57 | audit_register_class(AUDIT_CLASS_CHATTR_32, ppc32_chattr_class); | ||
58 | #endif | ||
59 | audit_register_class(AUDIT_CLASS_WRITE, write_class); | ||
60 | audit_register_class(AUDIT_CLASS_READ, read_class); | ||
61 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | ||
62 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | __initcall(audit_classes_init); | ||
diff --git a/arch/powerpc/kernel/compat_audit.c b/arch/powerpc/kernel/compat_audit.c new file mode 100644 index 000000000000..640d4bb29321 --- /dev/null +++ b/arch/powerpc/kernel/compat_audit.c | |||
@@ -0,0 +1,38 @@ | |||
1 | #undef __powerpc64__ | ||
2 | #include <asm/unistd.h> | ||
3 | |||
4 | unsigned ppc32_dir_class[] = { | ||
5 | #include <asm-generic/audit_dir_write.h> | ||
6 | ~0U | ||
7 | }; | ||
8 | |||
9 | unsigned ppc32_chattr_class[] = { | ||
10 | #include <asm-generic/audit_change_attr.h> | ||
11 | ~0U | ||
12 | }; | ||
13 | |||
14 | unsigned ppc32_write_class[] = { | ||
15 | #include <asm-generic/audit_write.h> | ||
16 | ~0U | ||
17 | }; | ||
18 | |||
19 | unsigned ppc32_read_class[] = { | ||
20 | #include <asm-generic/audit_read.h> | ||
21 | ~0U | ||
22 | }; | ||
23 | |||
24 | int ppc32_classify_syscall(unsigned syscall) | ||
25 | { | ||
26 | switch(syscall) { | ||
27 | case __NR_open: | ||
28 | return 2; | ||
29 | case __NR_openat: | ||
30 | return 3; | ||
31 | case __NR_socketcall: | ||
32 | return 4; | ||
33 | case __NR_execve: | ||
34 | return 5; | ||
35 | default: | ||
36 | return 1; | ||
37 | } | ||
38 | } | ||
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ae071a11ce71..2f4f70c4dbb2 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -118,6 +118,10 @@ config SYSVIPC_COMPAT | |||
118 | depends on COMPAT && SYSVIPC | 118 | depends on COMPAT && SYSVIPC |
119 | default y | 119 | default y |
120 | 120 | ||
121 | config AUDIT_ARCH | ||
122 | bool | ||
123 | default y | ||
124 | |||
121 | comment "Code generation options" | 125 | comment "Code generation options" |
122 | 126 | ||
123 | choice | 127 | choice |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 86601a945709..9a33ed6ca696 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -16,9 +16,11 @@ extra-y += head.o init_task.o vmlinux.lds | |||
16 | obj-$(CONFIG_MODULES) += s390_ksyms.o module.o | 16 | obj-$(CONFIG_MODULES) += s390_ksyms.o module.o |
17 | obj-$(CONFIG_SMP) += smp.o | 17 | obj-$(CONFIG_SMP) += smp.o |
18 | 18 | ||
19 | obj-$(CONFIG_AUDIT) += audit.o | ||
20 | compat-obj-$(CONFIG_AUDIT) += compat_audit.o | ||
19 | obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ | 21 | obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ |
20 | compat_wrapper.o compat_exec_domain.o \ | 22 | compat_wrapper.o compat_exec_domain.o \ |
21 | binfmt_elf32.o | 23 | binfmt_elf32.o $(compat-obj-y) |
22 | 24 | ||
23 | obj-$(CONFIG_VIRT_TIMER) += vtime.o | 25 | obj-$(CONFIG_VIRT_TIMER) += vtime.o |
24 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 26 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
diff --git a/arch/s390/kernel/audit.c b/arch/s390/kernel/audit.c new file mode 100644 index 000000000000..0741d9193390 --- /dev/null +++ b/arch/s390/kernel/audit.c | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/types.h> | ||
3 | #include <linux/audit.h> | ||
4 | #include <asm/unistd.h> | ||
5 | |||
6 | static unsigned dir_class[] = { | ||
7 | #include <asm-generic/audit_dir_write.h> | ||
8 | ~0U | ||
9 | }; | ||
10 | |||
11 | static unsigned read_class[] = { | ||
12 | #include <asm-generic/audit_read.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static unsigned write_class[] = { | ||
17 | #include <asm-generic/audit_write.h> | ||
18 | ~0U | ||
19 | }; | ||
20 | |||
21 | static unsigned chattr_class[] = { | ||
22 | #include <asm-generic/audit_change_attr.h> | ||
23 | ~0U | ||
24 | }; | ||
25 | |||
26 | int audit_classify_syscall(int abi, unsigned syscall) | ||
27 | { | ||
28 | #ifdef CONFIG_COMPAT | ||
29 | extern int s390_classify_syscall(unsigned); | ||
30 | if (abi == AUDIT_ARCH_S390) | ||
31 | return s390_classify_syscall(syscall); | ||
32 | #endif | ||
33 | switch(syscall) { | ||
34 | case __NR_open: | ||
35 | return 2; | ||
36 | case __NR_openat: | ||
37 | return 3; | ||
38 | case __NR_socketcall: | ||
39 | return 4; | ||
40 | case __NR_execve: | ||
41 | return 5; | ||
42 | default: | ||
43 | return 0; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | static int __init audit_classes_init(void) | ||
48 | { | ||
49 | #ifdef CONFIG_COMPAT | ||
50 | extern __u32 s390_dir_class[]; | ||
51 | extern __u32 s390_write_class[]; | ||
52 | extern __u32 s390_read_class[]; | ||
53 | extern __u32 s390_chattr_class[]; | ||
54 | audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class); | ||
55 | audit_register_class(AUDIT_CLASS_READ_32, s390_read_class); | ||
56 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class); | ||
57 | audit_register_class(AUDIT_CLASS_CHATTR_32, s390_chattr_class); | ||
58 | #endif | ||
59 | audit_register_class(AUDIT_CLASS_WRITE, write_class); | ||
60 | audit_register_class(AUDIT_CLASS_READ, read_class); | ||
61 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | ||
62 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | __initcall(audit_classes_init); | ||
diff --git a/arch/s390/kernel/compat_audit.c b/arch/s390/kernel/compat_audit.c new file mode 100644 index 000000000000..16d9436bfa91 --- /dev/null +++ b/arch/s390/kernel/compat_audit.c | |||
@@ -0,0 +1,38 @@ | |||
1 | #undef __s390x__ | ||
2 | #include <asm/unistd.h> | ||
3 | |||
4 | unsigned s390_dir_class[] = { | ||
5 | #include <asm-generic/audit_dir_write.h> | ||
6 | ~0U | ||
7 | }; | ||
8 | |||
9 | unsigned s390_chattr_class[] = { | ||
10 | #include <asm-generic/audit_change_attr.h> | ||
11 | ~0U | ||
12 | }; | ||
13 | |||
14 | unsigned s390_write_class[] = { | ||
15 | #include <asm-generic/audit_write.h> | ||
16 | ~0U | ||
17 | }; | ||
18 | |||
19 | unsigned s390_read_class[] = { | ||
20 | #include <asm-generic/audit_read.h> | ||
21 | ~0U | ||
22 | }; | ||
23 | |||
24 | int s390_classify_syscall(unsigned syscall) | ||
25 | { | ||
26 | switch(syscall) { | ||
27 | case __NR_open: | ||
28 | return 2; | ||
29 | case __NR_openat: | ||
30 | return 3; | ||
31 | case __NR_socketcall: | ||
32 | return 4; | ||
33 | case __NR_execve: | ||
34 | return 5; | ||
35 | default: | ||
36 | return 1; | ||
37 | } | ||
38 | } | ||
diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile index 8ca57ffa2b70..ebf20043991c 100644 --- a/arch/sh64/Makefile +++ b/arch/sh64/Makefile | |||
@@ -26,7 +26,6 @@ LDFLAGS += -EB -mshelf32_linux | |||
26 | endif | 26 | endif |
27 | 27 | ||
28 | # No requirements for endianess support from AFLAGS, 'as' always run through gcc | 28 | # No requirements for endianess support from AFLAGS, 'as' always run through gcc |
29 | AFLAGS += -m5 -isa=sh64 -traditional | ||
30 | CFLAGS += $(cpu-y) | 29 | CFLAGS += $(cpu-y) |
31 | 30 | ||
32 | LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ | 31 | LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ |
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index dba8e14013b6..db475b7833fb 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c | |||
@@ -355,6 +355,9 @@ void machine_power_off(void) | |||
355 | enter_deep_standby(); | 355 | enter_deep_standby(); |
356 | } | 356 | } |
357 | 357 | ||
358 | void (*pm_power_off)(void) = machine_power_off; | ||
359 | EXPORT_SYMBOL(pm_power_off); | ||
360 | |||
358 | void show_regs(struct pt_regs * regs) | 361 | void show_regs(struct pt_regs * regs) |
359 | { | 362 | { |
360 | unsigned long long ah, al, bh, bl, ch, cl; | 363 | unsigned long long ah, al, bh, bl, ch, cl; |
diff --git a/arch/sh64/mach-cayman/setup.c b/arch/sh64/mach-cayman/setup.c index d84895dda3cd..3ed87cd059d0 100644 --- a/arch/sh64/mach-cayman/setup.c +++ b/arch/sh64/mach-cayman/setup.c | |||
@@ -112,8 +112,10 @@ struct resource io_resources[] = { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | struct resource kram_resources[] = { | 114 | struct resource kram_resources[] = { |
115 | { "Kernel code", 0, 0 }, /* These must be last in the array */ | 115 | /* These must be last in the array */ |
116 | { "Kernel data", 0, 0 } /* These must be last in the array */ | 116 | { .name = "Kernel code", .start = 0, .end = 0 }, |
117 | /* These must be last in the array */ | ||
118 | { .name = "Kernel data", .start = 0, .end = 0 } | ||
117 | }; | 119 | }; |
118 | 120 | ||
119 | struct resource xram_resources[] = { | 121 | struct resource xram_resources[] = { |
diff --git a/arch/sh64/mm/ioremap.c b/arch/sh64/mm/ioremap.c index fb1866fa2c9d..80c56754f513 100644 --- a/arch/sh64/mm/ioremap.c +++ b/arch/sh64/mm/ioremap.c | |||
@@ -449,7 +449,9 @@ ioremap_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, | |||
449 | if (p + 32 >= e) /* Better than nothing */ | 449 | if (p + 32 >= e) /* Better than nothing */ |
450 | break; | 450 | break; |
451 | if ((nm = r->name) == 0) nm = "???"; | 451 | if ((nm = r->name) == 0) nm = "???"; |
452 | p += sprintf(p, "%08lx-%08lx: %s\n", r->start, r->end, nm); | 452 | p += sprintf(p, "%08lx-%08lx: %s\n", |
453 | (unsigned long)r->start, | ||
454 | (unsigned long)r->end, nm); | ||
453 | } | 455 | } |
454 | 456 | ||
455 | return p-buf; | 457 | return p-buf; |
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index a41c8a5c2007..94ff58c9d4a9 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c | |||
@@ -219,6 +219,21 @@ out: | |||
219 | return err; | 219 | return err; |
220 | } | 220 | } |
221 | 221 | ||
222 | int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) | ||
223 | { | ||
224 | if (ARCH_SUN4C_SUN4 && | ||
225 | (len > 0x20000000 || | ||
226 | ((flags & MAP_FIXED) && | ||
227 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
228 | return -EINVAL; | ||
229 | |||
230 | /* See asm-sparc/uaccess.h */ | ||
231 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
232 | return -EINVAL; | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
222 | /* Linux version of mmap */ | 237 | /* Linux version of mmap */ |
223 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, | 238 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, |
224 | unsigned long prot, unsigned long flags, unsigned long fd, | 239 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -233,25 +248,13 @@ static unsigned long do_mmap2(unsigned long addr, unsigned long len, | |||
233 | goto out; | 248 | goto out; |
234 | } | 249 | } |
235 | 250 | ||
236 | retval = -EINVAL; | ||
237 | len = PAGE_ALIGN(len); | 251 | len = PAGE_ALIGN(len); |
238 | if (ARCH_SUN4C_SUN4 && | ||
239 | (len > 0x20000000 || | ||
240 | ((flags & MAP_FIXED) && | ||
241 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
242 | goto out_putf; | ||
243 | |||
244 | /* See asm-sparc/uaccess.h */ | ||
245 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
246 | goto out_putf; | ||
247 | |||
248 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 252 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
249 | 253 | ||
250 | down_write(¤t->mm->mmap_sem); | 254 | down_write(¤t->mm->mmap_sem); |
251 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 255 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |
252 | up_write(¤t->mm->mmap_sem); | 256 | up_write(¤t->mm->mmap_sem); |
253 | 257 | ||
254 | out_putf: | ||
255 | if (file) | 258 | if (file) |
256 | fput(file); | 259 | fput(file); |
257 | out: | 260 | out: |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 8a36ba8868db..8d8ca716f7a7 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -34,6 +34,10 @@ config ARCH_MAY_HAVE_PC_FDC | |||
34 | bool | 34 | bool |
35 | default y | 35 | default y |
36 | 36 | ||
37 | config AUDIT_ARCH | ||
38 | bool | ||
39 | default y | ||
40 | |||
37 | choice | 41 | choice |
38 | prompt "Kernel page size" | 42 | prompt "Kernel page size" |
39 | default SPARC64_PAGE_SIZE_8KB | 43 | default SPARC64_PAGE_SIZE_8KB |
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 86c9fe3f3e4a..e1eabebaed39 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile | |||
@@ -25,6 +25,9 @@ obj-$(CONFIG_MODULES) += module.o | |||
25 | obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o | 25 | obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o |
26 | obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o | 26 | obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o |
27 | obj-$(CONFIG_KPROBES) += kprobes.o | 27 | obj-$(CONFIG_KPROBES) += kprobes.o |
28 | obj-$(CONFIG_AUDIT) += audit.o | ||
29 | obj-$(CONFIG_AUDIT)$(CONFIG_SPARC32_COMPAT) += compat_audit.o | ||
30 | obj-y += $(obj-yy) | ||
28 | 31 | ||
29 | ifdef CONFIG_SUNOS_EMUL | 32 | ifdef CONFIG_SUNOS_EMUL |
30 | obj-y += sys_sunos32.o sunos_ioctl32.o | 33 | obj-y += sys_sunos32.o sunos_ioctl32.o |
diff --git a/arch/sparc64/kernel/audit.c b/arch/sparc64/kernel/audit.c new file mode 100644 index 000000000000..aef19cc27072 --- /dev/null +++ b/arch/sparc64/kernel/audit.c | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/types.h> | ||
3 | #include <linux/audit.h> | ||
4 | #include <asm/unistd.h> | ||
5 | |||
6 | static unsigned dir_class[] = { | ||
7 | #include <asm-generic/audit_dir_write.h> | ||
8 | ~0U | ||
9 | }; | ||
10 | |||
11 | static unsigned read_class[] = { | ||
12 | #include <asm-generic/audit_read.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static unsigned write_class[] = { | ||
17 | #include <asm-generic/audit_write.h> | ||
18 | ~0U | ||
19 | }; | ||
20 | |||
21 | static unsigned chattr_class[] = { | ||
22 | #include <asm-generic/audit_change_attr.h> | ||
23 | ~0U | ||
24 | }; | ||
25 | |||
26 | int audit_classify_syscall(int abi, unsigned syscall) | ||
27 | { | ||
28 | #ifdef CONFIG_SPARC32_COMPAT | ||
29 | extern int sparc32_classify_syscall(unsigned); | ||
30 | if (abi == AUDIT_ARCH_SPARC) | ||
31 | return sparc32_classify_syscall(syscall); | ||
32 | #endif | ||
33 | switch(syscall) { | ||
34 | case __NR_open: | ||
35 | return 2; | ||
36 | case __NR_openat: | ||
37 | return 3; | ||
38 | case __NR_socketcall: | ||
39 | return 4; | ||
40 | case __NR_execve: | ||
41 | return 5; | ||
42 | default: | ||
43 | return 0; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | static int __init audit_classes_init(void) | ||
48 | { | ||
49 | #ifdef CONFIG_SPARC32_COMPAT | ||
50 | extern __u32 sparc32_dir_class[]; | ||
51 | extern __u32 sparc32_write_class[]; | ||
52 | extern __u32 sparc32_read_class[]; | ||
53 | extern __u32 sparc32_chattr_class[]; | ||
54 | audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); | ||
55 | audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); | ||
56 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); | ||
57 | audit_register_class(AUDIT_CLASS_CHATTR_32, sparc32_chattr_class); | ||
58 | #endif | ||
59 | audit_register_class(AUDIT_CLASS_WRITE, write_class); | ||
60 | audit_register_class(AUDIT_CLASS_READ, read_class); | ||
61 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | ||
62 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | __initcall(audit_classes_init); | ||
diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc64/kernel/compat_audit.c new file mode 100644 index 000000000000..cca96c91b780 --- /dev/null +++ b/arch/sparc64/kernel/compat_audit.c | |||
@@ -0,0 +1,37 @@ | |||
1 | #include <asm-sparc/unistd.h> | ||
2 | |||
3 | unsigned sparc32_dir_class[] = { | ||
4 | #include <asm-generic/audit_dir_write.h> | ||
5 | ~0U | ||
6 | }; | ||
7 | |||
8 | unsigned sparc32_chattr_class[] = { | ||
9 | #include <asm-generic/audit_change_attr.h> | ||
10 | ~0U | ||
11 | }; | ||
12 | |||
13 | unsigned sparc32_write_class[] = { | ||
14 | #include <asm-generic/audit_write.h> | ||
15 | ~0U | ||
16 | }; | ||
17 | |||
18 | unsigned sparc32_read_class[] = { | ||
19 | #include <asm-generic/audit_read.h> | ||
20 | ~0U | ||
21 | }; | ||
22 | |||
23 | int sparc32_classify_syscall(unsigned syscall) | ||
24 | { | ||
25 | switch(syscall) { | ||
26 | case __NR_open: | ||
27 | return 2; | ||
28 | case __NR_openat: | ||
29 | return 3; | ||
30 | case __NR_socketcall: | ||
31 | return 4; | ||
32 | case __NR_execve: | ||
33 | return 5; | ||
34 | default: | ||
35 | return 1; | ||
36 | } | ||
37 | } | ||
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 054d0abdb7ee..bf5f14ee73de 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c | |||
@@ -548,6 +548,26 @@ asmlinkage long sparc64_personality(unsigned long personality) | |||
548 | return ret; | 548 | return ret; |
549 | } | 549 | } |
550 | 550 | ||
551 | int sparc64_mmap_check(unsigned long addr, unsigned long len, | ||
552 | unsigned long flags) | ||
553 | { | ||
554 | if (test_thread_flag(TIF_32BIT)) { | ||
555 | if (len >= STACK_TOP32) | ||
556 | return -EINVAL; | ||
557 | |||
558 | if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) | ||
559 | return -EINVAL; | ||
560 | } else { | ||
561 | if (len >= VA_EXCLUDE_START) | ||
562 | return -EINVAL; | ||
563 | |||
564 | if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) | ||
565 | return -EINVAL; | ||
566 | } | ||
567 | |||
568 | return 0; | ||
569 | } | ||
570 | |||
551 | /* Linux version of mmap */ | 571 | /* Linux version of mmap */ |
552 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | 572 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, |
553 | unsigned long prot, unsigned long flags, unsigned long fd, | 573 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -563,27 +583,11 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | |||
563 | } | 583 | } |
564 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 584 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
565 | len = PAGE_ALIGN(len); | 585 | len = PAGE_ALIGN(len); |
566 | retval = -EINVAL; | ||
567 | |||
568 | if (test_thread_flag(TIF_32BIT)) { | ||
569 | if (len >= STACK_TOP32) | ||
570 | goto out_putf; | ||
571 | |||
572 | if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) | ||
573 | goto out_putf; | ||
574 | } else { | ||
575 | if (len >= VA_EXCLUDE_START) | ||
576 | goto out_putf; | ||
577 | |||
578 | if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) | ||
579 | goto out_putf; | ||
580 | } | ||
581 | 586 | ||
582 | down_write(¤t->mm->mmap_sem); | 587 | down_write(¤t->mm->mmap_sem); |
583 | retval = do_mmap(file, addr, len, prot, flags, off); | 588 | retval = do_mmap(file, addr, len, prot, flags, off); |
584 | up_write(¤t->mm->mmap_sem); | 589 | up_write(¤t->mm->mmap_sem); |
585 | 590 | ||
586 | out_putf: | ||
587 | if (file) | 591 | if (file) |
588 | fput(file); | 592 | fput(file); |
589 | out: | 593 | out: |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 28df7d88ce2c..6cd4878625f1 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -85,6 +85,10 @@ config DMI | |||
85 | bool | 85 | bool |
86 | default y | 86 | default y |
87 | 87 | ||
88 | config AUDIT_ARCH | ||
89 | bool | ||
90 | default y | ||
91 | |||
88 | source "init/Kconfig" | 92 | source "init/Kconfig" |
89 | 93 | ||
90 | 94 | ||
diff --git a/arch/x86_64/ia32/audit.c b/arch/x86_64/ia32/audit.c index ab94f2e58cdd..92d7d0c8d93f 100644 --- a/arch/x86_64/ia32/audit.c +++ b/arch/x86_64/ia32/audit.c | |||
@@ -9,3 +9,29 @@ unsigned ia32_chattr_class[] = { | |||
9 | #include <asm-generic/audit_change_attr.h> | 9 | #include <asm-generic/audit_change_attr.h> |
10 | ~0U | 10 | ~0U |
11 | }; | 11 | }; |
12 | |||
13 | unsigned ia32_write_class[] = { | ||
14 | #include <asm-generic/audit_write.h> | ||
15 | ~0U | ||
16 | }; | ||
17 | |||
18 | unsigned ia32_read_class[] = { | ||
19 | #include <asm-generic/audit_read.h> | ||
20 | ~0U | ||
21 | }; | ||
22 | |||
23 | int ia32_classify_syscall(unsigned syscall) | ||
24 | { | ||
25 | switch(syscall) { | ||
26 | case __NR_open: | ||
27 | return 2; | ||
28 | case __NR_openat: | ||
29 | return 3; | ||
30 | case __NR_socketcall: | ||
31 | return 4; | ||
32 | case __NR_execve: | ||
33 | return 5; | ||
34 | default: | ||
35 | return 1; | ||
36 | } | ||
37 | } | ||
diff --git a/arch/x86_64/kernel/audit.c b/arch/x86_64/kernel/audit.c index a067aa468a85..21f33387bef3 100644 --- a/arch/x86_64/kernel/audit.c +++ b/arch/x86_64/kernel/audit.c | |||
@@ -8,19 +8,54 @@ static unsigned dir_class[] = { | |||
8 | ~0U | 8 | ~0U |
9 | }; | 9 | }; |
10 | 10 | ||
11 | static unsigned read_class[] = { | ||
12 | #include <asm-generic/audit_read.h> | ||
13 | ~0U | ||
14 | }; | ||
15 | |||
16 | static unsigned write_class[] = { | ||
17 | #include <asm-generic/audit_write.h> | ||
18 | ~0U | ||
19 | }; | ||
20 | |||
11 | static unsigned chattr_class[] = { | 21 | static unsigned chattr_class[] = { |
12 | #include <asm-generic/audit_change_attr.h> | 22 | #include <asm-generic/audit_change_attr.h> |
13 | ~0U | 23 | ~0U |
14 | }; | 24 | }; |
15 | 25 | ||
26 | int audit_classify_syscall(int abi, unsigned syscall) | ||
27 | { | ||
28 | #ifdef CONFIG_IA32_EMULATION | ||
29 | extern int ia32_classify_syscall(unsigned); | ||
30 | if (abi == AUDIT_ARCH_I386) | ||
31 | return ia32_classify_syscall(syscall); | ||
32 | #endif | ||
33 | switch(syscall) { | ||
34 | case __NR_open: | ||
35 | return 2; | ||
36 | case __NR_openat: | ||
37 | return 3; | ||
38 | case __NR_execve: | ||
39 | return 5; | ||
40 | default: | ||
41 | return 0; | ||
42 | } | ||
43 | } | ||
44 | |||
16 | static int __init audit_classes_init(void) | 45 | static int __init audit_classes_init(void) |
17 | { | 46 | { |
18 | #ifdef CONFIG_IA32_EMULATION | 47 | #ifdef CONFIG_IA32_EMULATION |
19 | extern __u32 ia32_dir_class[]; | 48 | extern __u32 ia32_dir_class[]; |
49 | extern __u32 ia32_write_class[]; | ||
50 | extern __u32 ia32_read_class[]; | ||
20 | extern __u32 ia32_chattr_class[]; | 51 | extern __u32 ia32_chattr_class[]; |
52 | audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class); | ||
53 | audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class); | ||
21 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); | 54 | audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); |
22 | audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); | 55 | audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); |
23 | #endif | 56 | #endif |
57 | audit_register_class(AUDIT_CLASS_WRITE, write_class); | ||
58 | audit_register_class(AUDIT_CLASS_READ, read_class); | ||
24 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); | 59 | audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); |
25 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); | 60 | audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); |
26 | return 0; | 61 | return 0; |