diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-11 19:09:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-11 19:09:14 -0400 |
commit | 4251c2a67011801caecd63671f26dd8c9aedb24c (patch) | |
tree | 06f659cb3f9e91fb2b8fc92791b5e021754e025e /kernel/module.c | |
parent | c31c24b8251fd44962a9b0bf82c770653bf07f6e (diff) | |
parent | 4982223e51e8ea9d09bb33c8323b5ec1877b2b51 (diff) |
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module updates from Rusty Russell:
"Most of this is cleaning up various driver sysfs permissions so we can
re-add the perm check (we unified the module param and sysfs checks,
but the module ones were stronger so we weakened them temporarily).
Param parsing gets documented, and also "--" now forces args to be
handed to init (and ignored by the kernel).
Module NX/RO protections get tightened: we now set them before calling
parse_args()"
* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
module: set nx before marking module MODULE_STATE_COMING.
samples/kobject/: avoid world-writable sysfs files.
drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.
drivers/staging/speakup/: avoid world-writable sysfs files.
drivers/regulator/virtual: avoid world-writable sysfs files.
drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.
drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.
drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.
drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.
speakup: fix incorrect perms on speakup_acntsa.c
cpumask.h: silence warning with -Wsign-compare
Documentation: Update kernel-parameters.tx
param: hand arguments after -- straight to init
modpost: Fix resource leak in read_dump()
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/kernel/module.c b/kernel/module.c index 079c4615607d..81e727cf6df9 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -3020,21 +3020,6 @@ static int do_init_module(struct module *mod) | |||
3020 | */ | 3020 | */ |
3021 | current->flags &= ~PF_USED_ASYNC; | 3021 | current->flags &= ~PF_USED_ASYNC; |
3022 | 3022 | ||
3023 | blocking_notifier_call_chain(&module_notify_list, | ||
3024 | MODULE_STATE_COMING, mod); | ||
3025 | |||
3026 | /* Set RO and NX regions for core */ | ||
3027 | set_section_ro_nx(mod->module_core, | ||
3028 | mod->core_text_size, | ||
3029 | mod->core_ro_size, | ||
3030 | mod->core_size); | ||
3031 | |||
3032 | /* Set RO and NX regions for init */ | ||
3033 | set_section_ro_nx(mod->module_init, | ||
3034 | mod->init_text_size, | ||
3035 | mod->init_ro_size, | ||
3036 | mod->init_size); | ||
3037 | |||
3038 | do_mod_ctors(mod); | 3023 | do_mod_ctors(mod); |
3039 | /* Start the module */ | 3024 | /* Start the module */ |
3040 | if (mod->init != NULL) | 3025 | if (mod->init != NULL) |
@@ -3165,9 +3150,26 @@ static int complete_formation(struct module *mod, struct load_info *info) | |||
3165 | /* This relies on module_mutex for list integrity. */ | 3150 | /* This relies on module_mutex for list integrity. */ |
3166 | module_bug_finalize(info->hdr, info->sechdrs, mod); | 3151 | module_bug_finalize(info->hdr, info->sechdrs, mod); |
3167 | 3152 | ||
3153 | /* Set RO and NX regions for core */ | ||
3154 | set_section_ro_nx(mod->module_core, | ||
3155 | mod->core_text_size, | ||
3156 | mod->core_ro_size, | ||
3157 | mod->core_size); | ||
3158 | |||
3159 | /* Set RO and NX regions for init */ | ||
3160 | set_section_ro_nx(mod->module_init, | ||
3161 | mod->init_text_size, | ||
3162 | mod->init_ro_size, | ||
3163 | mod->init_size); | ||
3164 | |||
3168 | /* Mark state as coming so strong_try_module_get() ignores us, | 3165 | /* Mark state as coming so strong_try_module_get() ignores us, |
3169 | * but kallsyms etc. can see us. */ | 3166 | * but kallsyms etc. can see us. */ |
3170 | mod->state = MODULE_STATE_COMING; | 3167 | mod->state = MODULE_STATE_COMING; |
3168 | mutex_unlock(&module_mutex); | ||
3169 | |||
3170 | blocking_notifier_call_chain(&module_notify_list, | ||
3171 | MODULE_STATE_COMING, mod); | ||
3172 | return 0; | ||
3171 | 3173 | ||
3172 | out: | 3174 | out: |
3173 | mutex_unlock(&module_mutex); | 3175 | mutex_unlock(&module_mutex); |
@@ -3190,6 +3192,7 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3190 | { | 3192 | { |
3191 | struct module *mod; | 3193 | struct module *mod; |
3192 | long err; | 3194 | long err; |
3195 | char *after_dashes; | ||
3193 | 3196 | ||
3194 | err = module_sig_check(info); | 3197 | err = module_sig_check(info); |
3195 | if (err) | 3198 | if (err) |
@@ -3277,10 +3280,15 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3277 | goto ddebug_cleanup; | 3280 | goto ddebug_cleanup; |
3278 | 3281 | ||
3279 | /* Module is ready to execute: parsing args may do that. */ | 3282 | /* Module is ready to execute: parsing args may do that. */ |
3280 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, | 3283 | after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
3281 | -32768, 32767, unknown_module_param_cb); | 3284 | -32768, 32767, unknown_module_param_cb); |
3282 | if (err < 0) | 3285 | if (IS_ERR(after_dashes)) { |
3286 | err = PTR_ERR(after_dashes); | ||
3283 | goto bug_cleanup; | 3287 | goto bug_cleanup; |
3288 | } else if (after_dashes) { | ||
3289 | pr_warn("%s: parameters '%s' after `--' ignored\n", | ||
3290 | mod->name, after_dashes); | ||
3291 | } | ||
3284 | 3292 | ||
3285 | /* Link in to syfs. */ | 3293 | /* Link in to syfs. */ |
3286 | err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); | 3294 | err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); |