Re: [PATCH -next v2] uprobes: fix two zero old_folio bugs in __replace_page()

From: Oleg Nesterov
Date: Fri Feb 21 2025 - 10:36:36 EST


On 02/21, Tong Tiangen wrote:
>
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -506,6 +506,11 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
> if (ret <= 0)
> goto put_old;
>
> + if (is_zero_page(old_page)) {
> + ret = -EINVAL;
> + goto put_old;
> + }

I agree with David, the subject looks a bit misleading.

And. I won't insist, this is cosmetic, but if you send V2 please consider
moving the "verify_opcode()" check down, after the is_zero_page/PageCompound
checks.

Oleg.