blob: d395c6c9944cf17433aa71f0b3c5fd0747d2e741 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Al Viroc0803792006-08-31 19:02:42 -04002#include <linux/init.h>
3#include <linux/types.h>
4#include <linux/audit.h>
5#include <asm/unistd.h>
Heiko Carstens364c8552007-10-12 16:11:35 +02006#include "audit.h"
Al Viroc0803792006-08-31 19:02:42 -04007
8static unsigned dir_class[] = {
9#include <asm-generic/audit_dir_write.h>
10~0U
11};
12
Al Virodc104fb2006-08-31 19:05:56 -040013static unsigned read_class[] = {
14#include <asm-generic/audit_read.h>
15~0U
16};
17
18static unsigned write_class[] = {
19#include <asm-generic/audit_write.h>
20~0U
21};
22
Al Viroc0803792006-08-31 19:02:42 -040023static unsigned chattr_class[] = {
24#include <asm-generic/audit_change_attr.h>
25~0U
26};
27
Amy Griffis7f13da42007-03-29 18:00:37 -040028static unsigned signal_class[] = {
29#include <asm-generic/audit_signal.h>
30~0U
31};
32
Amy Griffise54dc242007-03-29 18:01:04 -040033int audit_classify_arch(int arch)
34{
35#ifdef CONFIG_COMPAT
36 if (arch == AUDIT_ARCH_S390)
37 return 1;
38#endif
39 return 0;
40}
41
Al Viro55669bf2006-08-31 19:26:40 -040042int audit_classify_syscall(int abi, unsigned syscall)
43{
44#ifdef CONFIG_COMPAT
Al Viro55669bf2006-08-31 19:26:40 -040045 if (abi == AUDIT_ARCH_S390)
46 return s390_classify_syscall(syscall);
47#endif
48 switch(syscall) {
49 case __NR_open:
50 return 2;
51 case __NR_openat:
52 return 3;
53 case __NR_socketcall:
54 return 4;
55 case __NR_execve:
56 return 5;
57 default:
58 return 0;
59 }
60}
61
Al Viroc0803792006-08-31 19:02:42 -040062static int __init audit_classes_init(void)
63{
64#ifdef CONFIG_COMPAT
Al Virodc104fb2006-08-31 19:05:56 -040065 audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class);
66 audit_register_class(AUDIT_CLASS_READ_32, s390_read_class);
Al Viroc0803792006-08-31 19:02:42 -040067 audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class);
68 audit_register_class(AUDIT_CLASS_CHATTR_32, s390_chattr_class);
Amy Griffis7f13da42007-03-29 18:00:37 -040069 audit_register_class(AUDIT_CLASS_SIGNAL_32, s390_signal_class);
Al Viroc0803792006-08-31 19:02:42 -040070#endif
Al Virodc104fb2006-08-31 19:05:56 -040071 audit_register_class(AUDIT_CLASS_WRITE, write_class);
72 audit_register_class(AUDIT_CLASS_READ, read_class);
Al Viroc0803792006-08-31 19:02:42 -040073 audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
74 audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
Amy Griffis7f13da42007-03-29 18:00:37 -040075 audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
Al Viroc0803792006-08-31 19:02:42 -040076 return 0;
77}
78
79__initcall(audit_classes_init);