1b915543bSAl Viro #include <linux/init.h> 2b915543bSAl Viro #include <linux/types.h> 3b915543bSAl Viro #include <linux/audit.h> 4b915543bSAl Viro #include <asm/unistd.h> 5b915543bSAl Viro 6b915543bSAl Viro static unsigned dir_class[] = { 7b915543bSAl Viro #include <asm-generic/audit_dir_write.h> 8b915543bSAl Viro ~0U 9b915543bSAl Viro }; 10b915543bSAl Viro 11dc104fb3SAl Viro static unsigned read_class[] = { 12dc104fb3SAl Viro #include <asm-generic/audit_read.h> 13dc104fb3SAl Viro ~0U 14dc104fb3SAl Viro }; 15dc104fb3SAl Viro 16dc104fb3SAl Viro static unsigned write_class[] = { 17dc104fb3SAl Viro #include <asm-generic/audit_write.h> 18dc104fb3SAl Viro ~0U 19dc104fb3SAl Viro }; 20dc104fb3SAl Viro 21b915543bSAl Viro static unsigned chattr_class[] = { 22b915543bSAl Viro #include <asm-generic/audit_change_attr.h> 23b915543bSAl Viro ~0U 24b915543bSAl Viro }; 25b915543bSAl Viro 26*55669bfaSAl Viro int audit_classify_syscall(int abi, unsigned syscall) 27*55669bfaSAl Viro { 28*55669bfaSAl Viro #ifdef CONFIG_IA32_SUPPORT 29*55669bfaSAl Viro extern int ia32_classify_syscall(unsigned); 30*55669bfaSAl Viro if (abi == AUDIT_ARCH_I386) 31*55669bfaSAl Viro return ia32_classify_syscall(syscall); 32*55669bfaSAl Viro #endif 33*55669bfaSAl Viro switch(syscall) { 34*55669bfaSAl Viro case __NR_open: 35*55669bfaSAl Viro return 2; 36*55669bfaSAl Viro case __NR_openat: 37*55669bfaSAl Viro return 3; 38*55669bfaSAl Viro case __NR_execve: 39*55669bfaSAl Viro return 5; 40*55669bfaSAl Viro default: 41*55669bfaSAl Viro return 0; 42*55669bfaSAl Viro } 43*55669bfaSAl Viro } 44*55669bfaSAl Viro 45b915543bSAl Viro static int __init audit_classes_init(void) 46b915543bSAl Viro { 47b915543bSAl Viro #ifdef CONFIG_IA32_SUPPORT 48b915543bSAl Viro extern __u32 ia32_dir_class[]; 49dc104fb3SAl Viro extern __u32 ia32_write_class[]; 50dc104fb3SAl Viro extern __u32 ia32_read_class[]; 51b915543bSAl Viro extern __u32 ia32_chattr_class[]; 52dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class); 53dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class); 54b915543bSAl Viro audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); 55b915543bSAl Viro audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); 56b915543bSAl Viro #endif 57dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_WRITE, write_class); 58dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_READ, read_class); 59b915543bSAl Viro audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); 60b915543bSAl Viro audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); 61b915543bSAl Viro return 0; 62b915543bSAl Viro } 63b915543bSAl Viro 64b915543bSAl Viro __initcall(audit_classes_init); 65