The patch titled Subject: uprobes: split THPs before trying replace them has been added to the -mm tree. Its filename is uprobes-split-thps-before-trying-replace-them.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/uprobes-split-thps-before-trying-replace-them.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/uprobes-split-thps-before-trying-replace-them.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Subject: uprobes: split THPs before trying replace them For THPs page_check_address() always fails. It leads to endless loop in uprobe_write_opcode(). Testcase with huge-tmpfs (uprobes cannot probe anonymous memory). mount -t debugfs none /sys/kernel/debug mount -t tmpfs -o huge=always none /mnt gcc -Wall -O2 -o /mnt/test -x c - <<EOF int main(void) { return 0; } /* Padding to map the code segment with huge pmd */ asm (".zero 2097152"); EOF echo 'p /mnt/test:0' > /sys/kernel/debug/tracing/uprobe_events echo 1 > /sys/kernel/debug/tracing/events/uprobes/enable /mnt/test Let's split THPs before trying to replace. Link: http://lkml.kernel.org/r/20170129173858.45174-2-kirill.shutemov@xxxxxxxxxxxxxxx Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/events/uprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN kernel/events/uprobes.c~uprobes-split-thps-before-trying-replace-them kernel/events/uprobes.c --- a/kernel/events/uprobes.c~uprobes-split-thps-before-trying-replace-them +++ a/kernel/events/uprobes.c @@ -300,8 +300,8 @@ int uprobe_write_opcode(struct mm_struct retry: /* Read the page with vaddr into memory */ - ret = get_user_pages_remote(NULL, mm, vaddr, 1, FOLL_FORCE, &old_page, - &vma, NULL); + ret = get_user_pages_remote(NULL, mm, vaddr, 1, + FOLL_FORCE | FOLL_SPLIT, &old_page, &vma, NULL); if (ret <= 0) return ret; _ Patches currently in -mm which might be from kirill.shutemov@xxxxxxxxxxxxxxx are mm-sleeping-function-called-from-invalid-context-shmem_undo_range.patch mm-drop-zap_details-ignore_dirty.patch mm-drop-zap_details-check_swap_entries.patch mm-drop-unused-argument-of-zap_page_range.patch oom-reaper-use-madvise_dontneed-logic-to-decide-if-unmap-the-vma.patch uprobes-split-thps-before-trying-replace-them.patch mm-introduce-page_vma_mapped_walk.patch mm-fix-handling-pte-mapped-thps-in-page_referenced.patch mm-fix-handling-pte-mapped-thps-in-page_idle_clear_pte_refs.patch mm-rmap-check-all-vmas-that-pte-mapped-thp-can-be-part-of.patch mm-convert-page_mkclean_one-to-use-page_vma_mapped_walk.patch mm-convert-try_to_unmap_one-to-use-page_vma_mapped_walk.patch mm-ksm-convert-write_protect_page-to-use-page_vma_mapped_walk.patch mm-uprobes-convert-__replace_page-to-use-page_vma_mapped_walk.patch mm-convert-page_mapped_in_vma-to-use-page_vma_mapped_walk.patch mm-drop-page_check_address_transhuge.patch mm-convert-remove_migration_pte-to-use-page_vma_mapped_walk.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html