1. 11 4月, 2018 1 次提交
  2. 06 4月, 2018 1 次提交
    • R
      headers: untangle kmemleak.h from mm.h · 514c6032
      Randy Dunlap 提交于
      Currently <linux/slab.h> #includes <linux/kmemleak.h> for no obvious
      reason.  It looks like it's only a convenience, so remove kmemleak.h
      from slab.h and add <linux/kmemleak.h> to any users of kmemleak_* that
      don't already #include it.  Also remove <linux/kmemleak.h> from source
      files that do not use it.
      
      This is tested on i386 allmodconfig and x86_64 allmodconfig.  It would
      be good to run it through the 0day bot for other $ARCHes.  I have
      neither the horsepower nor the storage space for the other $ARCHes.
      
      Update: This patch has been extensively build-tested by both the 0day
      bot & kisskb/ozlabs build farms.  Both of them reported 2 build failures
      for which patches are included here (in v2).
      
      [ slab.h is the second most used header file after module.h; kernel.h is
        right there with slab.h. There could be some minor error in the
        counting due to some #includes having comments after them and I didn't
        combine all of those. ]
      
      [akpm@linux-foundation.org: security/keys/big_key.c needs vmalloc.h, per sfr]
      Link: http://lkml.kernel.org/r/e4309f98-3749-93e1-4bb7-d9501a39d015@infradead.org
      Link: http://kisskb.ellerman.id.au/kisskb/head/13396/Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Reviewed-by: NIngo Molnar <mingo@kernel.org>
      Reported-by: Michael Ellerman <mpe@ellerman.id.au>	[2 build failures]
      Reported-by: Fengguang Wu <fengguang.wu@intel.com>	[2 build failures]
      Reviewed-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Wei Yongjun <weiyongjun1@huawei.com>
      Cc: Luis R. Rodriguez <mcgrof@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: John Johansen <john.johansen@canonical.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      514c6032
  3. 02 3月, 2018 1 次提交
  4. 01 2月, 2018 3 次提交
  5. 31 1月, 2018 3 次提交
  6. 15 12月, 2017 1 次提交
    • M
      virtio_mmio: fix devm cleanup · c2e90800
      Mark Rutland 提交于
      Recent rework of the virtio_mmio probe/remove paths balanced a
      devm_ioremap() with an iounmap() rather than its devm variant. This ends
      up corrupting the devm datastructures, and results in the following
      boot-time splat on arm64 under QEMU 2.9.0:
      
      [    3.450397] ------------[ cut here ]------------
      [    3.453822] Trying to vfree() nonexistent vm area (00000000c05b4844)
      [    3.460534] WARNING: CPU: 1 PID: 1 at mm/vmalloc.c:1525 __vunmap+0x1b8/0x220
      [    3.475898] Kernel panic - not syncing: panic_on_warn set ...
      [    3.475898]
      [    3.493933] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc3 #1
      [    3.513109] Hardware name: linux,dummy-virt (DT)
      [    3.525382] Call trace:
      [    3.531683]  dump_backtrace+0x0/0x368
      [    3.543921]  show_stack+0x20/0x30
      [    3.547767]  dump_stack+0x108/0x164
      [    3.559584]  panic+0x25c/0x51c
      [    3.569184]  __warn+0x29c/0x31c
      [    3.576023]  report_bug+0x1d4/0x290
      [    3.586069]  bug_handler.part.2+0x40/0x100
      [    3.597820]  bug_handler+0x4c/0x88
      [    3.608400]  brk_handler+0x11c/0x218
      [    3.613430]  do_debug_exception+0xe8/0x318
      [    3.627370]  el1_dbg+0x18/0x78
      [    3.634037]  __vunmap+0x1b8/0x220
      [    3.648747]  vunmap+0x6c/0xc0
      [    3.653864]  __iounmap+0x44/0x58
      [    3.659771]  devm_ioremap_release+0x34/0x68
      [    3.672983]  release_nodes+0x404/0x880
      [    3.683543]  devres_release_all+0x6c/0xe8
      [    3.695692]  driver_probe_device+0x250/0x828
      [    3.706187]  __driver_attach+0x190/0x210
      [    3.717645]  bus_for_each_dev+0x14c/0x1f0
      [    3.728633]  driver_attach+0x48/0x78
      [    3.740249]  bus_add_driver+0x26c/0x5b8
      [    3.752248]  driver_register+0x16c/0x398
      [    3.757211]  __platform_driver_register+0xd8/0x128
      [    3.770860]  virtio_mmio_init+0x1c/0x24
      [    3.782671]  do_one_initcall+0xe0/0x398
      [    3.791890]  kernel_init_freeable+0x594/0x660
      [    3.798514]  kernel_init+0x18/0x190
      [    3.810220]  ret_from_fork+0x10/0x18
      
      To fix this, we can simply rip out the explicit cleanup that the devm
      infrastructure will do for us when our probe function returns an error
      code, or when our remove function returns.
      
      We only need to ensure that we call put_device() if a call to
      register_virtio_device() fails in the probe path.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Fixes: 7eb781b1 ("virtio_mmio: add cleanup for virtio_mmio_probe")
      Fixes: 25f32223 ("virtio_mmio: add cleanup for virtio_mmio_remove")
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: weiping zhang <zhangweiping@didichuxing.com>
      Cc: virtualization@lists.linux-foundation.org
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      c2e90800
  7. 08 12月, 2017 2 次提交
  8. 01 12月, 2017 2 次提交
  9. 15 11月, 2017 1 次提交
    • M
      virtio_balloon: fix deadlock on OOM · c7cdff0e
      Michael S. Tsirkin 提交于
      fill_balloon doing memory allocations under balloon_lock
      can cause a deadlock when leak_balloon is called from
      virtballoon_oom_notify and tries to take same lock.
      
      To fix, split page allocation and enqueue and do allocations outside the lock.
      
      Here's a detailed analysis of the deadlock by Tetsuo Handa:
      
      In leak_balloon(), mutex_lock(&vb->balloon_lock) is called in order to
      serialize against fill_balloon(). But in fill_balloon(),
      alloc_page(GFP_HIGHUSER[_MOVABLE] | __GFP_NOMEMALLOC | __GFP_NORETRY) is
      called with vb->balloon_lock mutex held. Since GFP_HIGHUSER[_MOVABLE]
      implies __GFP_DIRECT_RECLAIM | __GFP_IO | __GFP_FS, despite __GFP_NORETRY
      is specified, this allocation attempt might indirectly depend on somebody
      else's __GFP_DIRECT_RECLAIM memory allocation. And such indirect
      __GFP_DIRECT_RECLAIM memory allocation might call leak_balloon() via
      virtballoon_oom_notify() via blocking_notifier_call_chain() callback via
      out_of_memory() when it reached __alloc_pages_may_oom() and held oom_lock
      mutex. Since vb->balloon_lock mutex is already held by fill_balloon(), it
      will cause OOM lockup.
      
        Thread1                                       Thread2
          fill_balloon()
            takes a balloon_lock
            balloon_page_enqueue()
              alloc_page(GFP_HIGHUSER_MOVABLE)
                direct reclaim (__GFP_FS context)       takes a fs lock
                  waits for that fs lock                  alloc_page(GFP_NOFS)
                                                            __alloc_pages_may_oom()
                                                              takes the oom_lock
                                                              out_of_memory()
                                                                blocking_notifier_call_chain()
                                                                  leak_balloon()
                                                                    tries to take that balloon_lock and deadlocks
      Reported-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Wei Wang <wei.w.wang@intel.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      c7cdff0e
  10. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  11. 26 8月, 2017 1 次提交
  12. 25 8月, 2017 1 次提交
  13. 24 8月, 2017 1 次提交
  14. 25 7月, 2017 3 次提交
  15. 19 6月, 2017 1 次提交
  16. 03 5月, 2017 3 次提交
  17. 11 4月, 2017 6 次提交
  18. 07 4月, 2017 1 次提交
  19. 29 3月, 2017 4 次提交
  20. 02 3月, 2017 1 次提交
  21. 28 2月, 2017 2 次提交