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