Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
To: Ye Liu <ye.liu@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	Uladzislau Rezki <urezki@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Ye Liu <liuye@kylinos.cn>
Subject: Re: [PATCH 2/2] mm/vmalloc: warn on NULL page in remap_vmalloc_range_partial
Date: Wed, 28 Oct 2026 11:56:00 +0100	[thread overview]
Message-ID: <599fe237-0a05-4e95-b377-7186cb0d761a@gmail.com> (raw)
In-Reply-To: <20261026-vmalloc_remap-v1-2-b7a907814e90@linux.dev>

On 10/26/26 7:09 AM, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> remap_vmalloc_range_partial() oopses if vmalloc_to_page() returns
> NULL, which never happens today because VM_USERMAP areas keep every
> page mapped. Add a WARN_ON(!page) to flag a break before the oops.
> 
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>  mm/vmalloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index a888eca016a8..59ba203a4eff 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -4906,6 +4906,7 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
>  		struct page *page = vmalloc_to_page(kaddr);
>  		int ret;
>  
> +		WARN_ON(!page);
>  		ret = vm_insert_page(vma, uaddr, page);

doesn't this still hand the NULL page to vm_insert_page() right after,
so we warn and then oops anyway? wouldn't something like this be what
you want here?

		if (WARN_ON_ONCE(!page))
			return -EINVAL;

-- 
cheers,
jose a. p-a


      reply	other threads:[~2026-10-28 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  6:09 [PATCH 0/2] mm/vmalloc: harden remap_vmalloc_range_partial against NULL pages Ye Liu
2026-10-26  6:09 ` [PATCH 1/2] mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partial Ye Liu
2026-10-28 10:46   ` Jose A. Perez de Azpillaga
2026-10-26  6:09 ` [PATCH 2/2] mm/vmalloc: warn on NULL page in remap_vmalloc_range_partial Ye Liu
2026-10-28 10:56   ` Jose A. Perez de Azpillaga [this message]

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=599fe237-0a05-4e95-b377-7186cb0d761a@gmail.com \
    --to=azpijr@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuye@kylinos.cn \
    --cc=urezki@gmail.com \
    --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