mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
uprobes: __replace_page() avoid BUG in munlock_vma_page()
commitc17c3dc9d0upstream. 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:5a52c9df62("uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT") Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Song Liu <songliubraving@fb.com> Acked-by: Oleg Nesterov <oleg@redhat.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: <stable@vger.kernel.org> [5.4+] Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2008161338360.20413@eggly.anvils Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fa2e0d4e4a
commit
e9e3ec03e6
@@ -211,7 +211,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
try_to_free_swap(old_page);
|
||||
page_vma_mapped_walk_done(&pvmw);
|
||||
|
||||
if (vma->vm_flags & VM_LOCKED)
|
||||
if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
|
||||
munlock_vma_page(old_page);
|
||||
put_page(old_page);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user