“f7be82093952ee4a74ffc8c729b2811f908cd9a4”上不存在“kernel/rcu/tree.c”
  1. 16 3月, 2017 1 次提交
    • T
      locking/lockdep: Handle statically initialized PER_CPU locks properly · 383776fa
      Thomas Gleixner 提交于
      If a PER_CPU struct which contains a spin_lock is statically initialized
      via:
      
      DEFINE_PER_CPU(struct foo, bla) = {
      	.lock = __SPIN_LOCK_UNLOCKED(bla.lock)
      };
      
      then lockdep assigns a seperate key to each lock because the logic for
      assigning a key to statically initialized locks is to use the address as
      the key. With per CPU locks the address is obvioulsy different on each CPU.
      
      That's wrong, because all locks should have the same key.
      
      To solve this the following modifications are required:
      
       1) Extend the is_kernel/module_percpu_addr() functions to hand back the
          canonical address of the per CPU address, i.e. the per CPU address
          minus the per CPU offset.
      
       2) Check the lock address with these functions and if the per CPU check
          matches use the returned canonical address as the lock key, so all per
          CPU locks have the same key.
      
       3) Move the static_obj(key) check into look_up_lock_class() so this check
          can be avoided for statically initialized per CPU locks.  That's
          required because the canonical address fails the static_obj(key) check
          for obvious reasons.
      Reported-by: NMike Galbraith <efault@gmx.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      [ Merged Dan's fixups for !MODULES and !SMP into this patch. ]
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dan Murphy <dmurphy@ti.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170227143736.pectaimkjkan5kow@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      383776fa
  2. 22 2月, 2017 1 次提交
    • L
      module: fix memory leak on early load_module() failures · a5544880
      Luis R. Rodriguez 提交于
      While looking for early possible module loading failures I was
      able to reproduce a memory leak possible with kmemleak. There
      are a few rare ways to trigger a failure:
      
        o we've run into a failure while processing kernel parameters
          (parse_args() returns an error)
        o mod_sysfs_setup() fails
        o we're a live patch module and copy_module_elf() fails
      
      Chances of running into this issue is really low.
      
      kmemleak splat:
      
      unreferenced object 0xffff9f2c4ada1b00 (size 32):
        comm "kworker/u16:4", pid 82, jiffies 4294897636 (age 681.816s)
        hex dump (first 32 bytes):
          6d 65 6d 73 74 69 63 6b 30 00 00 00 00 00 00 00  memstick0.......
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff8c6cfeba>] kmemleak_alloc+0x4a/0xa0
          [<ffffffff8c200046>] __kmalloc_track_caller+0x126/0x230
          [<ffffffff8c1bc581>] kstrdup+0x31/0x60
          [<ffffffff8c1bc5d4>] kstrdup_const+0x24/0x30
          [<ffffffff8c3c23aa>] kvasprintf_const+0x7a/0x90
          [<ffffffff8c3b5481>] kobject_set_name_vargs+0x21/0x90
          [<ffffffff8c4fbdd7>] dev_set_name+0x47/0x50
          [<ffffffffc07819e5>] memstick_check+0x95/0x33c [memstick]
          [<ffffffff8c09c893>] process_one_work+0x1f3/0x4b0
          [<ffffffff8c09cb98>] worker_thread+0x48/0x4e0
          [<ffffffff8c0a2b79>] kthread+0xc9/0xe0
          [<ffffffff8c6dab5f>] ret_from_fork+0x1f/0x40
          [<ffffffffffffffff>] 0xffffffffffffffff
      
      Cc: stable <stable@vger.kernel.org> # v2.6.30
      Fixes: e180a6b7 ("param: fix charp parameters set via sysfs")
      Reviewed-by: NMiroslav Benes <mbenes@suse.cz>
      Reviewed-by: NAaron Tomlin <atomlin@redhat.com>
      Reviewed-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: NJessica Yu <jeyu@redhat.com>
      a5544880
  3. 14 2月, 2017 1 次提交
  4. 11 2月, 2017 1 次提交
  5. 10 2月, 2017 1 次提交
    • P
      core: migrate exception table users off module.h and onto extable.h · 8a293be0
      Paul Gortmaker 提交于
      These files were including module.h for exception table related
      functions.  We've now separated that content out into its own file
      "extable.h" so now move over to that and where possible, avoid all
      the extra header content in module.h that we don't really need to
      compile these non-modular files.
      
      Note:
         init/main.c still needs module.h for __init_or_module
         kernel/extable.c still needs module.h for is_module_text_address
      
      ...and so we don't get the benefit of removing module.h from the cpp
      feed for these two files, unlike the almost universal 1:1 exchange
      of module.h for extable.h we were able to do in the arch dirs.
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Acked-by: NJessica Yu <jeyu@redhat.com>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      8a293be0
  6. 08 2月, 2017 1 次提交
  7. 04 2月, 2017 1 次提交
    • A
      modversions: treat symbol CRCs as 32 bit quantities · 71810db2
      Ard Biesheuvel 提交于
      The modversion symbol CRCs are emitted as ELF symbols, which allows us
      to easily populate the kcrctab sections by relying on the linker to
      associate each kcrctab slot with the correct value.
      
      This has a couple of downsides:
      
       - Given that the CRCs are treated as memory addresses, we waste 4 bytes
         for each CRC on 64 bit architectures,
      
       - On architectures that support runtime relocation, a R_<arch>_RELATIVE
         relocation entry is emitted for each CRC value, which identifies it
         as a quantity that requires fixing up based on the actual runtime
         load offset of the kernel. This results in corrupted CRCs unless we
         explicitly undo the fixup (and this is currently being handled in the
         core module code)
      
       - Such runtime relocation entries take up 24 bytes of __init space
         each, resulting in a x8 overhead in [uncompressed] kernel size for
         CRCs.
      
      Switching to explicit 32 bit values on 64 bit architectures fixes most
      of these issues, given that 32 bit values are not treated as quantities
      that require fixing up based on the actual runtime load offset.  Note
      that on some ELF64 architectures [such as PPC64], these 32-bit values
      are still emitted as [absolute] runtime relocatable quantities, even if
      the value resolves to a build time constant.  Since relative relocations
      are always resolved at build time, this patch enables MODULE_REL_CRCS on
      powerpc when CONFIG_RELOCATABLE=y, which turns the absolute CRC
      references into relative references into .rodata where the actual CRC
      value is stored.
      
      So redefine all CRC fields and variables as u32, and redefine the
      __CRC_SYMBOL() macro for 64 bit builds to emit the CRC reference using
      inline assembler (which is necessary since 64-bit C code cannot use
      32-bit types to hold memory addresses, even if they are ultimately
      resolved using values that do not exceed 0xffffffff).  To avoid
      potential problems with legacy 32-bit architectures using legacy
      toolchains, the equivalent C definition of the kcrctab entry is retained
      for 32-bit architectures.
      
      Note that this mostly reverts commit d4703aef ("module: handle ppc64
      relocating kcrctabs when CONFIG_RELOCATABLE=y")
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      71810db2
  8. 31 1月, 2017 1 次提交
  9. 18 1月, 2017 1 次提交
  10. 25 12月, 2016 1 次提交
  11. 30 11月, 2016 1 次提交
    • L
      Re-enable CONFIG_MODVERSIONS in a slightly weaker form · faaae2a5
      Linus Torvalds 提交于
      This enables CONFIG_MODVERSIONS again, but allows for missing symbol CRC
      information in order to work around the issue that newer binutils
      versions seem to occasionally drop the CRC on the floor.  binutils 2.26
      seems to work fine, while binutils 2.27 seems to break MODVERSIONS of
      symbols that have been defined in assembler files.
      
      [ We've had random missing CRC's before - it may be an old problem that
        just is now reliably triggered with the weak asm symbols and a new
        version of binutils ]
      
      Some day I really do want to remove MODVERSIONS entirely.  Sadly, today
      does not appear to be that day: Debian people apparently do want the
      option to enable MODVERSIONS to make it easier to have external modules
      across kernel versions, and this seems to be a fairly minimal fix for
      the annoying problem.
      
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Acked-by: NMichal Marek <mmarek@suse.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      faaae2a5
  12. 28 11月, 2016 1 次提交
  13. 27 11月, 2016 4 次提交
  14. 26 8月, 2016 1 次提交
  15. 04 8月, 2016 3 次提交
    • J
      modules: add ro_after_init support · 444d13ff
      Jessica Yu 提交于
      Add ro_after_init support for modules by adding a new page-aligned section
      in the module layout (after rodata) for ro_after_init data and enabling RO
      protection for that section after module init runs.
      Signed-off-by: NJessica Yu <jeyu@redhat.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      444d13ff
    • P
      modules: Add kernel parameter to blacklist modules · be7de5f9
      Prarit Bhargava 提交于
      Blacklisting a module in linux has long been a problem.  The current
      procedure is to use rd.blacklist=module_name, however, that doesn't
      cover the case after the initramfs and before a boot prompt (where one
      is supposed to use /etc/modprobe.d/blacklist.conf to blacklist
      runtime loading). Using rd.shell to get an early prompt is hit-or-miss,
      and doesn't cover all situations AFAICT.
      
      This patch adds this functionality of permanently blacklisting a module
      by its name via the kernel parameter module_blacklist=module_name.
      
      [v2]: Rusty, use core_param() instead of __setup() which simplifies
      things.
      
      [v3]: Rusty, undo wreckage from strsep()
      
      [v4]: Rusty, simpler version of blacklisted()
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: linux-doc@vger.kernel.org
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      be7de5f9
    • S
      module: Do a WARN_ON_ONCE() for assert module mutex not held · 9502514f
      Steven Rostedt 提交于
      When running with lockdep enabled, I triggered the WARN_ON() in the
      module code that asserts when module_mutex or rcu_read_lock_sched are
      not held. The issue I have is that this can also be called from the
      dump_stack() code, causing us to enter an infinite loop...
      
       ------------[ cut here ]------------
       WARNING: CPU: 1 PID: 0 at kernel/module.c:268 module_assert_mutex_or_preempt+0x3c/0x3e
       Modules linked in: ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6
       CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.7.0-rc3-test-00013-g501c2375 #14
       Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014
        ffff880215e8fa70 ffff880215e8fa70 ffffffff812fc8e3 0000000000000000
        ffffffff81d3e55b ffff880215e8fac0 ffffffff8104fc88 ffffffff8104fcab
        0000000915e88300 0000000000000046 ffffffffa019b29a 0000000000000001
       Call Trace:
        [<ffffffff812fc8e3>] dump_stack+0x67/0x90
        [<ffffffff8104fc88>] __warn+0xcb/0xe9
        [<ffffffff8104fcab>] ? warn_slowpath_null+0x5/0x1f
       ------------[ cut here ]------------
       WARNING: CPU: 1 PID: 0 at kernel/module.c:268 module_assert_mutex_or_preempt+0x3c/0x3e
       Modules linked in: ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6
       CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.7.0-rc3-test-00013-g501c2375 #14
       Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014
        ffff880215e8f7a0 ffff880215e8f7a0 ffffffff812fc8e3 0000000000000000
        ffffffff81d3e55b ffff880215e8f7f0 ffffffff8104fc88 ffffffff8104fcab
        0000000915e88300 0000000000000046 ffffffffa019b29a 0000000000000001
       Call Trace:
        [<ffffffff812fc8e3>] dump_stack+0x67/0x90
        [<ffffffff8104fc88>] __warn+0xcb/0xe9
        [<ffffffff8104fcab>] ? warn_slowpath_null+0x5/0x1f
       ------------[ cut here ]------------
       WARNING: CPU: 1 PID: 0 at kernel/module.c:268 module_assert_mutex_or_preempt+0x3c/0x3e
       Modules linked in: ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6
       CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.7.0-rc3-test-00013-g501c2375 #14
       Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014
        ffff880215e8f4d0 ffff880215e8f4d0 ffffffff812fc8e3 0000000000000000
        ffffffff81d3e55b ffff880215e8f520 ffffffff8104fc88 ffffffff8104fcab
        0000000915e88300 0000000000000046 ffffffffa019b29a 0000000000000001
       Call Trace:
        [<ffffffff812fc8e3>] dump_stack+0x67/0x90
        [<ffffffff8104fc88>] __warn+0xcb/0xe9
        [<ffffffff8104fcab>] ? warn_slowpath_null+0x5/0x1f
       ------------[ cut here ]------------
       WARNING: CPU: 1 PID: 0 at kernel/module.c:268 module_assert_mutex_or_preempt+0x3c/0x3e
      [...]
      
      Which gives us rather useless information. Worse yet, there's some race
      that causes this, and I seldom trigger it, so I have no idea what
      happened.
      
      This would not be an issue if that warning was a WARN_ON_ONCE().
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      9502514f
  16. 03 8月, 2016 1 次提交
  17. 27 7月, 2016 4 次提交
  18. 01 4月, 2016 1 次提交
    • J
      module: preserve Elf information for livepatch modules · 1ce15ef4
      Jessica Yu 提交于
      For livepatch modules, copy Elf section, symbol, and string information
      from the load_info struct in the module loader. Persist copies of the
      original symbol table and string table.
      
      Livepatch manages its own relocation sections in order to reuse module
      loader code to write relocations. Livepatch modules must preserve Elf
      information such as section indices in order to apply livepatch relocation
      sections using the module loader's apply_relocate_add() function.
      
      In order to apply livepatch relocation sections, livepatch modules must
      keep a complete copy of their original symbol table in memory. Normally, a
      stripped down copy of a module's symbol table (containing only "core"
      symbols) is made available through module->core_symtab. But for livepatch
      modules, the symbol table copied into memory on module load must be exactly
      the same as the symbol table produced when the patch module was compiled.
      This is because the relocations in each livepatch relocation section refer
      to their respective symbols with their symbol indices, and the original
      symbol indices (and thus the symtab ordering) must be preserved in order
      for apply_relocate_add() to find the right symbol.
      Signed-off-by: NJessica Yu <jeyu@redhat.com>
      Reviewed-by: NMiroslav Benes <mbenes@suse.cz>
      Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Reviewed-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      1ce15ef4
  19. 17 3月, 2016 2 次提交
  20. 21 2月, 2016 1 次提交
    • M
      module: replace copy_module_from_fd with kernel version · a1db7420
      Mimi Zohar 提交于
      Replace copy_module_from_fd() with kernel_read_file_from_fd().
      
      Although none of the upstreamed LSMs define a kernel_module_from_file
      hook, IMA is called, based on policy, to prevent unsigned kernel modules
      from being loaded by the original kernel module syscall and to
      measure/appraise signed kernel modules.
      
      The security function security_kernel_module_from_file() was called prior
      to reading a kernel module.  Preventing unsigned kernel modules from being
      loaded by the original kernel module syscall remains on the pre-read
      kernel_read_file() security hook.  Instead of reading the kernel module
      twice, once for measuring/appraising and again for loading the kernel
      module, the signature validation is moved to the kernel_post_read_file()
      security hook.
      
      This patch removes the security_kernel_module_from_file() hook and security
      call.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      a1db7420
  21. 18 2月, 2016 1 次提交
  22. 03 2月, 2016 3 次提交
    • R
      modules: fix longstanding /proc/kallsyms vs module insertion race. · 8244062e
      Rusty Russell 提交于
      For CONFIG_KALLSYMS, we keep two symbol tables and two string tables.
      There's one full copy, marked SHF_ALLOC and laid out at the end of the
      module's init section.  There's also a cut-down version that only
      contains core symbols and strings, and lives in the module's core
      section.
      
      After module init (and before we free the module memory), we switch
      the mod->symtab, mod->num_symtab and mod->strtab to point to the core
      versions.  We do this under the module_mutex.
      
      However, kallsyms doesn't take the module_mutex: it uses
      preempt_disable() and rcu tricks to walk through the modules, because
      it's used in the oops path.  It's also used in /proc/kallsyms.
      There's nothing atomic about the change of these variables, so we can
      get the old (larger!) num_symtab and the new symtab pointer; in fact
      this is what I saw when trying to reproduce.
      
      By grouping these variables together, we can use a
      carefully-dereferenced pointer to ensure we always get one or the
      other (the free of the module init section is already done in an RCU
      callback, so that's safe).  We allocate the init one at the end of the
      module init section, and keep the core one inside the struct module
      itself (it could also have been allocated at the end of the module
      core, but that's probably overkill).
      Reported-by: NWeilong Chen <chenweilong@huawei.com>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111541
      Cc: stable@kernel.org
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      8244062e
    • R
      module: wrapper for symbol name. · 2e7bac53
      Rusty Russell 提交于
      This trivial wrapper adds clarity and makes the following patch
      smaller.
      
      Cc: stable@kernel.org
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      2e7bac53
    • L
      modules: fix modparam async_probe request · 4355efbd
      Luis R. Rodriguez 提交于
      Commit f2411da7 ("driver-core: add driver module
      asynchronous probe support") added async probe support,
      in two forms:
      
        * in-kernel driver specification annotation
        * generic async_probe module parameter (modprobe foo async_probe)
      
      To support the generic kernel parameter parse_args() was
      extended via commit ecc86170 ("module: add extra
      argument for parse_params() callback") however commit
      failed to f2411da7 failed to add the required argument.
      
      This causes a crash then whenever async_probe generic
      module parameter is used. This was overlooked when the
      form in which in-kernel async probe support was reworked
      a bit... Fix this as originally intended.
      
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: stable@vger.kernel.org (4.2+)
      Signed-off-by: NLuis R. Rodriguez <mcgrof@suse.com>
      Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> [minimized]
      4355efbd
  23. 08 1月, 2016 1 次提交
  24. 05 12月, 2015 4 次提交
    • M
      module: keep percpu symbols in module's symtab · e0224418
      Miroslav Benes 提交于
      Currently, percpu symbols from .data..percpu ELF section of a module are
      not copied over and stored in final symtab array of struct module.
      Consequently such symbol cannot be returned via kallsyms API (for
      example kallsyms_lookup_name). This can be especially confusing when the
      percpu symbol is exported. Only its __ksymtab et al. are present in its
      symtab.
      
      The culprit is in layout_and_allocate() function where SHF_ALLOC flag is
      dropped for .data..percpu section. There is in fact no need to copy the
      section to final struct module, because kernel module loader allocates
      extra percpu section by itself. Unfortunately only symbols from
      SHF_ALLOC sections are copied due to a check in is_core_symbol().
      
      The patch changes is_core_symbol() function to copy over also percpu
      symbols (their st_shndx points to .data..percpu ELF section). We do it
      only if CONFIG_KALLSYMS_ALL is set to be consistent with the rest of the
      function (ELF section is SHF_ALLOC but !SHF_EXECINSTR). Finally
      elf_type() returns type 'a' for a percpu symbol because its address is
      absolute.
      Signed-off-by: NMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e0224418
    • R
      module: clean up RO/NX handling. · 85c898db
      Rusty Russell 提交于
      Modules have three sections: text, rodata and writable data.  The code
      handled the case where these overlapped, however they never can:
      debug_align() ensures they are always page-aligned.
      
      This is why we got away with manually traversing the pages in
      set_all_modules_text_rw() without rounding.
      
      We create three helper functions: frob_text(), frob_rodata() and
      frob_writable_data().  We then call these explicitly at every point,
      so it's clear what we're doing.
      
      We also expose module_enable_ro() and module_disable_ro() for
      livepatch to use.
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      85c898db
    • R
      module: use a structure to encapsulate layout. · 7523e4dc
      Rusty Russell 提交于
      Makes it easier to handle init vs core cleanly, though the change is
      fairly invasive across random architectures.
      
      It simplifies the rbtree code immediately, however, while keeping the
      core data together in the same cachline (now iff the rbtree code is
      enabled).
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Reviewed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      7523e4dc
    • J
      module: Use the same logic for setting and unsetting RO/NX · 20ef10c1
      Josh Poimboeuf 提交于
      When setting a module's RO and NX permissions, set_section_ro_nx() is
      used, but when clearing them, unset_module_{init,core}_ro_nx() are used.
      The unset functions don't have the same checks the set function has for
      partial page protections.  It's probably harmless, but it's still
      confusingly asymmetrical.
      
      Instead, use the same logic to do both.  Also add some new
      set_module_{init,core}_ro_nx() helper functions for more symmetry with
      the unset functions.
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      20ef10c1
  25. 24 8月, 2015 1 次提交
    • P
      module: Fix locking in symbol_put_addr() · 275d7d44
      Peter Zijlstra 提交于
      Poma (on the way to another bug) reported an assertion triggering:
      
        [<ffffffff81150529>] module_assert_mutex_or_preempt+0x49/0x90
        [<ffffffff81150822>] __module_address+0x32/0x150
        [<ffffffff81150956>] __module_text_address+0x16/0x70
        [<ffffffff81150f19>] symbol_put_addr+0x29/0x40
        [<ffffffffa04b77ad>] dvb_frontend_detach+0x7d/0x90 [dvb_core]
      
      Laura Abbott <labbott@redhat.com> produced a patch which lead us to
      inspect symbol_put_addr(). This function has a comment claiming it
      doesn't need to disable preemption around the module lookup
      because it holds a reference to the module it wants to find, which
      therefore cannot go away.
      
      This is wrong (and a false optimization too, preempt_disable() is really
      rather cheap, and I doubt any of this is on uber critical paths,
      otherwise it would've retained a pointer to the actual module anyway and
      avoided the second lookup).
      
      While its true that the module cannot go away while we hold a reference
      on it, the data structure we do the lookup in very much _CAN_ change
      while we do the lookup. Therefore fix the comment and add the
      required preempt_disable().
      Reported-by: Npoma <pomidorabelisima@gmail.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Fixes: a6e6abd5 ("module: remove module_text_address()")
      Cc: stable@kernel.org
      275d7d44
  26. 29 7月, 2015 1 次提交