
From: Chen Zhongjin <chenzhongjin@huawei.com> hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICJG91 -------------------------------- In uprobe unregister, if the old_page is a compound page, it will trigger a warning and cause the unregister operation to fail: "uprobe unregister should never work on compound page" If old_page is allocated by uprobe through alloc_page_vma(), this page cannot be compounded, so this warning means old_page is a remapped page after register. In this scenario, check PageAnon() first to determine whether the page is a remapped page. Just pass the PageCompound() check and unregister uprobe safely. Fixes: aa5de305c90c ("kernel/events/uprobes.c: only do FOLL_SPLIT_PMD for uprobe register") Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com> Signed-off-by: Tengda Wu <wutengda2@huawei.com> --- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 8a6c5ee003c2..e51dbb0e8a56 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -493,7 +493,7 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, goto put_old; } - if (WARN(!is_register && PageCompound(old_page), + if (WARN(!is_register && PageAnon(old_page) && PageCompound(old_page), "uprobe unregister should never work on compound page\n")) { ret = -EINVAL; goto put_old; -- 2.34.1