aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-11 14:43:17 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-11 14:43:17 -0400
commit05ff0e291af086f4325bac76abad250690bbbd63 (patch)
tree3ea47e8ef5bebc1261302e3d0775414fb78037c4 /arch
parent5eea7ee2075b245d505285bb422e2fa8d686e5c8 (diff)
parent55669bfa141b488be865341ed12e188967d11308 (diff)
Merge branch 'audit.b28' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current
* 'audit.b28' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current: [PATCH] audit: AUDIT_PERM support [PATCH] audit: more syscall classes added [PATCH] syscall classes hookup for ppc and s390 [PATCH] update audit rule change messages [PATCH] sanity check audit_buffer [PATCH] fix ppid bug in 2.6.18 kernel
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/audit.c28
-rw-r--r--arch/ia64/ia32/audit.c26
-rw-r--r--arch/ia64/kernel/audit.c35
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/audit.c66
-rw-r--r--arch/powerpc/kernel/compat_audit.c38
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/audit.c66
-rw-r--r--arch/s390/kernel/compat_audit.c38
-rw-r--r--arch/x86_64/ia32/audit.c26
-rw-r--r--arch/x86_64/kernel/audit.c35
11 files changed, 363 insertions, 1 deletions
diff --git a/arch/i386/kernel/audit.c b/arch/i386/kernel/audit.c
index 5a53c6f371ff..3b97cff41549 100644
--- a/arch/i386/kernel/audit.c
+++ b/arch/i386/kernel/audit.c
@@ -8,13 +8,41 @@ static unsigned dir_class[] = {
8~0U 8~0U
9}; 9};
10 10
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
11static unsigned chattr_class[] = { 21static 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
26int audit_classify_syscall(int abi, unsigned syscall)
27{
28 switch(syscall) {
29 case __NR_open:
30 return 2;
31 case __NR_openat:
32 return 3;
33 case __NR_socketcall:
34 return 4;
35 case __NR_execve:
36 return 5;
37 default:
38 return 0;
39 }
40}
41
16static int __init audit_classes_init(void) 42static int __init audit_classes_init(void)
17{ 43{
44 audit_register_class(AUDIT_CLASS_WRITE, write_class);
45 audit_register_class(AUDIT_CLASS_READ, read_class);
18 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); 46 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
19 audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); 47 audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
20 return 0; 48 return 0;
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
13unsigned ia32_write_class[] = {
14#include <asm-generic/audit_write.h>
15~0U
16};
17
18unsigned ia32_read_class[] = {
19#include <asm-generic/audit_read.h>
20~0U
21};
22
23int 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
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
11static unsigned chattr_class[] = { 21static 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
26int 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
16static int __init audit_classes_init(void) 45static 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/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)
70kexec-$(CONFIG_PPC64) := machine_kexec_64.o 70kexec-$(CONFIG_PPC64) := machine_kexec_64.o
71kexec-$(CONFIG_PPC32) := machine_kexec_32.o 71kexec-$(CONFIG_PPC32) := machine_kexec_32.o
72obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y) 72obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o $(kexec-y)
73obj-$(CONFIG_AUDIT) += audit.o
74obj64-$(CONFIG_AUDIT) += compat_audit.o
73 75
74ifeq ($(CONFIG_PPC_ISERIES),y) 76ifeq ($(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
6static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h>
8~0U
9};
10
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
21static unsigned chattr_class[] = {
22#include <asm-generic/audit_change_attr.h>
23~0U
24};
25
26int 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
47static 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
4unsigned ppc32_dir_class[] = {
5#include <asm-generic/audit_dir_write.h>
6~0U
7};
8
9unsigned ppc32_chattr_class[] = {
10#include <asm-generic/audit_change_attr.h>
11~0U
12};
13
14unsigned ppc32_write_class[] = {
15#include <asm-generic/audit_write.h>
16~0U
17};
18
19unsigned ppc32_read_class[] = {
20#include <asm-generic/audit_read.h>
21~0U
22};
23
24int 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/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
16obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 16obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
17obj-$(CONFIG_SMP) += smp.o 17obj-$(CONFIG_SMP) += smp.o
18 18
19obj-$(CONFIG_AUDIT) += audit.o
20compat-obj-$(CONFIG_AUDIT) += compat_audit.o
19obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ 21obj-$(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
23obj-$(CONFIG_VIRT_TIMER) += vtime.o 25obj-$(CONFIG_VIRT_TIMER) += vtime.o
24obj-$(CONFIG_STACKTRACE) += stacktrace.o 26obj-$(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
6static unsigned dir_class[] = {
7#include <asm-generic/audit_dir_write.h>
8~0U
9};
10
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
21static unsigned chattr_class[] = {
22#include <asm-generic/audit_change_attr.h>
23~0U
24};
25
26int 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
47static 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
4unsigned s390_dir_class[] = {
5#include <asm-generic/audit_dir_write.h>
6~0U
7};
8
9unsigned s390_chattr_class[] = {
10#include <asm-generic/audit_change_attr.h>
11~0U
12};
13
14unsigned s390_write_class[] = {
15#include <asm-generic/audit_write.h>
16~0U
17};
18
19unsigned s390_read_class[] = {
20#include <asm-generic/audit_read.h>
21~0U
22};
23
24int 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/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
13unsigned ia32_write_class[] = {
14#include <asm-generic/audit_write.h>
15~0U
16};
17
18unsigned ia32_read_class[] = {
19#include <asm-generic/audit_read.h>
20~0U
21};
22
23int 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
11static unsigned read_class[] = {
12#include <asm-generic/audit_read.h>
13~0U
14};
15
16static unsigned write_class[] = {
17#include <asm-generic/audit_write.h>
18~0U
19};
20
11static unsigned chattr_class[] = { 21static 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
26int 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
16static int __init audit_classes_init(void) 45static 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;