Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Nov 2015 23:53:39 +0000 (15:53 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 9 Nov 2015 23:53:39 +0000 (15:53 -0800)
Pull module updates from Rusty Russell:
 "Nothing exciting, minor tweaks and cleanups"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  scripts: [modpost] add new sections to white list
  modpost: Add flag -E for making section mismatches fatal
  params: don't ignore the rest of cmdline if parse_one() fails
  modpost: abort if a module symbol is too long

kernel/params.c
lib/Kconfig.debug
scripts/Makefile.modpost
scripts/mod/modpost.c

index 93a380a2345d71ae8c884a56006977eec959cbf8..a6d6149c0fe60df1ca38d9a66acef281b78ee79d 100644 (file)
@@ -223,7 +223,7 @@ char *parse_args(const char *doing,
                 int (*unknown)(char *param, char *val,
                                const char *doing, void *arg))
 {
-       char *param, *val;
+       char *param, *val, *err = NULL;
 
        /* Chew leading spaces */
        args = skip_spaces(args);
@@ -238,7 +238,7 @@ char *parse_args(const char *doing,
                args = next_arg(args, &param, &val);
                /* Stop at -- */
                if (!val && strcmp(param, "--") == 0)
-                       return args;
+                       return err ?: args;
                irq_was_disabled = irqs_disabled();
                ret = parse_one(param, val, doing, params, num,
                                min_level, max_level, arg, unknown);
@@ -247,24 +247,25 @@ char *parse_args(const char *doing,
                                doing, param);
 
                switch (ret) {
+               case 0:
+                       continue;
                case -ENOENT:
                        pr_err("%s: Unknown parameter `%s'\n", doing, param);
-                       return ERR_PTR(ret);
+                       break;
                case -ENOSPC:
                        pr_err("%s: `%s' too large for parameter `%s'\n",
                               doing, val ?: "", param);
-                       return ERR_PTR(ret);
-               case 0:
                        break;
                default:
                        pr_err("%s: `%s' invalid for parameter `%s'\n",
                               doing, val ?: "", param);
-                       return ERR_PTR(ret);
+                       break;
                }
+
+               err = ERR_PTR(ret);
        }
 
-       /* All parsed OK. */
-       return NULL;
+       return err;
 }
 
 /* Lazy bastard, eh? */
index 16bf3bc25e3ed8df252cf3795d895be4d0f2247f..8c15b29d5adc64214880cf7c066fb83349f612aa 100644 (file)
@@ -312,6 +312,15 @@ config DEBUG_SECTION_MISMATCH
          - Enable verbose reporting from modpost in order to help resolve
            the section mismatches that are reported.
 
+config SECTION_MISMATCH_WARN_ONLY
+       bool "Make section mismatch errors non-fatal"
+       default y
+       help
+         If you say N here, the build process will fail if there are any
+         section mismatch, instead of just throwing warnings.
+
+         If unsure, say Y.
+
 #
 # Select this config option from the architecture Kconfig, if it
 # is preferred to always offer frame pointers as a config
index 69f0a1417e9a47669f5568af2097f031c247e607..1366a94b6c39565f094f2907e61a21464e0897fe 100644 (file)
@@ -77,6 +77,7 @@ modpost = scripts/mod/modpost                    \
  $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
+ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E)  \
  $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
 MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
index 12d3db3bd46b491542090cd2db01637754467e99..e080746e1a6b528a218b416b5344368cd6db7065 100644 (file)
@@ -38,6 +38,7 @@ static int warn_unresolved = 0;
 /* How a symbol is exported */
 static int sec_mismatch_count = 0;
 static int sec_mismatch_verbose = 1;
+static int sec_mismatch_fatal = 0;
 /* ignore missing files */
 static int ignore_missing_files;
 
@@ -833,6 +834,8 @@ static const char *const section_white_list[] =
        ".xt.lit",         /* xtensa */
        ".arcextmap*",                  /* arc */
        ".gnu.linkonce.arcext*",        /* arc : modules */
+       ".cmem*",                       /* EZchip */
+       ".fmt_slot*",                   /* EZchip */
        ".gnu.lto*",
        NULL
 };
@@ -2133,6 +2136,11 @@ static void add_staging_flag(struct buffer *b, const char *name)
                buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
 }
 
+/* In kernel, this size is defined in linux/module.h;
+ * here we use Elf_Addr instead of long for covering cross-compile
+ */
+#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
+
 /**
  * Record CRCs for unresolved symbols
  **/
@@ -2177,6 +2185,12 @@ static int add_versions(struct buffer *b, struct module *mod)
                                s->name, mod->name);
                        continue;
                }
+               if (strlen(s->name) >= MODULE_NAME_LEN) {
+                       merror("too long symbol \"%s\" [%s.ko]\n",
+                              s->name, mod->name);
+                       err = 1;
+                       break;
+               }
                buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
                           s->crc, s->name);
        }
@@ -2374,7 +2388,7 @@ int main(int argc, char **argv)
        struct ext_sym_list *extsym_iter;
        struct ext_sym_list *extsym_start = NULL;
 
-       while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) {
+       while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
                switch (opt) {
                case 'i':
                        kernel_read = optarg;
@@ -2415,6 +2429,9 @@ int main(int argc, char **argv)
                case 'w':
                        warn_unresolved = 1;
                        break;
+               case 'E':
+                       sec_mismatch_fatal = 1;
+                       break;
                default:
                        exit(1);
                }
@@ -2464,14 +2481,20 @@ int main(int argc, char **argv)
                sprintf(fname, "%s.mod.c", mod->name);
                write_if_changed(&buf, fname);
        }
-
        if (dump_write)
                write_dump(dump_write);
-       if (sec_mismatch_count && !sec_mismatch_verbose)
-               warn("modpost: Found %d section mismatch(es).\n"
-                    "To see full details build your kernel with:\n"
-                    "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
-                    sec_mismatch_count);
+       if (sec_mismatch_count) {
+               if (!sec_mismatch_verbose) {
+                       warn("modpost: Found %d section mismatch(es).\n"
+                            "To see full details build your kernel with:\n"
+                            "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
+                            sec_mismatch_count);
+               }
+               if (sec_mismatch_fatal) {
+                       fatal("modpost: Section mismatches detected.\n"
+                             "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
+               }
+       }
 
        return err;
 }