mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Ye Liu <ye.liu@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, Ye Liu <liuye@kylinos.cn>
Subject: Re: [PATCH v2 1/3] mm/vmalloc: fix vmalloc_dump_obj address alignment for last-page lookups
Date: Tue, 22 Sep 2026 14:17:02 +0200	[thread overview]
Message-ID: <arJxvj1vaCeNCisu@milan> (raw)
In-Reply-To: <20260921-vmalloc_dump_obj-v2-1-73fceb3ed1c8@linux.dev>

On Mon, Sep 21, 2026 at 09:17:21PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> vmalloc_dump_obj() uses PAGE_ALIGN() to normalize the input address
> before looking it up in the per-node busy tree.  PAGE_ALIGN() rounds
> up, which can push an address in the last page of a vmalloc allocation
> to va_end -- outside the [va_start, va_end) range that
> __find_vmap_area() searches.  This causes the lookup to miss the VA
> and return false, degrading diagnostic output in OOM dumps and KASAN
> reports to the less informative "vmalloc memory" fallback.
> 
> The upward alignment can also change the addr_to_node() mapping when
> the page boundary crosses a vmap zone boundary, causing the search to
> hit the wrong node entirely.
> 
> Use PAGE_ALIGN_DOWN() instead, which rounds down to the page
> containing the address.  This keeps the address within the VA range
> and preserves the correct node mapping.
> 
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>  mm/vmalloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 859e6d2d57a3..df42d8a6f058 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -5277,7 +5277,7 @@ bool vmalloc_dump_obj(void *object)
>  	unsigned long addr;
>  	unsigned long nr_pages;
>  
> -	addr = PAGE_ALIGN((unsigned long) object);
> +	addr = PAGE_ALIGN_DOWN((unsigned long) object);
>  	vn = addr_to_node(addr);
>  
>  	if (!spin_trylock(&vn->busy.lock))
> 
> -- 
> 2.25.1
> 
LGTM:

Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>

--
Uladzislau Rezki


  reply	other threads:[~2026-09-22 12:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 13:17 [PATCH v2 0/3] mm/vmalloc: fix vmalloc_dump_obj VA lookup Ye Liu
2026-09-21 13:17 ` [PATCH v2 1/3] mm/vmalloc: fix vmalloc_dump_obj address alignment for last-page lookups Ye Liu
2026-09-22 12:17   ` Uladzislau Rezki [this message]
2026-09-21 13:17 ` [PATCH v2 2/3] mm/vmalloc: fix vmalloc_dump_obj cross-zone VA lookup Ye Liu
2026-09-22 12:44   ` Uladzislau Rezki
2026-09-21 13:17 ` [PATCH v2 3/3] mm/vmalloc: skip vmalloc_dump_obj for non-vmalloc addresses Ye Liu
2026-09-22 12:13   ` Uladzislau Rezki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arJxvj1vaCeNCisu@milan \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liuye@kylinos.cn \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=ye.liu@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®