Skip to content

Commit c17c3dc

Browse files
Hugh Dickinstorvalds
authored andcommitted
uprobes: __replace_page() avoid BUG in munlock_vma_page()
syzbot crashed on the VM_BUG_ON_PAGE(PageTail) in munlock_vma_page(), when called from uprobes __replace_page(). Which of many ways to fix it? Settled on not calling when PageCompound (since Head and Tail are equals in this context, PageCompound the usual check in uprobes.c, and the prior use of FOLL_SPLIT_PMD will have cleared PageMlocked already). Fixes: 5a52c9d ("uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT") Reported-by: syzbot <[email protected]> Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Srikar Dronamraju <[email protected]> Acked-by: Song Liu <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: <[email protected]> [5.4+] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 71e8432 commit c17c3dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/events/uprobes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
205205
try_to_free_swap(old_page);
206206
page_vma_mapped_walk_done(&pvmw);
207207

208-
if (vma->vm_flags & VM_LOCKED)
208+
if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
209209
munlock_vma_page(old_page);
210210
put_page(old_page);
211211

0 commit comments

Comments
 (0)