summaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2018-07-13 14:06:02 -0400
committerJames Morris <james.morris@microsoft.com>2018-07-16 15:31:57 -0400
commitc77b8cdf745d91eca138e7bfa430dc6640b604a0 (patch)
treef1cc1edc3cecbff32a4450d252b551f5260ee9e1 /security/selinux/hooks.c
parentef96837b0de4af47732e2a8ebf5c18e8a885ded6 (diff)
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 <zohar@linux.vnet.ibm.com> Cc: Jeff Vander Stoep <jeffv@google.com> Cc: Casey Schaufler <casey@schaufler-ca.com> Cc: Kees Cook <keescook@chromium.org> Acked-by: Jessica Yu <jeyu@kernel.org> Acked-by: Paul Moore <paul@paul-moore.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: James Morris <james.morris@microsoft.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2b5ee5fbd652..a8bf324130f5 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4073,6 +4073,20 @@ static int selinux_kernel_read_file(struct file *file,
4073 return rc; 4073 return rc;
4074} 4074}
4075 4075
4076static int selinux_kernel_load_data(enum kernel_load_data_id id)
4077{
4078 int rc = 0;
4079
4080 switch (id) {
4081 case LOADING_MODULE:
4082 rc = selinux_kernel_module_from_file(NULL);
4083 default:
4084 break;
4085 }
4086
4087 return rc;
4088}
4089
4076static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) 4090static int selinux_task_setpgid(struct task_struct *p, pid_t pgid)
4077{ 4091{
4078 return avc_has_perm(&selinux_state, 4092 return avc_has_perm(&selinux_state,
@@ -6972,6 +6986,7 @@ static struct security_hook_list selinux_hooks[] __lsm_ro_after_init = {
6972 LSM_HOOK_INIT(kernel_act_as, selinux_kernel_act_as), 6986 LSM_HOOK_INIT(kernel_act_as, selinux_kernel_act_as),
6973 LSM_HOOK_INIT(kernel_create_files_as, selinux_kernel_create_files_as), 6987 LSM_HOOK_INIT(kernel_create_files_as, selinux_kernel_create_files_as),
6974 LSM_HOOK_INIT(kernel_module_request, selinux_kernel_module_request), 6988 LSM_HOOK_INIT(kernel_module_request, selinux_kernel_module_request),
6989 LSM_HOOK_INIT(kernel_load_data, selinux_kernel_load_data),
6975 LSM_HOOK_INIT(kernel_read_file, selinux_kernel_read_file), 6990 LSM_HOOK_INIT(kernel_read_file, selinux_kernel_read_file),
6976 LSM_HOOK_INIT(task_setpgid, selinux_task_setpgid), 6991 LSM_HOOK_INIT(task_setpgid, selinux_task_setpgid),
6977 LSM_HOOK_INIT(task_getpgid, selinux_task_getpgid), 6992 LSM_HOOK_INIT(task_getpgid, selinux_task_getpgid),