1*e65e1fc2SAl Viro #include <linux/init.h> 2*e65e1fc2SAl Viro #include <linux/types.h> 3*e65e1fc2SAl Viro #include <linux/audit.h> 4*e65e1fc2SAl Viro #include <asm/unistd.h> 5*e65e1fc2SAl Viro 6*e65e1fc2SAl Viro static unsigned dir_class[] = { 7*e65e1fc2SAl Viro #include <asm-generic/audit_dir_write.h> 8*e65e1fc2SAl Viro ~0U 9*e65e1fc2SAl Viro }; 10*e65e1fc2SAl Viro 11*e65e1fc2SAl Viro static unsigned read_class[] = { 12*e65e1fc2SAl Viro #include <asm-generic/audit_read.h> 13*e65e1fc2SAl Viro ~0U 14*e65e1fc2SAl Viro }; 15*e65e1fc2SAl Viro 16*e65e1fc2SAl Viro static unsigned write_class[] = { 17*e65e1fc2SAl Viro #include <asm-generic/audit_write.h> 18*e65e1fc2SAl Viro ~0U 19*e65e1fc2SAl Viro }; 20*e65e1fc2SAl Viro 21*e65e1fc2SAl Viro static unsigned chattr_class[] = { 22*e65e1fc2SAl Viro #include <asm-generic/audit_change_attr.h> 23*e65e1fc2SAl Viro ~0U 24*e65e1fc2SAl Viro }; 25*e65e1fc2SAl Viro 26*e65e1fc2SAl Viro int audit_classify_syscall(int abi, unsigned syscall) 27*e65e1fc2SAl Viro { 28*e65e1fc2SAl Viro switch(syscall) { 29*e65e1fc2SAl Viro case __NR_open: 30*e65e1fc2SAl Viro return 2; 31*e65e1fc2SAl Viro case __NR_openat: 32*e65e1fc2SAl Viro return 3; 33*e65e1fc2SAl Viro #ifdef __NR_socketcall 34*e65e1fc2SAl Viro case __NR_socketcall: 35*e65e1fc2SAl Viro return 4; 36*e65e1fc2SAl Viro #endif 37*e65e1fc2SAl Viro case __NR_execve: 38*e65e1fc2SAl Viro return 5; 39*e65e1fc2SAl Viro default: 40*e65e1fc2SAl Viro return 0; 41*e65e1fc2SAl Viro } 42*e65e1fc2SAl Viro } 43*e65e1fc2SAl Viro 44*e65e1fc2SAl Viro static int __init audit_classes_init(void) 45*e65e1fc2SAl Viro { 46*e65e1fc2SAl Viro audit_register_class(AUDIT_CLASS_WRITE, write_class); 47*e65e1fc2SAl Viro audit_register_class(AUDIT_CLASS_READ, read_class); 48*e65e1fc2SAl Viro audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); 49*e65e1fc2SAl Viro audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); 50*e65e1fc2SAl Viro return 0; 51*e65e1fc2SAl Viro } 52*e65e1fc2SAl Viro 53*e65e1fc2SAl Viro __initcall(audit_classes_init); 54