summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-10 21:31:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-10 21:31:58 -0700
commitc8d6637d0497d62093dbba0694c7b3a80b79bfe1 (patch)
tree4ef432511fa6fa959429e1fc961fb186f1745e54 /scripts
parent801a71a858631109a64bf30b1c480b0a18386605 (diff)
parent76215b04fd297c008b91ece732ed36e67e0181fa (diff)
downloadlinux-c8d6637d0497d62093dbba0694c7b3a80b79bfe1.tar.bz2
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 'scripts')
-rw-r--r--scripts/mod/modpost.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 9d9c5b905b35..091d90573b63 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -772,32 +772,10 @@ static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr)
sechdr->sh_name;
}
-/* if sym is empty or point to a string
- * like ".[0-9]+" then return 1.
- * This is the optional prefix added by ld to some sections
- */
-static int number_prefix(const char *sym)
-{
- if (*sym++ == '\0')
- return 1;
- if (*sym != '.')
- return 0;
- do {
- char c = *sym++;
- if (c < '0' || c > '9')
- return 0;
- } while (*sym);
- return 1;
-}
-
/* The pattern is an array of simple patterns.
* "foo" will match an exact string equal to "foo"
* "*foo" will match a string that ends with "foo"
* "foo*" will match a string that begins with "foo"
- * "foo$" will match a string equal to "foo" or "foo.1"
- * where the '1' can be any number including several digits.
- * The $ syntax is for sections where ld append a dot number
- * to make section name unique.
*/
static int match(const char *sym, const char * const pat[])
{
@@ -816,13 +794,6 @@ static int match(const char *sym, const char * const pat[])
if (strncmp(sym, p, strlen(p) - 1) == 0)
return 1;
}
- /* "foo$" */
- else if (*endp == '$') {
- if (strncmp(sym, p, strlen(p) - 1) == 0) {
- if (number_prefix(sym + strlen(p) - 1))
- return 1;
- }
- }
/* no wildcards */
else {
if (strcmp(p, sym) == 0)
@@ -880,20 +851,20 @@ static void check_section(const char *modname, struct elf_info *elf,
#define ALL_INIT_DATA_SECTIONS \
- ".init.setup$", ".init.rodata$", ".meminit.rodata$", \
- ".init.data$", ".meminit.data$"
+ ".init.setup", ".init.rodata", ".meminit.rodata", \
+ ".init.data", ".meminit.data"
#define ALL_EXIT_DATA_SECTIONS \
- ".exit.data$", ".memexit.data$"
+ ".exit.data", ".memexit.data"
#define ALL_INIT_TEXT_SECTIONS \
- ".init.text$", ".meminit.text$"
+ ".init.text", ".meminit.text"
#define ALL_EXIT_TEXT_SECTIONS \
- ".exit.text$", ".memexit.text$"
+ ".exit.text", ".memexit.text"
#define ALL_PCI_INIT_SECTIONS \
- ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \
- ".pci_fixup_enable$", ".pci_fixup_resume$", \
- ".pci_fixup_resume_early$", ".pci_fixup_suspend$"
+ ".pci_fixup_early", ".pci_fixup_header", ".pci_fixup_final", \
+ ".pci_fixup_enable", ".pci_fixup_resume", \
+ ".pci_fixup_resume_early", ".pci_fixup_suspend"
#define ALL_XXXINIT_SECTIONS MEM_INIT_SECTIONS
#define ALL_XXXEXIT_SECTIONS MEM_EXIT_SECTIONS
@@ -901,8 +872,8 @@ static void check_section(const char *modname, struct elf_info *elf,
#define ALL_INIT_SECTIONS INIT_SECTIONS, ALL_XXXINIT_SECTIONS
#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS
-#define DATA_SECTIONS ".data$", ".data.rel$"
-#define TEXT_SECTIONS ".text$", ".text.unlikely$"
+#define DATA_SECTIONS ".data", ".data.rel"
+#define TEXT_SECTIONS ".text", ".text.unlikely"
#define INIT_SECTIONS ".init.*"
#define MEM_INIT_SECTIONS ".meminit.*"
@@ -1703,12 +1674,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
static char *remove_dot(char *s)
{
- char *end;
- int n = strcspn(s, ".");
+ size_t n = strcspn(s, ".");
- if (n > 0 && s[n] != 0) {
- strtoul(s + n + 1, &end, 10);
- if (end > s + n + 1 && (*end == '.' || *end == 0))
+ if (n && s[n]) {
+ size_t m = strspn(s + n + 1, "0123456789");
+ if (m && (s[n + m] == '.' || s[n + m] == 0))
s[n] = 0;
}
return s;