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*7f13da40SAmy Griffis static unsigned signal_class[] = { 27*7f13da40SAmy Griffis #include <asm-generic/audit_signal.h> 28*7f13da40SAmy Griffis ~0U 29*7f13da40SAmy Griffis }; 30*7f13da40SAmy Griffis 3155669bfaSAl Viro int audit_classify_syscall(int abi, unsigned syscall) 3255669bfaSAl Viro { 3355669bfaSAl Viro #ifdef CONFIG_IA32_SUPPORT 3455669bfaSAl Viro extern int ia32_classify_syscall(unsigned); 3555669bfaSAl Viro if (abi == AUDIT_ARCH_I386) 3655669bfaSAl Viro return ia32_classify_syscall(syscall); 3755669bfaSAl Viro #endif 3855669bfaSAl Viro switch(syscall) { 3955669bfaSAl Viro case __NR_open: 4055669bfaSAl Viro return 2; 4155669bfaSAl Viro case __NR_openat: 4255669bfaSAl Viro return 3; 4355669bfaSAl Viro case __NR_execve: 4455669bfaSAl Viro return 5; 4555669bfaSAl Viro default: 4655669bfaSAl Viro return 0; 4755669bfaSAl Viro } 4855669bfaSAl Viro } 4955669bfaSAl Viro 50b915543bSAl Viro static int __init audit_classes_init(void) 51b915543bSAl Viro { 52b915543bSAl Viro #ifdef CONFIG_IA32_SUPPORT 53b915543bSAl Viro extern __u32 ia32_dir_class[]; 54dc104fb3SAl Viro extern __u32 ia32_write_class[]; 55dc104fb3SAl Viro extern __u32 ia32_read_class[]; 56b915543bSAl Viro extern __u32 ia32_chattr_class[]; 57*7f13da40SAmy Griffis extern __u32 ia32_signal_class[]; 58dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_WRITE_32, ia32_write_class); 59dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_READ_32, ia32_read_class); 60b915543bSAl Viro audit_register_class(AUDIT_CLASS_DIR_WRITE_32, ia32_dir_class); 61b915543bSAl Viro audit_register_class(AUDIT_CLASS_CHATTR_32, ia32_chattr_class); 62*7f13da40SAmy Griffis audit_register_class(AUDIT_CLASS_SIGNAL_32, ia32_signal_class); 63b915543bSAl Viro #endif 64dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_WRITE, write_class); 65dc104fb3SAl Viro audit_register_class(AUDIT_CLASS_READ, read_class); 66b915543bSAl Viro audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); 67b915543bSAl Viro audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); 68*7f13da40SAmy Griffis audit_register_class(AUDIT_CLASS_SIGNAL, signal_class); 69b915543bSAl Viro return 0; 70b915543bSAl Viro } 71b915543bSAl Viro 72b915543bSAl Viro __initcall(audit_classes_init); 73