diff --git a/policy/modules/kernel/files.if b/policy/modules/kernel/files.if index fc007b4d7..99b06d415 100644 --- a/policy/modules/kernel/files.if +++ b/policy/modules/kernel/files.if @@ -4156,6 +4156,25 @@ interface(`files_kernel_modules_filetrans',` filetrans_pattern($1, modules_object_t, $2, $3, $4) ') +######################################## +## +## Load kernel module files. +## +## +## +## Domain allowed access. +## +## +# +interface(`files_load_kernel_modules',` + gen_require(` + type modules_object_t; + ') + + files_read_kernel_modules($1) + allow $1 modules_object_t:system module_load; +') + ######################################## ## ## List world-readable directories. diff --git a/policy/modules/kernel/kernel.te b/policy/modules/kernel/kernel.te index 54b4d4bef..f7522554e 100644 --- a/policy/modules/kernel/kernel.te +++ b/policy/modules/kernel/kernel.te @@ -429,8 +429,12 @@ optional_policy(` if( ! secure_mode_insmod ) { allow can_load_kernmodule self:capability sys_module; + files_load_kernel_modules(can_load_kernmodule) + # load_module() calls stop_machine() which # calls sched_setscheduler() + # gt: there seems to be no trace of the above, at + # least in kernel versions greater than 2.6.37... allow can_load_kernmodule self:capability sys_nice; kernel_setsched(can_load_kernmodule) }