All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,urezki@gmail.com,azpijr@gmail.com,
	liuye@kylinos.cn,akpm@linux-foundation.org
Subject: + mm-vmalloc-drop-vm_dma_coherent-from-remap_vmalloc_range_partial.patch added to mm-unstable branch
Date: Sat, 21 Nov 2026 13:20:44 -0800	[thread overview]
Message-ID: <20261121212044.A1E331F000C4@smtp.kernel.org> (raw)
In-Reply-To: <20261029-vmalloc_remap-v2-1-c4705cbf26c2@linux.dev>


The patch titled
     Subject: mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partial
has been added to the -mm mm-unstable branch.  Its filename is
     mm-vmalloc-drop-vm_dma_coherent-from-remap_vmalloc_range_partial.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-vmalloc-drop-vm_dma_coherent-from-remap_vmalloc_range_partial.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Ye Liu <liuye@kylinos.cn>
Subject: mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partial
Date: Thu, 29 Oct 2026 17:19:07 +0800

Patch series "mm/vmalloc: harden remap_vmalloc_range_partial against NULL
pages", v2.

remap_vmalloc_range_partial() passes vmalloc_to_page()'s result to
vm_insert_page() unchecked, oopsing via page_folio() if the page is
NULL. The NULL case never happens today because VM_USERMAP areas keep
every page mapped, but that assumption is nowhere checked.

Patch 1 drops VM_DMA_COHERENT from the allow-list -- a dead entry (no
caller maps a DMA-coherent area through this path).

Patch 2 fails the mapping with -EINVAL instead of oopsing if
vmalloc_to_page() ever returns NULL, with a WARN to mark the broken
invariant.

Patch 1 is a behavior change (no in-tree caller affected)
Patch 2 only changes a failure path that cannot be reached today.
The two are independent.


This patch (of 2):

No caller maps a VM_DMA_COHERENT area through this path: such areas
come from dma_alloc_coherent() internals and are freed via vunmap(),
never through remap_vmalloc_range[_partial](); all 13 callers pass
vmalloc_user()/vmalloc()-backed addresses.

The flag was added in commit fe9041c245196 ("vmalloc: lift the arm
flag for coherent mappings to common code") as a mechanical
translation of ARM's VM_ARM_DMA_CONSISTENT.

Drop it so DMA-coherent areas can never enter the path.

Link: https://lore.kernel.org/20261029-vmalloc_remap-v2-0-c4705cbf26c2@linux.dev
Link: https://patch.msgid.link/20261029-vmalloc_remap-v2-1-c4705cbf26c2@linux.dev
Signed-off-by: Ye Liu <liuye@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>

 mm/vmalloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/vmalloc.c~mm-vmalloc-drop-vm_dma_coherent-from-remap_vmalloc_range_partial
+++ a/mm/vmalloc.c
@@ -5052,7 +5052,7 @@ int remap_vmalloc_range_partial(struct v
 	if (!area)
 		return -EINVAL;
 
-	if (!(area->flags & (VM_USERMAP | VM_DMA_COHERENT)))
+	if (!(area->flags & VM_USERMAP))
 		return -EINVAL;
 
 	if (check_add_overflow(size, off, &end_index) ||
_

Patches currently in -mm which might be from liuye@kylinos.cn are

mm-vmalloc-drop-vm_dma_coherent-from-remap_vmalloc_range_partial.patch
mm-vmalloc-reject-null-pages-in-remap_vmalloc_range_partial.patch


  parent reply	other threads:[~2026-11-21 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  9:19 [PATCH v2 0/2] mm/vmalloc: harden remap_vmalloc_range_partial against NULL pages Ye Liu
2026-10-29  9:19 ` [PATCH v2 1/2] mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partial Ye Liu
2026-10-29 11:57   ` Jose A. Perez de Azpillaga
2026-11-21 21:20   ` Andrew Morton [this message]
2026-11-22 15:39   ` Uladzislau Rezki
2026-12-01  2:07     ` Ye Liu
2026-10-29  9:19 ` [PATCH v2 2/2] mm/vmalloc: reject NULL pages in remap_vmalloc_range_partial Ye Liu
2026-10-29 12:04   ` Jose A. Perez de Azpillaga
2026-11-21 21:20   ` + mm-vmalloc-reject-null-pages-in-remap_vmalloc_range_partial.patch added to mm-unstable branch Andrew Morton
2026-11-22 14:54   ` [PATCH v2 2/2] mm/vmalloc: reject NULL pages in remap_vmalloc_range_partial 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=20261121212044.A1E331F000C4@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=azpijr@gmail.com \
    --cc=liuye@kylinos.cn \
    --cc=mm-commits@vger.kernel.org \
    --cc=urezki@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.