[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aOjQ7qDy3l85dn7A@milan>
Date: Fri, 10 Oct 2025 11:25:02 +0200
From: Uladzislau Rezki <urezki@...il.com>
To: Yadong Qi <yadong.qi@...ux.alibaba.com>
Cc: Yadong Qi <yadong.qi@...ux.alibaba.com>, akpm@...ux-foundation.org,
urezki@...il.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
ying.huang@...ux.alibaba.com
Subject: Re: [PATCH v4] mm: vmalloc: WARN_ON if mapping size is not PAGE_SIZE
aligned
On Fri, Oct 10, 2025 at 11:16:27AM +0530, Dev Jain wrote:
>
> On 10/10/25 7:13 am, Yadong Qi wrote:
> > In mm/vmalloc.c, the function vmap_pte_range() assumes that the
> > mapping size is aligned to PAGE_SIZE. If this assumption is
> > violated, the loop will become infinite because the termination
> > condition (`addr != end`) will never be met. This can lead to
> > overwriting other VA ranges and/or random pages physically follow
> > the page table.
> >
> > It's the caller's responsibility to ensure that the mapping size
> > is aligned to PAGE_SIZE. However, the memory corruption is hard
> > to root cause. To identify the programming error in the caller
> > easier, check whether the mapping size is PAGE_SIZE aligned with
> > WARN_ON_ONCE().
> >
> > Signed-off-by: Yadong Qi <yadong.qi@...ux.alibaba.com>
> > Reviewed-by: Huang Ying <ying.huang@...ux.alibaba.com>
> > ---
>
> This should work.
>
> Reviewed-by: Dev Jain <dev.jain@....com>
>
LGTM,
Reviewed-by: Uladzislau Rezki (Sony) <urezki@...il.com>
--
Uladzislau Rezki
Powered by blists - more mailing lists