aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorJames Morris <james.morris@microsoft.com>2018-06-25 09:20:40 -0700
committerJames Morris <james.morris@microsoft.com>2018-06-25 09:20:40 -0700
commit57b54d74dd5c559bd35f2affaf11d8828aaf5733 (patch)
tree025d99f0d6b298fbdbf3ce942ec7868131444090 /kernel/module.c
parentMAINTAINERS: remove the outdated "LINUX SECURITY MODULE (LSM) FRAMEWORK" entry (diff)
parentLinux 4.18-rc2 (diff)
downloadlinux-rng-57b54d74dd5c559bd35f2affaf11d8828aaf5733.tar.xz
linux-rng-57b54d74dd5c559bd35f2affaf11d8828aaf5733.zip
Merge tag 'v4.18-rc2' into next-general
Merge to Linux 4.18-rc2 for security subsystem developers.
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/module.c b/kernel/module.c
index ce8066b88178..f475f30eed8c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -274,9 +274,7 @@ static void module_assert_mutex_or_preempt(void)
}
static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
-#ifndef CONFIG_MODULE_SIG_FORCE
module_param(sig_enforce, bool_enable_only, 0644);
-#endif /* !CONFIG_MODULE_SIG_FORCE */
/*
* Export sig_enforce kernel cmdline parameter to allow other subsystems rely
@@ -1604,8 +1602,7 @@ static void add_notes_attrs(struct module *mod, const struct load_info *info)
if (notes == 0)
return;
- notes_attrs = kzalloc(sizeof(*notes_attrs)
- + notes * sizeof(notes_attrs->attrs[0]),
+ notes_attrs = kzalloc(struct_size(notes_attrs, attrs, notes),
GFP_KERNEL);
if (notes_attrs == NULL)
return;
@@ -2786,7 +2783,7 @@ static int module_sig_check(struct load_info *info, int flags)
}
/* Not having a signature is only an error if we're strict. */
- if (err == -ENOKEY && !sig_enforce)
+ if (err == -ENOKEY && !is_module_sig_enforced())
err = 0;
return err;
@@ -3517,6 +3514,11 @@ static noinline int do_init_module(struct module *mod)
* walking this with preempt disabled. In all the failure paths, we
* call synchronize_sched(), but we don't want to slow down the success
* path, so use actual RCU here.
+ * Note that module_alloc() on most architectures creates W+X page
+ * mappings which won't be cleaned up until do_free_init() runs. Any
+ * code such as mark_rodata_ro() which depends on those mappings to
+ * be cleaned up needs to sync with the queued work - ie
+ * rcu_barrier_sched()
*/
call_rcu_sched(&freeinit->rcu, do_free_init);
mutex_unlock(&module_mutex);