Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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