diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-11 00:31:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-11 00:31:58 -0400 |
| commit | c8d6637d0497d62093dbba0694c7b3a80b79bfe1 (patch) | |
| tree | 4ef432511fa6fa959429e1fc961fb186f1745e54 /include/linux | |
| parent | 801a71a858631109a64bf30b1c480b0a18386605 (diff) | |
| parent | 76215b04fd297c008b91ece732ed36e67e0181fa (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:
"This finally applies the stricter sysfs perms checking we pulled out
before last merge window. A few stragglers are fixed (thanks
linux-next!)"
* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
arch/powerpc/platforms/powernv/opal-dump.c: fix world-writable sysfs files
arch/powerpc/platforms/powernv/opal-elog.c: fix world-writable sysfs files
drivers/video/fbdev/s3c2410fb.c: don't make debug world-writable.
ARM: avoid ARM binutils leaking ELF local symbols
scripts: modpost: Remove numeric suffix pattern matching
scripts: modpost: fix compilation warning
sysfs: disallow world-writable files.
module: return bool from within_module*()
module: add within_module() function
modules: Fix build error in moduleloader.h
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kernel.h | 2 | ||||
| -rw-r--r-- | include/linux/module.h | 11 | ||||
| -rw-r--r-- | include/linux/moduleloader.h | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 31ae66f34235..95624bed87ef 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -845,5 +845,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } | |||
| 845 | /* User perms >= group perms >= other perms */ \ | 845 | /* User perms >= group perms >= other perms */ \ |
| 846 | BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \ | 846 | BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \ |
| 847 | BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \ | 847 | BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \ |
| 848 | /* Other writable? Generally considered a bad idea. */ \ | ||
| 849 | BUILD_BUG_ON_ZERO((perms) & 2) + \ | ||
| 848 | (perms)) | 850 | (perms)) |
| 849 | #endif | 851 | #endif |
diff --git a/include/linux/module.h b/include/linux/module.h index f520a767c86c..71f282a4e307 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -396,18 +396,25 @@ bool is_module_address(unsigned long addr); | |||
| 396 | bool is_module_percpu_address(unsigned long addr); | 396 | bool is_module_percpu_address(unsigned long addr); |
| 397 | bool is_module_text_address(unsigned long addr); | 397 | bool is_module_text_address(unsigned long addr); |
| 398 | 398 | ||
| 399 | static inline int within_module_core(unsigned long addr, const struct module *mod) | 399 | static inline bool within_module_core(unsigned long addr, |
| 400 | const struct module *mod) | ||
| 400 | { | 401 | { |
| 401 | return (unsigned long)mod->module_core <= addr && | 402 | return (unsigned long)mod->module_core <= addr && |
| 402 | addr < (unsigned long)mod->module_core + mod->core_size; | 403 | addr < (unsigned long)mod->module_core + mod->core_size; |
| 403 | } | 404 | } |
| 404 | 405 | ||
| 405 | static inline int within_module_init(unsigned long addr, const struct module *mod) | 406 | static inline bool within_module_init(unsigned long addr, |
| 407 | const struct module *mod) | ||
| 406 | { | 408 | { |
| 407 | return (unsigned long)mod->module_init <= addr && | 409 | return (unsigned long)mod->module_init <= addr && |
| 408 | addr < (unsigned long)mod->module_init + mod->init_size; | 410 | addr < (unsigned long)mod->module_init + mod->init_size; |
| 409 | } | 411 | } |
| 410 | 412 | ||
| 413 | static inline bool within_module(unsigned long addr, const struct module *mod) | ||
| 414 | { | ||
| 415 | return within_module_init(addr, mod) || within_module_core(addr, mod); | ||
| 416 | } | ||
| 417 | |||
| 411 | /* Search for module by name: must hold module_mutex. */ | 418 | /* Search for module by name: must hold module_mutex. */ |
| 412 | struct module *find_module(const char *name); | 419 | struct module *find_module(const char *name); |
| 413 | 420 | ||
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h index 560ca53a75fa..7eeb9bbfb816 100644 --- a/include/linux/moduleloader.h +++ b/include/linux/moduleloader.h | |||
| @@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs, | |||
| 45 | unsigned int relsec, | 45 | unsigned int relsec, |
| 46 | struct module *me) | 46 | struct module *me) |
| 47 | { | 47 | { |
| 48 | printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); | 48 | printk(KERN_ERR "module %s: REL relocation unsupported\n", |
| 49 | module_name(me)); | ||
| 49 | return -ENOEXEC; | 50 | return -ENOEXEC; |
| 50 | } | 51 | } |
| 51 | #endif | 52 | #endif |
| @@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs, | |||
| 67 | unsigned int relsec, | 68 | unsigned int relsec, |
| 68 | struct module *me) | 69 | struct module *me) |
| 69 | { | 70 | { |
| 70 | printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); | 71 | printk(KERN_ERR "module %s: REL relocation unsupported\n", |
| 72 | module_name(me)); | ||
| 71 | return -ENOEXEC; | 73 | return -ENOEXEC; |
| 72 | } | 74 | } |
| 73 | #endif | 75 | #endif |
