[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f63931b5-00ac-4bb0-9e95-4b3aa2131ffa@arm.com>
Date: Mon, 9 Jun 2025 12:04:43 +0100
From: Ryan Roberts <ryan.roberts@....com>
To: Barry Song <21cnbao@...il.com>, lorenzo.stoakes@...cle.com,
akpm@...ux-foundation.org
Cc: Liam.Howlett@...cle.com, anshuman.khandual@....com, david@...hat.com,
dev.jain@....com, jannh@...gle.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, lokeshgidra@...gle.com, osalvador@...e.de,
surenb@...gle.com, v-songbaohua@...o.com, vbabka@...e.cz,
zhengtangquan@...o.com
Subject: Re: [PATCH v2] mm: madvise: use walk_page_range_vma() instead of
walk_page_range()
On 09/06/2025 11:55, Barry Song wrote:
>> Yeah dear god I missed this oops!
>>
>> Yeah Barry - could you revert this change for the guard region bits please? So
>> this is intentional as we do not want anything non-mm to have access to
>> install_pte.
>
> All my fault! I wrote a multi-process/thread test to issue lots of madvise
> calls, but it looks like I missed INSTALL_GUARD.
>
> Thanks, Ryan & Lorenzo! Does Andrew prefer to pick up the fix below, or
> would it be better to send a new version? He’s handled fixes like this in
> the past—happy to resend if needed.
>
> From: Barry Song <v-songbaohua@...o.com>
> Date: Mon, 9 Jun 2025 22:42:13 +1200
> Subject: [PATCH] mm: madvise: revert the walk_page_range_vma change for
> MADV_GUARD_INSTALL
>
> Fix the broken MADV_GUARD_INSTALL reported by Ryan.
> # guard-regions.c:719:split_merge:Expected madvise(ptr, 10 * page_size,
> MADV_GUARD_INSTALL) (-1) == 0 (0)
>
> Reported-by: Ryan Roberts <ryan.roberts@....com>
> Closes: https://lore.kernel.org/linux-mm/671f8164-a90b-48d7-9446-359eb9493500@arm.com/
> Signed-off-by: Barry Song <v-songbaohua@...o.com>
FWIW, the rest of the original patch looks good to me, ands this fix looks
correct, so:
Reviewed-by: Ryan Roberts <ryan.roberts@....com>
> ---
> mm/madvise.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 8382614b71d1..381eedde8f6d 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1141,7 +1141,7 @@ static long madvise_guard_install(struct vm_area_struct *vma,
> unsigned long nr_pages = 0;
>
> /* Returns < 0 on error, == 0 if success, > 0 if zap needed. */
> - err = walk_page_range_vma(vma, start, end,
> + err = walk_page_range_mm(vma->vm_mm, start, end,
> &guard_install_walk_ops, &nr_pages);
> if (err < 0)
> return err;
Powered by blists - more mailing lists