Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Apr 2015 16:49:24 +0000 (09:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Apr 2015 16:49:24 +0000 (09:49 -0700)
Pull module updates from Rusty Russell:
 "Quentin opened a can of worms by adding extable entry checking to
  modpost, but most architectures seem fixed now.  Thanks to all
  involved.

  Last minute rebase because I noticed a "[PATCH]" had snuck into a
  commit message somehow"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  modpost: don't emit section mismatch warnings for compiler optimizations
  modpost: expand pattern matching to support substring matches
  modpost: do not try to match the SHT_NUL section.
  modpost: fix extable entry size calculation.
  modpost: fix inverted logic in is_extable_fault_address().
  modpost: handle -ffunction-sections
  modpost: Whitelist .text.fixup and .exception.text
  params: handle quotes properly for values not of form foo="bar".
  modpost: document the use of struct section_check.
  modpost: handle relocations mismatch in __ex_table.
  scripts: add check_extable.sh script.
  modpost: mismatch_handler: retrieve tosym information only when needed.
  modpost: factorize symbol pretty print in get_pretty_name().
  modpost: add handler function pointer to sectioncheck.
  modpost: add .sched.text and .kprobes.text to the TEXT_SECTIONS list.
  modpost: add strict white-listing when referencing sections.
  module: do not print allocation-fail warning on bogus user buffer size
  kernel/module.c: fix typos in message about unused symbols

1  2 
kernel/module.c

diff --combined kernel/module.c
index 650b038ae52035962cb4fa37b14776225e4ce701,65bd206e04a9d585041f3e915eed8926e4d4d67a..42a1d2afb2173cd3c7c740098dd72d7a52bdb3f8
@@@ -387,9 -387,9 +387,9 @@@ static bool check_symbol(const struct s
                pr_warn("Symbol %s is marked as UNUSED, however this module is "
                        "using it.\n", fsa->name);
                pr_warn("This symbol will go away in the future.\n");
-               pr_warn("Please evalute if this is the right api to use and if "
-                       "it really is, submit a report the linux kernel "
-                       "mailinglist together with submitting your code for "
+               pr_warn("Please evaluate if this is the right api to use and "
+                       "if it really is, submit a report to the linux kernel "
+                       "mailing list together with submitting your code for "
                        "inclusion.\n");
        }
  #endif
@@@ -1865,7 -1865,7 +1865,7 @@@ static void free_module(struct module *
        kfree(mod->args);
        percpu_modfree(mod);
  
 -      /* Free lock-classes: */
 +      /* Free lock-classes; relies on the preceding sync_rcu(). */
        lockdep_free_key_range(mod->module_core, mod->core_size);
  
        /* Finally, free the core (containing the module structure) */
@@@ -2479,23 -2479,6 +2479,23 @@@ static int elf_header_check(struct load
        return 0;
  }
  
 +#define COPY_CHUNK_SIZE (16*PAGE_SIZE)
 +
 +static int copy_chunked_from_user(void *dst, const void __user *usrc, unsigned long len)
 +{
 +      do {
 +              unsigned long n = min(len, COPY_CHUNK_SIZE);
 +
 +              if (copy_from_user(dst, usrc, n) != 0)
 +                      return -EFAULT;
 +              cond_resched();
 +              dst += n;
 +              usrc += n;
 +              len -= n;
 +      } while (len);
 +      return 0;
 +}
 +
  /* Sets info->hdr and info->len. */
  static int copy_module_from_user(const void __user *umod, unsigned long len,
                                  struct load_info *info)
                return err;
  
        /* Suck in entire file: we'll want most of it. */
-       info->hdr = vmalloc(info->len);
+       info->hdr = __vmalloc(info->len,
+                       GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, PAGE_KERNEL);
        if (!info->hdr)
                return -ENOMEM;
  
 -      if (copy_from_user(info->hdr, umod, info->len) != 0) {
 +      if (copy_chunked_from_user(info->hdr, umod, info->len) != 0) {
                vfree(info->hdr);
                return -EFAULT;
        }
@@@ -2770,9 -2754,6 +2771,9 @@@ static int find_module_sections(struct 
        mod->trace_events = section_objs(info, "_ftrace_events",
                                         sizeof(*mod->trace_events),
                                         &mod->num_trace_events);
 +      mod->trace_enums = section_objs(info, "_ftrace_enum_map",
 +                                      sizeof(*mod->trace_enums),
 +                                      &mod->num_trace_enums);
  #endif
  #ifdef CONFIG_TRACING
        mod->trace_bprintk_fmt_start = section_objs(info, "__trace_printk_fmt",
@@@ -3369,6 -3350,9 +3370,6 @@@ static int load_module(struct load_inf
        module_bug_cleanup(mod);
        mutex_unlock(&module_mutex);
  
 -      /* Free lock-classes: */
 -      lockdep_free_key_range(mod->module_core, mod->core_size);
 -
        /* we can't deallocate the module until we clear memory protection */
        unset_module_init_ro_nx(mod);
        unset_module_core_ro_nx(mod);
        synchronize_rcu();
        mutex_unlock(&module_mutex);
   free_module:
 +      /* Free lock-classes; relies on the preceding sync_rcu() */
 +      lockdep_free_key_range(mod->module_core, mod->core_size);
 +
        module_deallocate(mod, info);
   free_copy:
        free_copy(info);