Skip to contentSkip to conversation

khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch removed from -mm tree

merged [email protected] 1 participant 1 message Aug 22, 2020 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()
has been removed from the -mm tree. Its filename was
khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()

syzbot crashes on the VM_BUG_ON_MM(khugepaged_test_exit(mm), mm) in __khugepaged_enter(): yes, when one thread is about to dump core, has set core_state, and is waiting for others, another might do something calling __khugepaged_enter(), which now crashes because I lumped the core_state test (known as "mmget_still_valid") into khugepaged_test_exit(). I still think it's best to lump them together, so just in this exceptional case, check mm->mm_users directly instead of khugepaged_test_exit().

Fixes bbe98f9cadff ("khugepaged: khugepaged_test_exit() check mmget_still_valid()")
Cc "Kirill A. Shutemov" <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Song Liu <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc <[email protected]> [4.8+]

---

 mm/khugepaged.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/khugepaged.c renamed from mm/khugepaged.c~khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter +1 -1
@@ -466,7 +466,7 @@ int __khugepaged_enter(struct mm_struct
 		return -ENOMEM;
 
 	/* __khugepaged_exit() must not run from under us */
-	VM_BUG_ON_MM(khugepaged_test_exit(mm), mm);
+	VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm);
 	if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) {
 		free_mm_slot(mm_slot);
 		return 0;

_

Patches currently in -mm which might be from [email protected] are