1. 23 Apr, 2020 2 commits
  2. 22 Apr, 2020 28 commits
  3. 21 Apr, 2020 10 commits
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 18bf3408
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "15 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        tools/vm: fix cross-compile build
        coredump: fix null pointer dereference on coredump
        mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path
        shmem: fix possible deadlocks on shmlock_user_lock
        vmalloc: fix remap_vmalloc_range() bounds checks
        mm/shmem: fix build without THP
        mm/ksm: fix NULL pointer dereference when KSM zero page is enabled
        tools/build: tweak unused value workaround
        checkpatch: fix a typo in the regex for $allocFunctions
        mm, gup: return EINTR when gup is interrupted by fatal signals
        mm/hugetlb: fix a addressing exception caused by huge_pte_offset
        MAINTAINERS: add an entry for kfifo
        mm/userfaultfd: disable userfaultfd-wp on x86_32
        slub: avoid redzone when choosing freepointer location
        sh: fix build error in mm/init.c
      18bf3408
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 8160a563
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Bugfixes, and a few cleanups to the newly-introduced assembly language
        vmentry code for AMD"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: PPC: Book3S HV: Handle non-present PTEs in page fault functions
        kvm: Disable objtool frame pointer checking for vmenter.S
        MAINTAINERS: add a reviewer for KVM/s390
        KVM: s390: Fix PV check in deliverable_irqs()
        kvm: Handle reads of SandyBridge RAPL PMU MSRs rather than injecting #GP
        KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
        KVM: SVM: Fix __svm_vcpu_run declaration.
        KVM: SVM: Do not setup frame pointer in __svm_vcpu_run
        KVM: SVM: Fix build error due to missing release_pages() include
        KVM: SVM: Do not mark svm_vcpu_run with STACK_FRAME_NON_STANDARD
        kvm: nVMX: match comment with return type for nested_vmx_exit_reflected
        kvm: nVMX: reflect MTF VM-exits if injected by L1
        KVM: s390: Return last valid slot if approx index is out-of-bounds
        KVM: Check validity of resolved slot when searching memslots
        KVM: VMX: Enable machine check support for 32bit targets
        KVM: SVM: move more vmentry code to assembly
        KVM: SVM: fix compilation with modular PSP and non-modular KVM
      8160a563
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 189522da
      Linus Torvalds authored
      Pull virtio fixes and cleanups from Michael Tsirkin:
      
       - Some bug fixes
      
       - Cleanup a couple of issues that surfaced meanwhile
      
       - Disable vhost on ARM with OABI for now - to be fixed fully later in
         the cycle or in the next release.
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (24 commits)
        vhost: disable for OABI
        virtio: drop vringh.h dependency
        virtio_blk: add a missing include
        virtio-balloon: Avoid using the word 'report' when referring to free page hinting
        virtio-balloon: make virtballoon_free_page_report() static
        vdpa: fix comment of vdpa_register_device()
        vdpa: make vhost, virtio depend on menu
        vdpa: allow a 32 bit vq alignment
        drm/virtio: fix up for include file changes
        remoteproc: pull in slab.h
        rpmsg: pull in slab.h
        virtio_input: pull in slab.h
        remoteproc: pull in slab.h
        virtio-rng: pull in slab.h
        virtgpu: pull in uaccess.h
        tools/virtio: make asm/barrier.h self contained
        tools/virtio: define aligned attribute
        virtio/test: fix up after IOTLB changes
        vhost: Create accessors for virtqueues private_data
        vdpasim: Return status in vdpasim_get_status
        ...
      189522da
    • Linus Torvalds's avatar
      Merge tag 'tpmdd-next-20200421' of git://git.infradead.org/users/jjs/linux-tpmdd · b61f7ff0
      Linus Torvalds authored
      Pull tpm fixes from Jarkko Sakkinen:
       "A few bug fixes"
      
      * tag 'tpmdd-next-20200421' of git://git.infradead.org/users/jjs/linux-tpmdd:
        tpm/tpm_tis: Free IRQ if probing fails
        tpm: fix wrong return value in tpm_pcr_extend
        tpm: ibmvtpm: retry on H_CLOSED in tpm_ibmvtpm_send()
        tpm: Export tpm2_get_cc_attrs_tbl for ibmvtpm driver as module
      b61f7ff0
    • Linus Torvalds's avatar
      Merge tag 'clang-format-for-linus-v5.7-rc3' of git://github.com/ojeda/linux · 20f16489
      Linus Torvalds authored
      Pull clang-format fixlets from Miguel Ojeda:
       "Two trivial clang-format changes:
      
         - Don't indent C++ namespaces (Ian Rogers)
      
         - The usual clang-format macro list update (Miguel Ojeda)"
      
      * tag 'clang-format-for-linus-v5.7-rc3' of git://github.com/ojeda/linux:
        clang-format: Update with the latest for_each macro list
        clang-format: don't indent namespaces
      20f16489
    • Lucas Stach's avatar
      tools/vm: fix cross-compile build · cf01699e
      Lucas Stach authored
      Commit 7ed1c190 ("tools: fix cross-compile var clobbering") moved
      the setup of the CC variable to tools/scripts/Makefile.include to make
      the behavior consistent across all the tools Makefiles.
      
      As the vm tools missed the include we end up with the wrong CC in a
      cross-compiling evironment.
      
      Fixes: 7ed1c190 (tools: fix cross-compile var clobbering)
      Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Martin Kelly <martin@martingkelly.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200416104748.25243-1-l.stach@pengutronix.deSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cf01699e
    • Sudip Mukherjee's avatar
      coredump: fix null pointer dereference on coredump · db973a72
      Sudip Mukherjee authored
      If the core_pattern is set to "|" and any process segfaults then we get
      a null pointer derefernce while trying to coredump. The call stack shows:
      
          RIP: do_coredump+0x628/0x11c0
      
      When the core_pattern has only "|" there is no use of trying the
      coredump and we can check that while formating the corename and exit
      with an error.
      
      After this change I get:
      
          format_corename failed
          Aborting core
      
      Fixes: 315c6926 ("coredump: split pipe command whitespace before expanding template")
      Reported-by: default avatarMatthew Ruffell <matthew.ruffell@canonical.com>
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Paul Wise <pabs3@bonedaddy.net>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200416194612.21418-1-sudipm.mukherjee@gmail.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      db973a72
    • Yang Shi's avatar
      mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path · 94b7cc01
      Yang Shi authored
      Syzbot reported the below lockdep splat:
      
          WARNING: possible irq lock inversion dependency detected
          5.6.0-rc7-syzkaller #0 Not tainted
          --------------------------------------------------------
          syz-executor.0/10317 just changed the state of lock:
          ffff888021d16568 (&(&info->lock)->rlock){+.+.}, at: spin_lock include/linux/spinlock.h:338 [inline]
          ffff888021d16568 (&(&info->lock)->rlock){+.+.}, at: shmem_mfill_atomic_pte+0x1012/0x21c0 mm/shmem.c:2407
          but this lock was taken by another, SOFTIRQ-safe lock in the past:
           (&(&xa->xa_lock)->rlock#5){..-.}
      
          and interrupts could create inverse lock ordering between them.
      
          other info that might help us debug this:
           Possible interrupt unsafe locking scenario:
      
                 CPU0                    CPU1
                 ----                    ----
            lock(&(&info->lock)->rlock);
                                         local_irq_disable();
                                         lock(&(&xa->xa_lock)->rlock#5);
                                         lock(&(&info->lock)->rlock);
            <Interrupt>
              lock(&(&xa->xa_lock)->rlock#5);
      
           *** DEADLOCK ***
      
      The full report is quite lengthy, please see:
      
        https://lore.kernel.org/linux-mm/alpine.LSU.2.11.2004152007370.13597@eggly.anvils/T/#m813b412c5f78e25ca8c6c7734886ed4de43f241d
      
      It is because CPU 0 held info->lock with IRQ enabled in userfaultfd_copy
      path, then CPU 1 is splitting a THP which held xa_lock and info->lock in
      IRQ disabled context at the same time.  If softirq comes in to acquire
      xa_lock, the deadlock would be triggered.
      
      The fix is to acquire/release info->lock with *_irq version instead of
      plain spin_{lock,unlock} to make it softirq safe.
      
      Fixes: 4c27fe4c ("userfaultfd: shmem: add shmem_mcopy_atomic_pte for userfaultfd support")
      Reported-by: syzbot+e27980339d305f2dbfd9@syzkaller.appspotmail.com
      Signed-off-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Tested-by: syzbot+e27980339d305f2dbfd9@syzkaller.appspotmail.com
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Link: http://lkml.kernel.org/r/1587061357-122619-1-git-send-email-yang.shi@linux.alibaba.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      94b7cc01
    • Hugh Dickins's avatar
      shmem: fix possible deadlocks on shmlock_user_lock · ea0dfeb4
      Hugh Dickins authored
      Recent commit 71725ed1 ("mm: huge tmpfs: try to split_huge_page()
      when punching hole") has allowed syzkaller to probe deeper, uncovering a
      long-standing lockdep issue between the irq-unsafe shmlock_user_lock,
      the irq-safe xa_lock on mapping->i_pages, and shmem inode's info->lock
      which nests inside xa_lock (or tree_lock) since 4.8's shmem_uncharge().
      
      user_shm_lock(), servicing SysV shmctl(SHM_LOCK), wants
      shmlock_user_lock while its caller shmem_lock() holds info->lock with
      interrupts disabled; but hugetlbfs_file_setup() calls user_shm_lock()
      with interrupts enabled, and might be interrupted by a writeback endio
      wanting xa_lock on i_pages.
      
      This may not risk an actual deadlock, since shmem inodes do not take
      part in writeback accounting, but there are several easy ways to avoid
      it.
      
      Requiring interrupts disabled for shmlock_user_lock would be easy, but
      it's a high-level global lock for which that seems inappropriate.
      Instead, recall that the use of info->lock to guard info->flags in
      shmem_lock() dates from pre-3.1 days, when races with SHMEM_PAGEIN and
      SHMEM_TRUNCATE could occur: nowadays it serves no purpose, the only flag
      added or removed is VM_LOCKED itself, and calls to shmem_lock() an inode
      are already serialized by the caller.
      
      Take info->lock out of the chain and the possibility of deadlock or
      lockdep warning goes away.
      
      Fixes: 4595ef88 ("shmem: make shmem_inode_info::lock irq-safe")
      Reported-by: syzbot+c8a8197c8852f566b9d9@syzkaller.appspotmail.com
      Reported-by: syzbot+40b71e145e73f78f81ad@syzkaller.appspotmail.com
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2004161707410.16322@eggly.anvils
      Link: https://lore.kernel.org/lkml/000000000000e5838c05a3152f53@google.com/
      Link: https://lore.kernel.org/lkml/0000000000003712b305a331d3b1@google.com/Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ea0dfeb4
    • Jann Horn's avatar
      vmalloc: fix remap_vmalloc_range() bounds checks · bdebd6a2
      Jann Horn authored
      remap_vmalloc_range() has had various issues with the bounds checks it
      promises to perform ("This function checks that addr is a valid
      vmalloc'ed area, and that it is big enough to cover the vma") over time,
      e.g.:
      
       - not detecting pgoff<<PAGE_SHIFT overflow
      
       - not detecting (pgoff<<PAGE_SHIFT)+usize overflow
      
       - not checking whether addr and addr+(pgoff<<PAGE_SHIFT) are the same
         vmalloc allocation
      
       - comparing a potentially wildly out-of-bounds pointer with the end of
         the vmalloc region
      
      In particular, since commit fc970227 ("bpf: Add mmap() support for
      BPF_MAP_TYPE_ARRAY"), unprivileged users can cause kernel null pointer
      dereferences by calling mmap() on a BPF map with a size that is bigger
      than the distance from the start of the BPF map to the end of the
      address space.
      
      This could theoretically be used as a kernel ASLR bypass, by using
      whether mmap() with a given offset oopses or returns an error code to
      perform a binary search over the possible address range.
      
      To allow remap_vmalloc_range_partial() to verify that addr and
      addr+(pgoff<<PAGE_SHIFT) are in the same vmalloc region, pass the offset
      to remap_vmalloc_range_partial() instead of adding it to the pointer in
      remap_vmalloc_range().
      
      In remap_vmalloc_range_partial(), fix the check against
      get_vm_area_size() by using size comparisons instead of pointer
      comparisons, and add checks for pgoff.
      
      Fixes: 83342314 ("[PATCH] mm: introduce remap_vmalloc_range()")
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: stable@vger.kernel.org
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@chromium.org>
      Link: http://lkml.kernel.org/r/20200415222312.236431-1-jannh@google.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bdebd6a2