1. 03 Jul, 2020 10 commits
    • Barry Song's avatar
      mm/cma.c: use exact_nid true to fix possible per-numa cma leak · 40366bd7
      Barry Song authored
      Calling cma_declare_contiguous_nid() with false exact_nid for per-numa
      reservation can easily cause cma leak and various confusion.  For example,
      mm/hugetlb.c is trying to reserve per-numa cma for gigantic pages.  But it
      can easily leak cma and make users confused when system has memoryless
      nodes.
      
      In case the system has 4 numa nodes, and only numa node0 has memory.  if
      we set hugetlb_cma=4G in bootargs, mm/hugetlb.c will get 4 cma areas for 4
      different numa nodes.  since exact_nid=false in current code, all 4 numa
      nodes will get cma successfully from node0, but hugetlb_cma[1 to 3] will
      never be available to hugepage will only allocate memory from
      hugetlb_cma[0].
      
      In case the system has 4 numa nodes, both numa node0&2 has memory, other
      nodes have no memory.  if we set hugetlb_cma=4G in bootargs, mm/hugetlb.c
      will get 4 cma areas for 4 different numa nodes.  since exact_nid=false in
      current code, all 4 numa nodes will get cma successfully from node0 or 2,
      but hugetlb_cma[1] and [3] will never be available to hugepage as
      mm/hugetlb.c will only allocate memory from hugetlb_cma[0] and
      hugetlb_cma[2].  This causes permanent leak of the cma areas which are
      supposed to be used by memoryless node.
      
      Of cource we can workaround the issue by letting mm/hugetlb.c scan all cma
      areas in alloc_gigantic_page() even node_mask includes node0 only.  that
      means when node_mask includes node0 only, we can get page from
      hugetlb_cma[1] to hugetlb_cma[3].  But this will cause kernel crash in
      free_gigantic_page() while it wants to free page by:
      cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)
      
      On the other hand, exact_nid=false won't consider numa distance, it might
      be not that useful to leverage cma areas on remote nodes.  I feel it is
      much simpler to make exact_nid true to make everything clear.  After that,
      memoryless nodes won't be able to reserve per-numa CMA from other nodes
      which have memory.
      
      Fixes: cf11e85f ("mm: hugetlb: optionally allocate gigantic hugepages using cma")
      Signed-off-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
      Cc: Aslan Bakirov <aslan@fb.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Andreas Schaufler <andreas.schaufler@gmx.de>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Joonsoo Kim <js1304@gmail.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200628074345.27228-1-song.bao.hua@hisilicon.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      40366bd7
    • Kees Cook's avatar
      samples/vfs: avoid warning in statx override · c3eeaae9
      Kees Cook authored
      Something changed recently to uncover this warning:
      
        samples/vfs/test-statx.c:24:15: warning: `struct foo' declared inside parameter list will not be visible outside of this definition or declaration
           24 | #define statx foo
              |               ^~~
      
      Which is due the use of "struct statx" (here, "struct foo") in a function
      prototype argument list before it has been defined:
      
       int
       # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
          foo
       # 56 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
                (int __dirfd, const char *__restrict __path, int __flags,
                  unsigned int __mask, struct
       # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h"
                                             foo
       # 57 "/usr/include/x86_64-linux-gnu/bits/statx-generic.h" 3 4
                                                   *__restrict __buf)
         __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 5)));
      
      Add explicit struct before #include to avoid warning.
      
      Fixes: f1b5618e ("vfs: Add a sample program for the new mount API")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Link: http://lkml.kernel.org/r/202006282213.C516EA6@keescookSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c3eeaae9
    • Mike Kravetz's avatar
      mm/hugetlb.c: fix pages per hugetlb calculation · 1139d336
      Mike Kravetz authored
      The routine hpage_nr_pages() was incorrectly used to calculate the number
      of base pages in a hugetlb page.  hpage_nr_pages is designed to be called
      for THP pages and will return HPAGE_PMD_NR for hugetlb pages of any size.
      
      Due to the context in which hpage_nr_pages was called, it is unlikely to
      produce a user visible error.  The routine with the incorrect call is only
      exercised in the case of hugetlb memory error or migration.  In addition,
      this would need to be on an architecture which supports huge page sizes
      less than PMD_SIZE.  And, the vma containing the huge page would also need
      to smaller than PMD_SIZE.
      
      Fixes: c0d0381a ("hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization")
      Reported-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200629185003.97202-1-mike.kravetz@oracle.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1139d336
    • Linus Torvalds's avatar
      Merge tag 'm68knommu-for-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · cdd3bb54
      Linus Torvalds authored
      Pull m68knommu mm fixes from Greg Ungerer:
       "Two critical mm related fixes that affect booting of m68k/ColdFire
        devices.
      
        Both fix problems caused by recent system init memblock changes"
      
      * tag 'm68knommu-for-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68k: mm: fix node memblock init
        m68k: nommu: register start of the memory with memblock
      cdd3bb54
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 684c8ccc
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Sync dtc to upstream to pick up fixes for I2C bus checks and quiet
         warnings
      
       - Various fixes for DT binding check warnings
      
       - A couple of build fixes/improvements for binding checks
      
       - ReST formatting improvements for writing-schema.rst
      
       - Document reference fixes
      
      * tag 'devicetree-fixes-for-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: clock: imx: Fix e-mail address
        dt-bindings: thermal: k3: Fix the reg property
        dt-bindings: thermal: Remove soc unit address
        dt-bindings: display: arm: versatile: Pass the sysreg unit name
        dt-bindings: usb: aspeed: Remove the leading zeroes
        dt-bindings: copy process-schema-examples.yaml to process-schema.yaml
        dt-bindings: do not build processed-schema.yaml for 'make dt_binding_check'
        dt-bindings: fix error in 'make clean' after 'make dt_binding_check'
        dt-bindings: mailbox: zynqmp_ipi: fix unit address
        dt-bindings: bus: uniphier-system-bus: fix warning in example
        scripts/dtc: Update to upstream version v1.6.0-11-g9d7888cbf19c
        doc: devicetree: bindings: fix spelling mistake
        docs: dt: minor adjustments at writing-schema.rst
        dt: fix reference to olpc,xo1.75-ec.txt
        dt: Fix broken references to renamed docs
        dt: fix broken links due to txt->yaml renames
        dt: update a reference for reneases pcar file renamed to yaml
      684c8ccc
    • Linus Torvalds's avatar
      Merge tag 'for-linus-2020-07-02' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux · 45564bcd
      Linus Torvalds authored
      Pull data race annotation from Christian Brauner:
       "This contains an annotation patch for a data race in copy_process()
        reported by KCSAN when reading and writing nr_threads.
      
        The data race is intentional and benign. This is obvious from the
        comment above the relevant code and based on general consensus when
        discussing this issue. So simply using data_race() to annotate this as
        an intentional race seems the best option"
      
      * tag 'for-linus-2020-07-02' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
        fork: annotate data race in copy_process()
      45564bcd
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-next-v5.8-rc4' of git://git.infradead.org/users/jjs/linux-tpmdd · 0c7415c3
      Linus Torvalds authored
      Pull tpm fixes from Jarkko Sakkinen:
       "These are just fixes for bugs found lately.
      
        All of them are small scale things here and there, and all of them are
        for previous kernel releases (the oldest appeared in v2.6.17)"
      
      * tag 'tpmdd-next-v5.8-rc4' of git://git.infradead.org/users/jjs/linux-tpmdd:
        tpm_tis: Remove the HID IFX0102
        tpm_tis_spi: Prefer async probe
        tpm: ibmvtpm: Wait for ready buffer before probing for TPM2 attributes
        tpm/st33zp24: fix spelling mistake "drescription" -> "description"
        tpm_tis: extra chip->ops check on error path in tpm_tis_core_init
        tpm_tis_spi: Don't send anything during flow control
        tpm: Fix TIS locality timeout problems
      0c7415c3
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-5.8-rc4' of... · 0dce8845
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest fixes from Shuah Khan:
       "tpm test fixes from Jarkko Sakkinen"
      
      * tag 'linux-kselftest-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests: tpm: Use /bin/sh instead of /bin/bash
        selftests: tpm: Use 'test -e' instead of 'test -f'
        Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test"
      0dce8845
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-kunit-fixes-5.8-rc4' of... · 55844741
      Linus Torvalds authored
      Merge tag 'linux-kselftest-kunit-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kunit fixes from Shuah Khan
       "Fixes for build and run-times failures.
      
        Also includes troubleshooting tips updates to kunit user
        documentation"
      
      * tag 'linux-kselftest-kunit-fixes-5.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        Documentation: kunit: Add some troubleshooting tips to the FAQ
        kunit: kunit_tool: Fix invalid result when build fails
        kunit: show error if kunit results are not present
        kunit: kunit_config: Fix parsing of CONFIG options with space
      55844741
    • Linus Torvalds's avatar
      Merge tag 'nfsd-5.8-1' of git://linux-nfs.org/~bfields/linux · 083176c8
      Linus Torvalds authored
      Pull nfsd fixes from Bruce Fields:
       "Fixes for a umask bug on exported filesystems lacking ACL support, a
        leak and a module unloading bug in the /proc/fs/nfsd/clients/ code,
        and a compile warning"
      
      * tag 'nfsd-5.8-1' of git://linux-nfs.org/~bfields/linux:
        SUNRPC: Add missing definition of ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
        nfsd: fix nfsdfs inode reference count leak
        nfsd4: fix nfsdfs reference count loop
        nfsd: apply umask on fs without ACL support
      083176c8
  2. 02 Jul, 2020 9 commits
  3. 01 Jul, 2020 3 commits
  4. 30 Jun, 2020 15 commits
  5. 29 Jun, 2020 3 commits