android_kernel_lge_bullhead/security/selinux
Jeff Vander Stoep 1ccf2d2e84 BACKPORT: selinux: restrict kernel module loading
Backport notes:
Backport uses kernel_module_from_file not kernel_read_file hook.
kernel_read_file replaced kernel_module_from_file in the 4.6 kernel.
There are no inode_security_() helper functions (also introduced in
4.6) so the inode lookup is done using the file_inode() helper which
is standard for kernel version < 4.6.

(Cherry picked from commit 61d612ea731e57dc510472fb746b55cdc017f371)

Utilize existing kernel_read_file hook on kernel module load.
Add module_load permission to the system class.

Enforces restrictions on kernel module origin when calling the
finit_module syscall. The hook checks that source type has
permission module_load for the target type.
Example for finit_module:

allow foo bar_file:system module_load;

Similarly restrictions are enforced on kernel module loading when
calling the init_module syscall. The hook checks that source
type has permission module_load with itself as the target object
because the kernel module is sourced from the calling process.
Example for init_module:

allow foo foo:system module_load;

Bug: 27824855
Change-Id: I64bf3bd1ab2dc735321160642dc6bbfa996f8068
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2019-08-26 17:02:55 +02:00
..
include BACKPORT: selinux: restrict kernel module loading 2019-08-26 17:02:55 +02:00
ss UPSTREAM: selinux: fix bug in conditional rules handling 2019-08-26 17:02:55 +02:00
.gitignore SELinux: add .gitignore files for dynamic classes 2009-10-24 09:42:27 +08:00
Kconfig
Makefile selinux: change to new flag variable 2010-10-21 10:12:40 +11:00
avc.c selinux: Remove unused function avc_sidcmp() 2019-08-26 17:02:48 +02:00
exports.c selinux: sparse fix: include selinux.h in exports.c 2011-09-09 16:56:32 -07:00
hooks.c BACKPORT: selinux: restrict kernel module loading 2019-08-26 17:02:55 +02:00
netif.c selinux: remove unused variabled in the netport, netnode, and netif caches 2019-08-26 17:02:54 +02:00
netlabel.c platform: msm: fix PFT for 64-bit 2014-07-06 13:51:12 +03:00
netlink.c platform: msm: fix PFT for 64-bit 2014-07-06 13:51:12 +03:00
netnode.c selinux: remove unused variabled in the netport, netnode, and netif caches 2019-08-26 17:02:54 +02:00
netport.c selinux: remove unused variabled in the netport, netnode, and netif caches 2019-08-26 17:02:54 +02:00
nlmsgtab.c selinux: nlmsgtab: add SOCK_DESTROY to the netlink mapping tables 2016-02-04 15:23:47 +09:00
selinuxfs.c move d_rcu from overlapping d_child to overlapping d_alias 2015-04-29 10:34:00 +02:00
xfrm.c selinux: look for IPsec labels on both inbound and outbound packets 2014-01-09 12:24:24 -08:00