mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
module: replace the existing LSM hook in init_module
Both the init_module and finit_module syscalls call either directly or indirectly the security_kernel_read_file LSM hook. This patch replaces the direct call in init_module with a call to the new security_kernel_load_data hook and makes the corresponding changes in SELinux, LoadPin, and IMA. Signed-off-by: Mimi Zohar <[email protected]> Cc: Jeff Vander Stoep <[email protected]> Cc: Casey Schaufler <[email protected]> Cc: Kees Cook <[email protected]> Acked-by: Jessica Yu <[email protected]> Acked-by: Paul Moore <[email protected]> Acked-by: Kees Cook <[email protected]> Signed-off-by: James Morris <[email protected]>
This commit is contained in:
parent
ef96837b0d
commit
c77b8cdf74
4 changed files with 32 additions and 14 deletions
|
|
@ -4073,6 +4073,20 @@ static int selinux_kernel_read_file(struct file *file,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int selinux_kernel_load_data(enum kernel_load_data_id id)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
switch (id) {
|
||||
case LOADING_MODULE:
|
||||
rc = selinux_kernel_module_from_file(NULL);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int selinux_task_setpgid(struct task_struct *p, pid_t pgid)
|
||||
{
|
||||
return avc_has_perm(&selinux_state,
|
||||
|
|
@ -6972,6 +6986,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = {
|
|||
LSM_HOOK_INIT(kernel_act_as, selinux_kernel_act_as),
|
||||
LSM_HOOK_INIT(kernel_create_files_as, selinux_kernel_create_files_as),
|
||||
LSM_HOOK_INIT(kernel_module_request, selinux_kernel_module_request),
|
||||
LSM_HOOK_INIT(kernel_load_data, selinux_kernel_load_data),
|
||||
LSM_HOOK_INIT(kernel_read_file, selinux_kernel_read_file),
|
||||
LSM_HOOK_INIT(task_setpgid, selinux_task_setpgid),
|
||||
LSM_HOOK_INIT(task_getpgid, selinux_task_getpgid),
|
||||
|
|
|
|||
Loading…
Reference in a new issue