1. 26 Sep, 2020 3 commits
    • Minchan Kim's avatar
      mm: validate pmd after splitting · ce268425
      Minchan Kim authored
      syzbot reported the following KASAN splat:
      
        general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
        KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
        CPU: 1 PID: 6826 Comm: syz-executor142 Not tainted 5.9.0-rc4-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        RIP: 0010:__lock_acquire+0x84/0x2ae0 kernel/locking/lockdep.c:4296
        Code: ff df 8a 04 30 84 c0 0f 85 e3 16 00 00 83 3d 56 58 35 08 00 0f 84 0e 17 00 00 83 3d 25 c7 f5 07 00 74 2c 4c 89 e8 48 c1 e8 03 <80> 3c 30 00 74 12 4c 89 ef e8 3e d1 5a 00 48 be 00 00 00 00 00 fc
        RSP: 0018:ffffc90004b9f850 EFLAGS: 00010006
        Call Trace:
          lock_acquire+0x140/0x6f0 kernel/locking/lockdep.c:5006
          __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
          _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151
          spin_lock include/linux/spinlock.h:354 [inline]
          madvise_cold_or_pageout_pte_range+0x52f/0x25c0 mm/madvise.c:389
          walk_pmd_range mm/pagewalk.c:89 [inline]
          walk_pud_range mm/pagewalk.c:160 [inline]
          walk_p4d_range mm/pagewalk.c:193 [inline]
          walk_pgd_range mm/pagewalk.c:229 [inline]
          __walk_page_range+0xe7b/0x1da0 mm/pagewalk.c:331
          walk_page_range+0x2c3/0x5c0 mm/pagewalk.c:427
          madvise_pageout_page_range mm/madvise.c:521 [inline]
          madvise_pageout mm/madvise.c:557 [inline]
          madvise_vma mm/madvise.c:946 [inline]
          do_madvise+0x12d0/0x2090 mm/madvise.c:1145
          __do_sys_madvise mm/madvise.c:1171 [inline]
          __se_sys_madvise mm/madvise.c:1169 [inline]
          __x64_sys_madvise+0x76/0x80 mm/madvise.c:1169
          do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
          entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      The backing vma was shmem.
      
      In case of split page of file-backed THP, madvise zaps the pmd instead
      of remapping of sub-pages.  So we need to check pmd validity after
      split.
      
      Reported-by: syzbot+ecf80462cb7d5d552bc7@syzkaller.appspotmail.com
      Fixes: 1a4e58cc ("mm: introduce MADV_PAGEOUT")
      Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ce268425
    • Shakeel Butt's avatar
      mm: slab: fix potential double free in ___cache_free · 678ff6a7
      Shakeel Butt authored
      With the commit 10befea9 ("mm: memcg/slab: use a single set of
      kmem_caches for all allocations"), it becomes possible to call kfree()
      from the slabs_destroy().
      
      The functions cache_flusharray() and do_drain() calls slabs_destroy() on
      array_cache of the local CPU without updating the size of the
      array_cache.  This enables the kfree() call from the slabs_destroy() to
      recursively call cache_flusharray() which can potentially call
      free_block() on the same elements of the array_cache of the local CPU
      and causing double free and memory corruption.
      
      To fix the issue, simply update the local CPU array_cache cache before
      calling slabs_destroy().
      
      Fixes: 10befea9 ("mm: memcg/slab: use a single set of kmem_caches for all allocations")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Reviewed-by: default avatarRoman Gushchin <guro@fb.com>
      Tested-by: default avatarMing Lei <ming.lei@redhat.com>
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Ted Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      678ff6a7
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 7c7ec322
      Linus Torvalds authored
      Pull more kvm fixes from Paolo Bonzini:
       "Five small fixes.
      
        The nested migration bug will be fixed with a better API in 5.10 or
        5.11, for now this is a fix that works with existing userspace but
        keeps the current ugly API"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: SVM: Add a dedicated INVD intercept routine
        KVM: x86: Reset MMU context if guest toggles CR4.SMAP or CR4.PKE
        KVM: x86: fix MSR_IA32_TSC read for nested migration
        selftests: kvm: Fix assert failure in single-step test
        KVM: x86: VMX: Make smaller physical guest address space support user-configurable
      7c7ec322
  2. 25 Sep, 2020 15 commits
  3. 24 Sep, 2020 6 commits
  4. 23 Sep, 2020 16 commits