1. 10 Jul, 2024 21 commits
  2. 09 Jul, 2024 8 commits
    • Miaohe Lin's avatar
      mm/hugetlb: fix kernel NULL pointer dereference when migrating hugetlb folio · f708f697
      Miaohe Lin authored
      A kernel crash was observed when migrating hugetlb folio:
      
      BUG: kernel NULL pointer dereference, address: 0000000000000008
      PGD 0 P4D 0
      Oops: Oops: 0002 [#1] PREEMPT SMP NOPTI
      CPU: 0 PID: 3435 Comm: bash Not tainted 6.10.0-rc6-00450-g8578ca01f21f #66
      RIP: 0010:__folio_undo_large_rmappable+0x70/0xb0
      RSP: 0018:ffffb165c98a7b38 EFLAGS: 00000097
      RAX: fffffbbc44528090 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffffa30e000a2800 RSI: 0000000000000246 RDI: ffffa3153ffffcc0
      RBP: fffffbbc44528000 R08: 0000000000002371 R09: ffffffffbe4e5868
      R10: 0000000000000001 R11: 0000000000000001 R12: ffffa3153ffffcc0
      R13: fffffbbc44468000 R14: 0000000000000001 R15: 0000000000000001
      FS:  00007f5b3a716740(0000) GS:ffffa3151fc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000008 CR3: 000000010959a000 CR4: 00000000000006f0
      Call Trace:
       <TASK>
       __folio_migrate_mapping+0x59e/0x950
       __migrate_folio.constprop.0+0x5f/0x120
       move_to_new_folio+0xfd/0x250
       migrate_pages+0x383/0xd70
       soft_offline_page+0x2ab/0x7f0
       soft_offline_page_store+0x52/0x90
       kernfs_fop_write_iter+0x12c/0x1d0
       vfs_write+0x380/0x540
       ksys_write+0x64/0xe0
       do_syscall_64+0xb9/0x1d0
       entry_SYSCALL_64_after_hwframe+0x77/0x7f
      RIP: 0033:0x7f5b3a514887
      RSP: 002b:00007ffe138fce68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f5b3a514887
      RDX: 000000000000000c RSI: 0000556ab809ee10 RDI: 0000000000000001
      RBP: 0000556ab809ee10 R08: 00007f5b3a5d1460 R09: 000000007fffffff
      R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000c
      R13: 00007f5b3a61b780 R14: 00007f5b3a617600 R15: 00007f5b3a616a00
      
      It's because hugetlb folio is passed to __folio_undo_large_rmappable()
      unexpectedly.  large_rmappable flag is imperceptibly set to hugetlb folio
      since commit f6a8dd98 ("hugetlb: convert alloc_buddy_hugetlb_folio to
      use a folio").  Then commit be9581ea ("mm: fix crashes from deferred
      split racing folio migration") makes folio_migrate_mapping() call
      folio_undo_large_rmappable() triggering the bug.  Fix this issue by
      clearing large_rmappable flag for hugetlb folios.  They don't need that
      flag set anyway.
      
      Link: https://lkml.kernel.org/r/20240709120433.4136700-1-linmiaohe@huawei.com
      Fixes: f6a8dd98 ("hugetlb: convert alloc_buddy_hugetlb_folio to use a folio")
      Fixes: be9581ea ("mm: fix crashes from deferred split racing folio migration")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Muchun Song <muchun.song@linux.dev>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      f708f697
    • Miaohe Lin's avatar
      mm/hugetlb: fix potential race in __update_and_free_hugetlb_folio() · 5596d9e8
      Miaohe Lin authored
      There is a potential race between __update_and_free_hugetlb_folio() and
      try_memory_failure_hugetlb():
      
       CPU1					CPU2
       __update_and_free_hugetlb_folio	try_memory_failure_hugetlb
      					 folio_test_hugetlb
      					  -- It's still hugetlb folio.
        folio_clear_hugetlb_hwpoison
        					  spin_lock_irq(&hugetlb_lock);
      					   __get_huge_page_for_hwpoison
      					    folio_set_hugetlb_hwpoison
      					  spin_unlock_irq(&hugetlb_lock);
        spin_lock_irq(&hugetlb_lock);
        __folio_clear_hugetlb(folio);
         -- Hugetlb flag is cleared but too late.
        spin_unlock_irq(&hugetlb_lock);
      
      When the above race occurs, raw error page info will be leaked.  Even
      worse, raw error pages won't have hwpoisoned flag set and hit
      pcplists/buddy.  Fix this issue by deferring
      folio_clear_hugetlb_hwpoison() until __folio_clear_hugetlb() is done.  So
      all raw error pages will have hwpoisoned flag set.
      
      Link: https://lkml.kernel.org/r/20240708025127.107713-1-linmiaohe@huawei.com
      Fixes: 32c87719 ("hugetlb: do not clear hugetlb dtor until allocating vmemmap")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Acked-by: default avatarMuchun Song <muchun.song@linux.dev>
      Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      5596d9e8
    • ZhangPeng's avatar
      filemap: replace pte_offset_map() with pte_offset_map_nolock() · 24be02a4
      ZhangPeng authored
      The vmf->ptl in filemap_fault_recheck_pte_none() is still set from
      handle_pte_fault().  But at the same time, we did a pte_unmap(vmf->pte). 
      After a pte_unmap(vmf->pte) unmap and rcu_read_unlock(), the page table
      may be racily changed and vmf->ptl maybe fails to protect the actual page
      table.  Fix this by replacing pte_offset_map() with
      pte_offset_map_nolock().
      
      As David said, the PTL pointer might be stale so if we continue to use
      it infilemap_fault_recheck_pte_none(), it might trigger UAF.  Also, if
      the PTL fails, the issue fixed by commit 58f327f2 ("filemap: avoid
      unnecessary major faults in filemap_fault()") might reappear.
      
      Link: https://lkml.kernel.org/r/20240313012913.2395414-1-zhangpeng362@huawei.com
      Fixes: 58f327f2 ("filemap: avoid unnecessary major faults in filemap_fault()")
      Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
      Suggested-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Nanyong Sun <sunnanyong@huawei.com>
      Cc: Yang Shi <shy828301@gmail.com>
      Cc: Yin Fengwei <fengwei.yin@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      24be02a4
    • Suren Baghdasaryan's avatar
      arch/xtensa: always_inline get_current() and current_thread_info() · 86e50ab6
      Suren Baghdasaryan authored
      Mark get_current() and current_thread_info() functions as always_inline to
      fix the following modpost warning:
      
      WARNING: modpost: vmlinux: section mismatch in reference: get_current+0xc (section: .text.unlikely) -> initcall_level_names (section: .init.data)
      
      The warning happens when these functions are called from an __init
      function and they don't get inlined (remain in the .text section) while
      the value they return points into .init.data section.  Assuming
      get_current() always returns a valid address, this situation can happen
      only during init stage and accessing .init.data from .text section during
      that stage should pose no issues.
      
      Link: https://lkml.kernel.org/r/20240704132506.1011978-2-surenb@google.com
      Fixes: 22d407b1 ("lib: add allocation tagging support for memory allocation profiling")
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Cc: Kent Overstreet <kent.overstreet@linux.dev>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: kernel test robot <lkp@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      86e50ab6
    • Suren Baghdasaryan's avatar
      sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings · 5a5aa3c3
      Suren Baghdasaryan authored
      Mark alloc_tag_{save|restore} as always_inline to fix the following
      modpost warnings:
      
      WARNING: modpost: vmlinux: section mismatch in reference: alloc_tag_save+0x1c (section: .text.unlikely) -> initcall_level_names (section: .init.data)
      WARNING: modpost: vmlinux: section mismatch in reference: alloc_tag_restore+0x3c (section: .text.unlikely) -> initcall_level_names (section: .init.data)
      
      The warnings happen when these functions are called from an __init
      function and they don't get inlined (remain in the .text section) while
      the value returned by get_current() points into .init.data section. 
      Assuming get_current() always returns a valid address, this situation can
      happen only during init stage and accessing .init.data from .text section
      during that stage should pose no issues.
      
      Link: https://lkml.kernel.org/r/20240704132506.1011978-1-surenb@google.com
      Fixes: 22d407b1 ("lib: add allocation tagging support for memory allocation profiling")
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202407032306.gi9nZsBi-lkp@intel.com/
      Cc: Kent Overstreet <kent.overstreet@linux.dev>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      5a5aa3c3
    • Linus Torvalds's avatar
      Merge tag '6.10-rc6-smb3-server-fixes' of git://git.samba.org/ksmbd · 34afb82a
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
      
       - fix access flags to address fuse incompatibility
      
       - fix device type returned by get filesystem info
      
      * tag '6.10-rc6-smb3-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: discard write access to the directory open
        ksmbd: return FILE_DEVICE_DISK instead of super magic
      34afb82a
    • Linus Torvalds's avatar
      Merge tag 'linux_kselftest-fixes-6.10' of... · 920bc844
      Linus Torvalds authored
      Merge tag 'linux_kselftest-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest fixes from Shuah Khan
       "Fixes to clang build failures to timerns, vDSO tests and fixes to vDSO
        makefile"
      
      * tag 'linux_kselftest-fixes-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/vDSO: remove duplicate compiler invocations from Makefile
        selftests/vDSO: remove partially duplicated "all:" target in Makefile
        selftests/vDSO: fix clang build errors and warnings
        selftest/timerns: fix clang build failures for abs() calls
      920bc844
    • Heiko Carstens's avatar
      s390/mm: Add NULL pointer check to crst_table_free() base_crst_free() · b5efb63a
      Heiko Carstens authored
      crst_table_free() used to work with NULL pointers before the conversion
      to ptdescs.  Since crst_table_free() can be called with a NULL pointer
      (error handling in crst_table_upgrade() add an explicit check.
      
      Also add the same check to base_crst_free() for consistency reasons.
      
      In real life this should not happen, since order two GFP_KERNEL
      allocations will not fail, unless FAIL_PAGE_ALLOC is enabled and used.
      Reported-by: default avatarYunseong Kim <yskelg@gmail.com>
      Fixes: 6326c26c ("s390: convert various pgalloc functions to use ptdescs")
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b5efb63a
  3. 08 Jul, 2024 5 commits
  4. 07 Jul, 2024 3 commits
    • Linus Torvalds's avatar
      Linux 6.10-rc7 · 256abd8e
      Linus Torvalds authored
      256abd8e
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 5a4bd506
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A set of clk fixes for the Qualcomm, Mediatek, and Allwinner drivers:
      
         - Fix the Qualcomm Stromer Plus PLL set_rate() clk_op to explicitly
           set the alpha enable bit and not set bits that don't exist
      
         - Mark Qualcomm IPQ9574 crypto clks as voted to avoid stuck clk
           warnings
      
         - Fix the parent of some PLLs on Qualcomm sm6530 so their rate is
           correct
      
         - Fix the min/max rate clamping logic in the Allwinner driver that
           got broken in v6.9
      
         - Limit runtime PM enabling in the Mediatek driver to only
           mt8183-mfgcfg so that system wide resume doesn't break on other
           Mediatek SoCs"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mediatek: mt8183: Only enable runtime PM on mt8183-mfgcfg
        clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common
        clk: qcom: gcc-ipq9574: Add BRANCH_HALT_VOTED flag
        clk: qcom: apss-ipq-pll: remove 'config_ctl_hi_val' from Stromer pll configs
        clk: qcom: clk-alpha-pll: set ALPHA_EN bit for Stromer Plus PLLs
        clk: qcom: gcc-sm6350: Fix gpll6* & gpll7 parents
      5a4bd506
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · c6653f49
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix unnecessary copy to 0 when kernel is booted at address 0
      
       - Fix usercopy crash when dumping dtl via debugfs
      
       - Avoid possible crash when PCI hotplug races with error handling
      
       - Fix kexec crash caused by scv being disabled before other CPUs
         call-in
      
       - Fix powerpc selftests build with USERCFLAGS set
      
      Thanks to Anjali K, Ganesh Goudar, Gautam Menghani, Jinglin Wen,
      Nicholas Piggin, Sourabh Jain, Srikar Dronamraju, and Vishal Chourasia.
      
      * tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        selftests/powerpc: Fix build with USERCFLAGS set
        powerpc/pseries: Fix scv instruction crash with kexec
        powerpc/eeh: avoid possible crash when edev->pdev changes
        powerpc/pseries: Whitelist dtl slub object for copying to userspace
        powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0
      c6653f49
  5. 06 Jul, 2024 3 commits