Skip to content
  1. Apr 08, 2017
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · 8b65bb57
      Linus Torvalds authored
      Pull sparc fixes from David Miller:
       "Several fixes here, mostly having to due with either build errors or
        memory corruptions depending upon whether you have THP enabled or not"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc: remove unused wp_works_ok macro
        sparc32: Export vac_cache_size to fix build error
        sparc64: Fix memory corruption when THP is enabled
        sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write()
        arch/sparc: Avoid DCTI Couples
        sparc64: kern_addr_valid regression
        sparc64: Add support for 2G hugepages
        sparc64: Fix size check in huge_pte_alloc
      8b65bb57
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 542380a2
      Linus Torvalds authored
      Pull KVM fixes from Radim Krčmář:
       "ARM:
         - Fix a problem with GICv3 userspace save/restore
         - Clarify GICv2 userspace save/restore ABI
         - Be more careful in clearing GIC LRs
         - Add missing synchronization primitive to our MMU handling code
      
        PPC:
         - Check for a NULL return from kzalloc
      
        s390:
         - Prevent translation exception errors on valid page tables for the
           instruction-exection-protection support
      
        x86:
         - Fix Page-Modification Logging when running a nested guest"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: PPC: Book3S HV: Check for kmalloc errors in ioctl
        KVM: nVMX: initialize PML fields in vmcs02
        KVM: nVMX: do not leak PML full vmexit to L1
        KVM: arm/arm64: vgic: Fix GICC_PMR uaccess on GICv3 and clarify ABI
        KVM: arm64: Ensure LRs are clear when they should be
        kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
        KVM: s390: remove change-recording override support
        arm/arm64: KVM: Take mmap_sem in kvm_arch_prepare_memory_region
        arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm
      542380a2
    • Linus Torvalds's avatar
      Merge branch 'stable-4.11' of git://git.infradead.org/users/pcmoore/audit · 62fedca5
      Linus Torvalds authored
      Pull audit cleanup from Paul Moore:
       "A week later than I had hoped, but as promised, here is the audit
        uninline-fix we talked about during the last audit pull request.
      
        The patch is slightly different than what we originally discussed as
        it made more sense to keep the audit_signal_info() function in
        auditsc.c rather than move it and bunch of other related
        variables/definitions into audit.c/audit.h.
      
        At some point in the future I need to look at how the audit code is
        organized across kernel/audit*, I suspect we could do things a bit
        better, but it doesn't seem like a -rc release is a good place for
        that ;)
      
        Regardless, this patch passes our tests without problem and looks good
        for v4.11"
      
      * 'stable-4.11' of git://git.infradead.org/users/pcmoore/audit:
        audit: move audit_signal_info() into kernel/auditsc.c
      62fedca5
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 56c29979
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "10 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm: move pcp and lru-pcp draining into single wq
        mailmap: update Yakir Yang email address
        mm, swap_cgroup: reschedule when neeed in swap_cgroup_swapoff()
        dax: fix radix tree insertion race
        mm, thp: fix setting of defer+madvise thp defrag mode
        ptrace: fix PTRACE_LISTEN race corrupting task->state
        vmlinux.lds: add missing VMLINUX_SYMBOL macros
        mm/page_alloc.c: fix print order in show_free_areas()
        userfaultfd: report actual registered features in fdinfo
        mm: fix page_vma_mapped_walk() for ksm pages
      56c29979
    • Michal Hocko's avatar
      mm: move pcp and lru-pcp draining into single wq · ce612879
      Michal Hocko authored
      
      
      We currently have 2 specific WQ_RECLAIM workqueues in the mm code.
      vmstat_wq for updating pcp stats and lru_add_drain_wq dedicated to drain
      per cpu lru caches.  This seems more than necessary because both can run
      on a single WQ.  Both do not block on locks requiring a memory
      allocation nor perform any allocations themselves.  We will save one
      rescuer thread this way.
      
      On the other hand drain_all_pages() queues work on the system wq which
      doesn't have rescuer and so this depend on memory allocation (when all
      workers are stuck allocating and new ones cannot be created).
      
      Initially we thought this would be more of a theoretical problem but
      Hugh Dickins has reported:
      
      : 4.11-rc has been giving me hangs after hours of swapping load.  At
      : first they looked like memory leaks ("fork: Cannot allocate memory");
      : but for no good reason I happened to do "cat /proc/sys/vm/stat_refresh"
      : before looking at /proc/meminfo one time, and the stat_refresh stuck
      : in D state, waiting for completion of flush_work like many kworkers.
      : kthreadd waiting for completion of flush_work in drain_all_pages().
      
      This worker should be using WQ_RECLAIM as well in order to guarantee a
      forward progress.  We can reuse the same one as for lru draining and
      vmstat.
      
      Link: http://lkml.kernel.org/r/20170307131751.24936-1-mhocko@kernel.org
      Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Suggested-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Tested-by: default avatarYang Li <pku.leo@gmail.com>
      Tested-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ce612879
    • Jeffy Chen's avatar
      mailmap: update Yakir Yang email address · cdcf4330
      Jeffy Chen authored
      
      
      Set current email address to replace previous employers email addresses.
      
      Link: http://lkml.kernel.org/r/1491450722-6633-1-git-send-email-jeffy.chen@rock-chips.com
      Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cdcf4330
    • David Rientjes's avatar
      mm, swap_cgroup: reschedule when neeed in swap_cgroup_swapoff() · 460bcec8
      David Rientjes authored
      
      
      We got need_resched() warnings in swap_cgroup_swapoff() because
      swap_cgroup_ctrl[type].length is particularly large.
      
      Reschedule when needed.
      
      Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1704061315270.80559@chino.kir.corp.google.com
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      460bcec8
    • Ross Zwisler's avatar
      dax: fix radix tree insertion race · e11f8b7b
      Ross Zwisler authored
      
      
      While running generic/340 in my test setup I hit the following race.  It
      can happen with kernels that support FS DAX PMDs, so v4.10 thru
      v4.11-rc5.
      
      Thread 1				Thread 2
      --------				--------
      dax_iomap_pmd_fault()
        grab_mapping_entry()
          spin_lock_irq()
          get_unlocked_mapping_entry()
          'entry' is NULL, can't call lock_slot()
          spin_unlock_irq()
          radix_tree_preload()
      					dax_iomap_pmd_fault()
      					  grab_mapping_entry()
      					    spin_lock_irq()
      					    get_unlocked_mapping_entry()
      					    ...
      					    lock_slot()
      					    spin_unlock_irq()
      					  dax_pmd_insert_mapping()
      					    <inserts a PMD mapping>
          spin_lock_irq()
          __radix_tree_insert() fails with -EEXIST
          <fall back to 4k fault, and die horribly
           when inserting a 4k entry where a PMD exists>
      
      The issue is that we have to drop mapping->tree_lock while calling
      radix_tree_preload(), but since we didn't have a radix tree entry to
      lock (unlike in the pmd_downgrade case) we have no protection against
      Thread 2 coming along and inserting a PMD at the same index.  For 4k
      entries we handled this with a special-case response to -EEXIST coming
      from the __radix_tree_insert(), but this doesn't save us for PMDs
      because the -EEXIST case can also mean that we collided with a 4k entry
      in the radix tree at a different index, but one that is covered by our
      PMD range.
      
      So, correctly handle both the 4k and 2M collision cases by explicitly
      re-checking the radix tree for an entry at our index once we reacquire
      mapping->tree_lock.
      
      This patch has made it through a clean xfstests run with the current
      v4.11-rc5 based linux/master, and it also ran generic/340 500 times in a
      loop.  It used to fail within the first 10 iterations.
      
      Link: http://lkml.kernel.org/r/20170406212944.2866-1-ross.zwisler@linux.intel.com
      Signed-off-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
      Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: <stable@vger.kernel.org>    [4.10+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e11f8b7b
    • David Rientjes's avatar
      mm, thp: fix setting of defer+madvise thp defrag mode · 4fad7fb6
      David Rientjes authored
      Setting thp defrag mode of "defer+madvise" actually sets "defer" in the
      kernel due to the name similarity and the out-of-order way the string is
      checked in defrag_store().
      
      Check the string in the correct order so that
      TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG is set appropriately for
      "defer+madvise".
      
      Fixes: 21440d7e
      
       ("mm, thp: add new defer+madvise defrag option")
      Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1704051814420.137626@chino.kir.corp.google.com
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4fad7fb6
    • bsegall@google.com's avatar
      ptrace: fix PTRACE_LISTEN race corrupting task->state · 5402e97a
      bsegall@google.com authored
      In PT_SEIZED + LISTEN mode STOP/CONT signals cause a wakeup against
      __TASK_TRACED.  If this races with the ptrace_unfreeze_traced at the end
      of a PTRACE_LISTEN, this can wake the task /after/ the check against
      __TASK_TRACED, but before the reset of state to TASK_TRACED.  This
      causes it to instead clobber TASK_WAKING, allowing a subsequent wakeup
      against TRACED while the task is still on the rq wake_list, corrupting
      it.
      
      Oleg said:
       "The kernel can crash or this can lead to other hard-to-debug problems.
        In short, "task->state = TASK_TRACED" in ptrace_unfreeze_traced()
        assumes that nobody else can wake it up, but PTRACE_LISTEN breaks the
        contract. Obviusly it is very wrong to manipulate task->state if this
        task is already running, or WAKING, or it sleeps again"
      
      [akpm@linux-foundation.org: coding-style fixes]
      Fixes: 9899d11f
      
       ("ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL")
      Link: http://lkml.kernel.org/r/xm26y3vfhmkp.fsf_-_@bsegall-linux.mtv.corp.google.com
      Signed-off-by: default avatarBen Segall <bsegall@google.com>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5402e97a
    • Jessica Yu's avatar
      vmlinux.lds: add missing VMLINUX_SYMBOL macros · d79bf21e
      Jessica Yu authored
      
      
      When __{start,end}_ro_after_init is referenced from C code, we run into
      the following build errors on blackfin:
      
        kernel/extable.c:169: undefined reference to `__start_ro_after_init'
        kernel/extable.c:169: undefined reference to `__end_ro_after_init'
      
      The build error is due to the fact that blackfin is one of the few
      arches that prepends an underscore '_' to all symbols defined in C.
      
      Fix this by wrapping __{start,end}_ro_after_init in vmlinux.lds.h with
      VMLINUX_SYMBOL(), which adds the necessary prefix for arches that have
      HAVE_UNDERSCORE_SYMBOL_PREFIX.
      
      Link: http://lkml.kernel.org/r/1491259387-15869-1-git-send-email-jeyu@redhat.com
      Signed-off-by: default avatarJessica Yu <jeyu@redhat.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Eddie Kovsky <ewk@edkovsky.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d79bf21e
    • Alexander Polakov's avatar
      mm/page_alloc.c: fix print order in show_free_areas() · 1f06b81a
      Alexander Polakov authored
      Fixes: 11fb9989
      
       ("mm: move most file-based accounting to the node")
      Link: http://lkml.kernel.org/r/1490377730.30219.2.camel@beget.ru
      Signed-off-by: default avatarAlexander Polyakov <apolyakov@beget.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: <stable@vger.kernel.org>	[4.8+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1f06b81a
    • Mike Rapoport's avatar
      userfaultfd: report actual registered features in fdinfo · 045098e9
      Mike Rapoport authored
      
      
      fdinfo for userfault file descriptor reports UFFD_API_FEATURES.  Up
      until recently, the UFFD_API_FEATURES was defined as 0, therefore
      corresponding field in fdinfo always contained zero.  Now, with
      introduction of several additional features, UFFD_API_FEATURES is not
      longer 0 and it seems better to report actual features requested for the
      userfaultfd object described by the fdinfo.
      
      First, the applications that were using userfault will still see zero at
      the features field in fdinfo.  Next, reporting actual features rather
      than available features, gives clear indication of what userfault
      features are used by an application.
      
      Link: http://lkml.kernel.org/r/1491140181-22121-1-git-send-email-rppt@linux.vnet.ibm.com
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Reviewed-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Cc: Pavel Emelyanov <xemul@virtuozzo.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      045098e9
    • Hugh Dickins's avatar
      mm: fix page_vma_mapped_walk() for ksm pages · d75450ff
      Hugh Dickins authored
      Doug Smythies reports oops with KSM in this backtrace, I've been seeing
      the same:
      
        page_vma_mapped_walk+0xe6/0x5b0
        page_referenced_one+0x91/0x1a0
        rmap_walk_ksm+0x100/0x190
        rmap_walk+0x4f/0x60
        page_referenced+0x149/0x170
        shrink_active_list+0x1c2/0x430
        shrink_node_memcg+0x67a/0x7a0
        shrink_node+0xe1/0x320
        kswapd+0x34b/0x720
      
      Just as observed in commit 4b0ece6f ("mm: migrate: fix
      remove_migration_pte() for ksm pages"), you cannot use page->index
      calculations on ksm pages.
      
      page_vma_mapped_walk() is relying on __vma_address(), where a ksm page
      can lead it off the end of the page table, and into whatever nonsense is
      in the next page, ending as an oops inside check_pte()'s pte_page().
      
      KSM tells page_vma_mapped_walk() exactly where to look for the page, it
      does not need any page->index calculation: and that's so also for all
      the normal and file and anon pages - just not for THPs and their
      subpages.  Get out early in most cases: instead of a PageKsm test, move
      down the earlier not-THP-page test, as suggested by Kirill.
      
      I'm also slightly worried that this loop can stray into other vmas, so
      added a vm_end test to prevent surprises; though I have not imagined
      anything worse than a very contrived case, in which a page mlocked in
      the next vma might be reclaimed because it is not mlocked in this vma.
      
      Fixes: ace71a19
      
       ("mm: introduce page_vma_mapped_walk()")
      Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1704031104400.1118@eggly.anvils
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarDoug Smythies <dsmythies@telus.net>
      Tested-by: default avatarDoug Smythies <dsmythies@telus.net>
      Reviewed-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d75450ff
    • Martin Brandenburg's avatar
      orangefs: move features validation to fix filesystem hang · cefdc26e
      Martin Brandenburg authored
      
      
      Without this fix (and another to the userspace component itself
      described later), the kernel will be unable to process any OrangeFS
      requests after the userspace component is restarted (due to a crash or
      at the administrator's behest).
      
      The bug here is that inside orangefs_remount, the orangefs_request_mutex
      is locked.  When the userspace component restarts while the filesystem
      is mounted, it sends a ORANGEFS_DEV_REMOUNT_ALL ioctl to the device,
      which causes the kernel to send it a few requests aimed at synchronizing
      the state between the two.  While this is happening the
      orangefs_request_mutex is locked to prevent any other requests going
      through.
      
      This is only half of the bugfix.  The other half is in the userspace
      component which outright ignores(!) requests made before it considers
      the filesystem remounted, which is after the ioctl returns.  Of course
      the ioctl doesn't return until after the userspace component responds to
      the request it ignores.  The userspace component has been changed to
      allow ORANGEFS_VFS_OP_FEATURES regardless of the mount status.
      
      Mike Marshall says:
       "I've tested this patch against the fixed userspace part. This patch is
        real important, I hope it can make it into 4.11...
      
        Here's what happens when the userspace daemon is restarted, without
        the patch:
      
          =============================================
          [ INFO: possible recursive locking detected ]
          [   4.10.0-00007-ge98bdb3 #1 Not tainted    ]
          ---------------------------------------------
          pvfs2-client-co/29032 is trying to acquire lock:
           (orangefs_request_mutex){+.+.+.}, at: service_operation+0x3c7/0x7b0 [orangefs]
                        but task is already holding lock:
           (orangefs_request_mutex){+.+.+.}, at: dispatch_ioctl_command+0x1bf/0x330 [orangefs]
      
          CPU: 0 PID: 29032 Comm: pvfs2-client-co Not tainted 4.10.0-00007-ge98bdb3 #1
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.fc25 04/01/2014
          Call Trace:
           __lock_acquire+0x7eb/0x1290
           lock_acquire+0xe8/0x1d0
           mutex_lock_killable_nested+0x6f/0x6e0
           service_operation+0x3c7/0x7b0 [orangefs]
           orangefs_remount+0xea/0x150 [orangefs]
           dispatch_ioctl_command+0x227/0x330 [orangefs]
           orangefs_devreq_ioctl+0x29/0x70 [orangefs]
           do_vfs_ioctl+0xa3/0x6e0
           SyS_ioctl+0x79/0x90"
      
      Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
      Acked-by: default avatarMike Marshall <hubcap@omnibond.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cefdc26e
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.11-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · c2eb7bea
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - fix ThunderX legacy firmware resources
      
       - fix ARTPEC-6 and DesignWare platform driver NULL pointer dereferences
      
       - fix HiSilicon link error
      
      * tag 'pci-v4.11-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: dwc: Fix dw_pcie_ops NULL pointer dereference
        PCI: dwc: Select PCI_HOST_COMMON for hisi
        PCI: thunder-pem: Fix legacy firmware PEM-specific resources
      c2eb7bea
    • Linus Torvalds's avatar
      Merge tag 'dm-4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm · 81d4bab4
      Linus Torvalds authored
      Pull device mapper fixes from Mike Snitzer:
      
       - two stable fixes for the verity target's FEC support
      
       - a stable fix for raid target's raid1 support (when no bitmap is used)
      
       - a 4.11 cache metadata v2 format fix to properly test blocks are clean
      
      * tag 'dm-4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm verity fec: fix bufio leaks
        dm raid: fix NULL pointer dereference for raid1 without bitmap
        dm cache metadata: fix metadata2 format's blocks_are_clean_separate_dirty
        dm verity fec: limit error correction recursion
      81d4bab4
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · dc25ad3f
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "We've got a regression fix for the signal raised when userspace makes
        an unsupported unaligned access and a revert of the contiguous
        (hugepte) support for hugetlb, which has once again been found to be
        broken. One day, maybe, we'll get it right.
      
        Summary:
      
         - restore previous SIGBUS behaviour for unhandled unaligned user
           accesses
      
         - revert broken support for the contiguous bit in hugetlb (again...)"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        Revert "Revert "arm64: hugetlb: partial revert of 66b3923a""
        arm64: mm: unaligned access by user-land should be received as SIGBUS
      dc25ad3f
    • Linus Torvalds's avatar
      Merge tag 'metag-for-v4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag · 4f0d14b0
      Linus Torvalds authored
      Pull metag usercopy fixes from James Hogan:
       "Metag usercopy fault handling fixes
      
        These patches fix a bunch of longstanding (some over a decade old)
        metag user copy fault handling bugs. Thanks go to Al Viro for spotting
        some of the questionable code in the first place"
      
      * tag 'metag-for-v4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag:
        metag/usercopy: Add missing fixups
        metag/usercopy: Fix src fixup in from user rapf loops
        metag/usercopy: Set flags before ADDZ
        metag/usercopy: Zero rest of buffer from copy_from_user
        metag/usercopy: Add early abort to copy_to_user
        metag/usercopy: Fix alignment error checking
        metag/usercopy: Drop unused macros
      4f0d14b0
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 7ab66185
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "This fixes a core device enumeration code change made in 4.10, in
        order to address a reported issue, that went too far.
      
        Specifics:
      
         - Refine the check for the existence of _HID in find_child_checks()
           so that it doesn't trigger for device objects with device IDs made
           up by the kernel (Rafael Wysocki)"
      
      * tag 'acpi-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / scan: Prefer devices without _HID for _ADR matching
      7ab66185
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.11b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 50bdd7a0
      Linus Torvalds authored
      Pull Xen fix from Juergen Gross:
       "A fix for error path cleanup in the xenbus handler"
      
      * tag 'for-linus-4.11b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xenbus: remove transaction holder from list before freeing
      50bdd7a0
    • Liping Zhang's avatar
      sysctl: don't print negative flag for proc_douintvec · 5380e564
      Liping Zhang authored
      I saw some very confusing sysctl output on my system:
        # cat /proc/sys/net/core/xfrm_aevent_rseqth
        -2
        # cat /proc/sys/net/core/xfrm_aevent_etime
        -10
        # cat /proc/sys/net/ipv4/tcp_notsent_lowat
        -4294967295
      
      Because we forget to set the *negp flag in proc_douintvec, so it will
      become a garbage value.
      
      Since the value related to proc_douintvec is always an unsigned integer,
      so we can set *negp to false explictily to fix this issue.
      
      Fixes: e7d316a0
      
       ("sysctl: handle error writing UINT_MAX to u32 fields")
      Signed-off-by: default avatarLiping Zhang <zlpnobody@gmail.com>
      Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5380e564
    • Liping Zhang's avatar
      sysctl: add sanity check for proc_douintvec · 1680a386
      Liping Zhang authored
      Commit e7d316a0
      
       ("sysctl: handle error writing UINT_MAX to u32
      fields") introduced the proc_douintvec helper function, but it forgot to
      add the related sanity check when doing register_sysctl_table.  So add
      it now.
      
      Signed-off-by: default avatarLiping Zhang <zlpnobody@gmail.com>
      Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1680a386
  2. Apr 07, 2017
    • Rafael J. Wysocki's avatar
      Merge branch 'acpi-scan-fixes' · dc752d54
      Rafael J. Wysocki authored
      * acpi-scan-fixes:
        ACPI / scan: Prefer devices without _HID for _ADR matching
      dc752d54
    • Will Deacon's avatar
      Revert "Revert "arm64: hugetlb: partial revert of 66b3923a"" · 6ae979ab
      Will Deacon authored
      The use of the contiguous bit by our hugetlb implementation violates
      the break-before-make requirements of the architecture and can lead to
      silent data corruption or TLB conflict aborts. Once again, disable these
      hugetlb sizes whilst it gets worked out.
      
      This reverts commit ab2e1b89
      
      .
      
      Conflicts:
      	arch/arm64/mm/hugetlbpage.c
      
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      6ae979ab
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.11-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 269c930e
      Linus Torvalds authored
      Pull XFS fixes from Darrick Wong:
       "Here are three more fixes for 4.11.
      
        The first one reworks the inline directory verifier to check the
        working copy of the directory metadata and to avoid triggering a
        periodic crash in xfs/348. The second patch fixes a regression in hole
        punching at EOF that corrupts files; and the third patch closes a
        kernel memory disclosure bug.
      
        Summary:
      
         - rework the inline directory verifier to avoid crashes on disk
           corruption
      
         - don't change file size when punching holes w/ KEEP_SIZE
      
         - close a kernel memory exposure bug"
      
      * tag 'xfs-4.11-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: fix kernel memory exposure problems
        xfs: Honor FALLOC_FL_KEEP_SIZE when punching ends of files
        xfs: rework the inline directory verifiers
      269c930e
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · 977674c0
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
       "Lantiq:
          - Fix adding xbar resoures causing a panic
      
        Loongson3:
          - Some Loongson 3A don't identify themselves as having an FTLB so
            hardwire that knowledge into CPU probing.
          - Handle Loongson 3 TLB peculiarities in the fast path of the RDHWR
            emulation.
          - Fix invalid FTLB entries with huge page on VTLB+FTLB platforms
          - Add missing calculation of S-cache and V-cache cache-way size
      
        Ralink:
          - Fix typos in rt3883 pinctrl data
      
        Generic:
          - Force o32 fp64 support on 32bit MIPS64r6 kernels
          - Yet another build fix after the linux/sched.h changes
          - Wire up statx system call
          - Fix stack unwinding after introduction of IRQ stack
          - Fix spinlock code to build even for microMIPS with recent binutils
      
        SMP-CPS:
          - Fix retrieval of VPE mask on big endian CPUs"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: IRQ Stack: Unwind IRQ stack onto task stack
        MIPS: c-r4k: Fix Loongson-3's vcache/scache waysize calculation
        MIPS: Flush wrong invalid FTLB entry for huge page
        MIPS: Check TLB before handle_ri_rdhwr() for Loongson-3
        MIPS: Add MIPS_CPU_FTLB for Loongson-3A R2
        MIPS: Lantiq: fix missing xbar kernel panic
        MIPS: smp-cps: Fix retrieval of VPE mask on big endian CPUs
        MIPS: Wire up statx system call
        MIPS: Include asm/ptrace.h now linux/sched.h doesn't
        MIPS: ralink: Fix typos in rt3883 pinctrl
        MIPS: End spinlocks with .insn
        MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
      977674c0
    • Linus Torvalds's avatar
      Merge tag 'trace-v4.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 4691f4a6
      Linus Torvalds authored
      Pull tracing fix from Steven Rostedt:
       "Wei Yongjun fixed a long standing bug in the ring buffer startup test.
      
        If for some unknown reason, the kthread that is created fails to be
        created, the return from kthread_create() is an PTR_ERR and not a
        NULL. The test incorrectly checks for NULL instead of an error"
      
      * tag 'trace-v4.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        ring-buffer: Fix return value check in test_ringbuffer()
      4691f4a6
    • Mathias Krause's avatar
      sparc: remove unused wp_works_ok macro · 86e1066f
      Mathias Krause authored
      
      
      It's unused for ages, used to be required for ksyms.c back in the v1.1
      times.
      
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86e1066f
    • Guenter Roeck's avatar
      sparc32: Export vac_cache_size to fix build error · 9d262d95
      Guenter Roeck authored
      sparc32:allmodconfig fails to build with the following error.
      
      ERROR: "vac_cache_size" [drivers/infiniband/sw/rxe/rdma_rxe.ko] undefined!
      
      Fixes: cb886455
      
       ("infiniband: Fix alignment of mmap cookies ...")
      Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d262d95
    • Nitin Gupta's avatar
      sparc64: Fix memory corruption when THP is enabled · 76811263
      Nitin Gupta authored
      
      
      The memory corruption was happening due to incorrect
      TLB/TSB flushing of hugepages.
      
      Reported-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarNitin Gupta <nitin.m.gupta@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      76811263
    • Tom Hromatka's avatar
      sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write() · 9ae34dbd
      Tom Hromatka authored
      This commit moves sparc64's prototype of pmd_write() outside
      of the CONFIG_TRANSPARENT_HUGEPAGE ifdef.
      
      In 2013, commit a7b9403f
      
       ("sparc64: Encode huge PMDs using PTE
      encoding.") exposed a path where pmd_write() could be called without
      CONFIG_TRANSPARENT_HUGEPAGE defined.  This can result in the panic below.
      
      The diff is awkward to read, but the changes are straightforward.
      pmd_write() was moved outside of #ifdef CONFIG_TRANSPARENT_HUGEPAGE.
      Also, __HAVE_ARCH_PMD_WRITE was defined.
      
      kernel BUG at include/asm-generic/pgtable.h:576!
                    \|/ ____ \|/
                    "@'/ .. \`@"
                    /_| \__/ |_\
                       \__U_/
      oracle_8114_cdb(8114): Kernel bad sw trap 5 [#1]
      CPU: 120 PID: 8114 Comm: oracle_8114_cdb Not tainted
      4.1.12-61.7.1.el6uek.rc1.sparc64 #1
      task: fff8400700a24d60 ti: fff8400700bc4000 task.ti: fff8400700bc4000
      TSTATE: 0000004411e01607 TPC: 00000000004609f8 TNPC: 00000000004609fc Y:
      00000005    Not tainted
      TPC: <gup_huge_pmd+0x198/0x1e0>
      g0: 000000000001c000 g1: 0000000000ef3954 g2: 0000000000000000 g3: 0000000000000001
      g4: fff8400700a24d60 g5: fff8001fa5c10000 g6: fff8400700bc4000 g7: 0000000000000720
      o0: 0000000000bc5058 o1: 0000000000000240 o2: 0000000000006000 o3: 0000000000001c00
      o4: 0000000000000000 o5: 0000048000080000 sp: fff8400700bc6ab1 ret_pc: 00000000004609f0
      RPC: <gup_huge_pmd+0x190/0x1e0>
      l0: fff8400700bc74fc l1: 0000000000020000 l2: 0000000000002000 l3: 0000000000000000
      l4: fff8001f93250950 l5: 000000000113f800 l6: 0000000000000004 l7: 0000000000000000
      i0: fff8400700ca46a0 i1: bd0000085e800453 i2: 000000026a0c4000 i3: 000000026a0c6000
      i4: 0000000000000001 i5: fff800070c958de8 i6: fff8400700bc6b61 i7: 0000000000460dd0
      I7: <gup_pud_range+0x170/0x1a0>
      Call Trace:
       [0000000000460dd0] gup_pud_range+0x170/0x1a0
       [0000000000460e84] get_user_pages_fast+0x84/0x120
       [00000000006f5a18] iov_iter_get_pages+0x98/0x240
       [00000000005fa744] do_direct_IO+0xf64/0x1e00
       [00000000005fbbc0] __blockdev_direct_IO+0x360/0x15a0
       [00000000101f74fc] ext4_ind_direct_IO+0xdc/0x400 [ext4]
       [00000000101af690] ext4_ext_direct_IO+0x1d0/0x2c0 [ext4]
       [00000000101af86c] ext4_direct_IO+0xec/0x220 [ext4]
       [0000000000553bd4] generic_file_read_iter+0x114/0x140
       [00000000005bdc2c] __vfs_read+0xac/0x100
       [00000000005bf254] vfs_read+0x54/0x100
       [00000000005bf368] SyS_pread64+0x68/0x80
      
      Signed-off-by: default avatarTom Hromatka <tom.hromatka@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ae34dbd
  3. Apr 06, 2017
    • Radim Krčmář's avatar
      Merge branch 'kvm-ppc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc · 8786fa66
      Radim Krčmář authored
      From: Paul Mackerras <paulus@ozlabs.org>
      
      A check for a NULL return from kzalloc in recently-added code.
      8786fa66
    • Dan Carpenter's avatar
      KVM: PPC: Book3S HV: Check for kmalloc errors in ioctl · abd80dcb
      Dan Carpenter authored
      
      
      kzalloc() won't actually fail because sizeof(*resize) is small, but
      static checkers complain.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
      abd80dcb
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · ea6b1720
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Reject invalid updates to netfilter expectation policies, from Pablo
          Neira Ayuso.
      
       2) Fix memory leak in nfnl_cthelper, from Jeffy Chen.
      
       3) Don't do stupid things if we get a neigh_probe() on a neigh entry
          whose ops lack a solicit method. From Eric Dumazet.
      
       4) Don't transmit packets in r8152 driver when the carrier is off, from
          Hayes Wang.
      
       5) Fix ipv6 packet type detection in aquantia driver, from Pavel
          Belous.
      
       6) Don't write uninitialized data into hw registers in bna driver, from
          Arnd Bergmann.
      
       7) Fix locking in ping_unhash(), from Eric Dumazet.
      
       8) Make BPF verifier range checks able to understand certain sequences
          emitted by LLVM, from Alexei Starovoitov.
      
       9) Fix use after free in ipconfig, from Mark Rutland.
      
      10) Fix refcount leak on force commit in openvswitch, from Jarno
          Rajahalme.
      
      11) Fix various overflow checks in AF_PACKET, from Andrey Konovalov.
      
      12) Fix endianness bug in be2net driver, from Suresh Reddy.
      
      13) Don't forget to wake TX queues when processing a timeout, from
          Grygorii Strashko.
      
      14) ARP header on-stack storage is wrong in flow dissector, from Simon
          Horman.
      
      15) Lost retransmit and reordering SNMP stats in TCP can be
          underreported. From Yuchung Cheng.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (82 commits)
        nfp: fix potential use after free on xdp prog
        tcp: fix reordering SNMP under-counting
        tcp: fix lost retransmit SNMP under-counting
        sctp: get sock from transport in sctp_transport_update_pmtu
        net: ethernet: ti: cpsw: fix race condition during open()
        l2tp: fix PPP pseudo-wire auto-loading
        bnx2x: fix spelling mistake in macros HW_INTERRUT_ASSERT_SET_*
        l2tp: take reference on sessions being dumped
        tcp: minimize false-positives on TCP/GRO check
        sctp: check for dst and pathmtu update in sctp_packet_config
        flow dissector: correct size of storage for ARP
        net: ethernet: ti: cpsw: wake tx queues on ndo_tx_timeout
        l2tp: take a reference on sessions used in genetlink handlers
        l2tp: hold session while sending creation notifications
        l2tp: fix duplicate session creation
        l2tp: ensure session can't get removed during pppol2tp_session_ioctl()
        l2tp: fix race in l2tp_recv_common()
        sctp: use right in and out stream cnt
        bpf: add various verifier test cases for self-tests
        bpf, verifier: fix rejection of unaligned access checks for map_value_adj
        ...
      ea6b1720
    • Jakub Kicinski's avatar
      nfp: fix potential use after free on xdp prog · c383bdd1
      Jakub Kicinski authored
      We should unregister the net_device first, before we give back
      our reference on xdp_prog.  Otherwise xdp_prog may be freed
      before .ndo_stop() disabled the datapath.  Found by code inspection.
      
      Fixes: ecd63a02
      
       ("nfp: add XDP support in the driver")
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c383bdd1
    • Yuchung Cheng's avatar
      tcp: fix reordering SNMP under-counting · 2d2517ee
      Yuchung Cheng authored
      
      
      Currently the reordering SNMP counters only increase if a connection
      sees a higher degree then it has previously seen. It ignores if the
      reordering degree is not greater than the default system threshold.
      This significantly under-counts the number of reordering events
      and falsely convey that reordering is rare on the network.
      
      This patch properly and faithfully records the number of reordering
      events detected by the TCP stack, just like the comment says "this
      exciting event is worth to be remembered". Note that even so TCP
      still under-estimate the actual reordering events because TCP
      requires TS options or certain packet sequences to detect reordering
      (i.e. ACKing never-retransmitted sequence in recovery or disordered
       state).
      
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d2517ee
    • Yuchung Cheng's avatar
      tcp: fix lost retransmit SNMP under-counting · ecde8f36
      Yuchung Cheng authored
      The lost retransmit SNMP stat is under-counting retransmission
      that uses segment offloading. This patch fixes that so all
      retransmission related SNMP counters are consistent.
      
      Fixes: 10d3be56
      
       ("tcp-tso: do not split TSO packets at retransmit time")
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ecde8f36
    • Linus Torvalds's avatar
      Merge tag 'mfd-fixes-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd · aeb4a576
      Linus Torvalds authored
      Pull MFD bug fix from Lee Jones:
       "Increase buffer size om cros-ec to allow for SPI messages"
      
      * tag 'mfd-fixes-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
        mfd: cros-ec: Fix host command buffer size
      aeb4a576
  4. Apr 05, 2017
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v4.11' of... · 9f0bffa1
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - hand-off primary maintainership of Kbuild
      
       - fix build warnings
      
       - fix build error when GCOV is enabled with old compiler
      
       - fix HAVE_ASM_GOTO check when GCC plugin is enabled
      
      * tag 'kbuild-fixes-v4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        gconfig: remove misleading parentheses around a condition
        jump label: fix passing kbuild_cflags when checking for asm goto support
        Kbuild: use cc-disable-warning consistently for maybe-uninitialized
        kbuild: external module build warnings when KBUILD_OUTPUT set and W=1
        MAINTAINERS: add Masahiro Yamada as a Kbuild maintainer
      9f0bffa1