Back to home page

LXR

 
 

    


0001 #include <linux/init.h>
0002 #include <linux/types.h>
0003 #include <linux/audit.h>
0004 #include <asm/unistd.h>
0005 
0006 static unsigned dir_class[] = {
0007 #include <asm-generic/audit_dir_write.h>
0008 ~0U
0009 };
0010 
0011 static unsigned read_class[] = {
0012 #include <asm-generic/audit_read.h>
0013 ~0U
0014 };
0015 
0016 static unsigned write_class[] = {
0017 #include <asm-generic/audit_write.h>
0018 ~0U
0019 };
0020 
0021 static unsigned chattr_class[] = {
0022 #include <asm-generic/audit_change_attr.h>
0023 ~0U
0024 };
0025 
0026 static unsigned signal_class[] = {
0027 #include <asm-generic/audit_signal.h>
0028 ~0U
0029 };
0030 
0031 int audit_classify_arch(int arch)
0032 {
0033     if (audit_is_compat(arch))
0034         return 1;
0035     else
0036         return 0;
0037 }
0038 
0039 int audit_classify_syscall(int abi, unsigned syscall)
0040 {
0041     if (audit_is_compat(abi))
0042         return audit_classify_compat_syscall(abi, syscall);
0043 
0044     switch(syscall) {
0045 #ifdef __NR_open
0046     case __NR_open:
0047         return 2;
0048 #endif
0049 #ifdef __NR_openat
0050     case __NR_openat:
0051         return 3;
0052 #endif
0053 #ifdef __NR_socketcall
0054     case __NR_socketcall:
0055         return 4;
0056 #endif
0057 #ifdef __NR_execveat
0058     case __NR_execveat:
0059 #endif
0060     case __NR_execve:
0061         return 5;
0062     default:
0063         return 0;
0064     }
0065 }
0066 
0067 static int __init audit_classes_init(void)
0068 {
0069 #ifdef CONFIG_AUDIT_COMPAT_GENERIC
0070     audit_register_class(AUDIT_CLASS_WRITE_32, compat_write_class);
0071     audit_register_class(AUDIT_CLASS_READ_32, compat_read_class);
0072     audit_register_class(AUDIT_CLASS_DIR_WRITE_32, compat_dir_class);
0073     audit_register_class(AUDIT_CLASS_CHATTR_32, compat_chattr_class);
0074     audit_register_class(AUDIT_CLASS_SIGNAL_32, compat_signal_class);
0075 #endif
0076     audit_register_class(AUDIT_CLASS_WRITE, write_class);
0077     audit_register_class(AUDIT_CLASS_READ, read_class);
0078     audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
0079     audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
0080     audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
0081     return 0;
0082 }
0083 
0084 __initcall(audit_classes_init);