From: sashiko-bot@kernel.org
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: linux-usb@vger.kernel.org, linux-rdma@vger.kernel.org,
selinux@vger.kernel.org, bpf@vger.kernel.org,
linux-scsi@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-trace-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, kvmarm@lists.linux.dev,
kvm@vger.kernel.org, linux-s390@vger.kernel.org,
"Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v6 08/39] mm: add mmap action for discontiguous kernel page mapping
Date: Tue, 13 Oct 2026 16:29:21 +0000 [thread overview]
Message-ID: <sashiko-outbox-170114@kernel.org> (raw)
In-Reply-To: <20261013-b4-mmap-prepare-vma-flag-sanify-v6-8-1aa3c9b139f9@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm: mmap_action_finish bypasses error_override for compat tasks
--
commit 21d3d0c977ac349611c733fc3c288ae67e5f71a1
Author: Lorenzo Stoakes (ARM) <ljs@kernel.org>
mm: add mmap action for discontiguous kernel page mapping
This commit introduces discontig_kernel_page_ops and a new mmap action type
to allow drivers to map discontiguous arrays of kernel pages into a VMA.
It updates the compatibility layer via compat_mmap_action_abort() to properly
handle VMA teardown on mmap action failures.
> diff --git a/mm/util.c b/mm/util.c
> --- a/mm/util.c
> +++ b/mm/util.c
[ ... ]
> @@ -1412,12 +1421,13 @@ static int mmap_action_finish(struct vm_area_struct *vma,
>
> /* do_munmap() might take rmap lock, so release if held. */
> maybe_rmap_unlock_action(vma, action);
> - /*
> - * If this is invoked from the compatibility layer, post-mmap() hook
> - * logic will handle cleanup for us.
> - */
> - if (!err || is_compat)
> + if (!err)
> + return 0;
> +
> + if (is_compat) {
> + compat_mmap_action_abort(vma);
> return err;
[Severity: Medium]
Does this bypass the error_override logic for compat tasks?
When an mmap action fails, the mmap_action struct provides an error_override
field to allow drivers to replace the internal error code with a user-facing
one. Later in this function, non-compat tasks return
action->error_override ?: err.
By returning err directly here when is_compat is true, it seems 32-bit compat
tasks might receive different error codes than 64-bit tasks, potentially
breaking ABI consistency.
> + }
>
> /*
> * If an error occurs, unmap the VMA altogether and return an error. We
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-b4-mmap-prepare-vma-flag-sanify-v6-0-1aa3c9b139f9@kernel.org?part=8
next prev parent reply other threads:[~2026-10-13 16:29 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 15:04 [PATCH v6 00/39] mm: make VMA flag semantics explicit, eliminate VM_SPECIAL Lorenzo Stoakes (ARM)
2026-10-13 15:04 ` [PATCH v6 01/39] mm/vma: fix mmap_prepare file handling, remove file_doesnt_need_get Lorenzo Stoakes (ARM)
2026-10-13 15:34 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 02/39] mm/vma: introduce and use vma_[flags_]can_merge() Lorenzo Stoakes (ARM)
2026-10-13 15:19 ` David Hildenbrand (Arm)
2026-10-13 15:37 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 03/39] mm: consistently validate VMA state after mmap[_prepare] hooks Lorenzo Stoakes (ARM)
2026-10-13 15:51 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 04/39] mm/vma: ensure mmap_prepare doesn't set actions on a mergeable vma Lorenzo Stoakes (ARM)
2026-10-13 16:01 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 05/39] mm: make map_kernel_pages_[prepare,complete] internal and unexported Lorenzo Stoakes (ARM)
2026-10-13 16:04 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 06/39] mm/vma: tidy up map kernel pages enum values Lorenzo Stoakes (ARM)
2026-10-13 16:06 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 07/39] mm: assert mmap lock held, use new flags API in vm_insert_page[s] Lorenzo Stoakes (ARM)
2026-10-13 15:20 ` David Hildenbrand (Arm)
2026-10-13 16:14 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 08/39] mm: add mmap action for discontiguous kernel page mapping Lorenzo Stoakes (ARM)
2026-10-13 15:24 ` David Hildenbrand (Arm)
2026-10-13 16:29 ` sashiko-bot [this message]
2026-10-13 15:04 ` [PATCH v6 09/39] docs: filesystems: update mmap_prepare docs for discontig kernel pgs Lorenzo Stoakes (ARM)
2026-10-13 15:25 ` David Hildenbrand (Arm)
2026-10-13 16:29 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 10/39] drivers/usb/mon: update to use mmap_prepare + map kernel pages Lorenzo Stoakes (ARM)
2026-10-13 16:44 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 11/39] infiniband: update hfi1 to use remap_vmalloc_range() Lorenzo Stoakes (ARM)
2026-10-13 17:04 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 12/39] selinux: reject writable opens of policy file, drop mmap shared/write check Lorenzo Stoakes (ARM)
2026-10-13 17:13 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 13/39] ALSA: pcm: use vm_insert_page() to map PCM status page Lorenzo Stoakes (ARM)
2026-10-13 17:33 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 14/39] bpf: arena: mark arena_map_mmap() mappings VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 17:47 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 15/39] mm/vma: add vma[_flags]_is_mm_managed() predicates Lorenzo Stoakes (ARM)
2026-10-13 17:50 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 16/39] mm/vma: only allow mmap to clear VMA_MAYWRITE_BIT if not mm-managed Lorenzo Stoakes (ARM)
2026-10-13 17:59 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 17/39] mm/vma: add and use vma_[flags]_is_fixed_mapping Lorenzo Stoakes (ARM)
2026-10-13 18:08 ` sashiko-bot
2026-10-13 15:04 ` [PATCH v6 18/39] scsi: sg: convert mmap hook to mmap_prepare and rework Lorenzo Stoakes (ARM)
2026-10-13 15:04 ` [PATCH v6 19/39] fbdev: defio: assert FBINFO_VIRTFB, drop VM_IO, add VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 20/39] HSI: cmt_speech: convert mmap hook to mmap_prepare, refactor Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 21/39] mm/gup: error out early on !VMA_MAYREAD_BIT VMAs Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 22/39] uprobes: remove VM_IO, set VM_MIXEDMAP for mapped kernel pages Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 23/39] mm/mlock: clear VMA_LOCKED_MASK over mmap callback Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 24/39] mm/mlock: eliminate weird VMA_IO_BIT abuse and simplify Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 25/39] mm/vma: enforce that mm-managed mappings may not set VMA_IO_BIT Lorenzo Stoakes (ARM)
2026-10-13 15:26 ` David Hildenbrand (Arm)
2026-10-13 15:05 ` [PATCH v6 26/39] mm: remove VMA_IO_BIT check in vma[_flags]_is_mm_managed() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 27/39] mm: remove hugetlb_inline.h Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 28/39] mm: rename is_vm_hugetlb_page() to vma_is_hugetlb() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 29/39] mm: drop some redundant checks around hugetlb VMAs Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 30/39] mm/vma: introduce vma[_flags]_is_mm_backed() Lorenzo Stoakes (ARM)
2026-10-13 15:31 ` David Hildenbrand (Arm)
2026-10-13 15:05 ` [PATCH v6 31/39] mm/madvise: update is_valid_guard_vma() to use vma_is_mm_backed() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 32/39] mm/uffd: use predicates for userfaultfd checks Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 33/39] mm/madvise: use predicates for madvise(..., MADV_DOFORK) Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 34/39] mm: eliminate VMA_SPECIAL_FLAGS usage when hugetlb explicitly tested Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 35/39] mm: eliminate VMA_SPECIAL_FLAGS check in lru_gen_look_around() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 36/39] mm: avoid use of VMA_SPECIAL_FLAGS in migrate_vma_setup() Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 37/39] mm: eliminate VM_SPECIAL, VMA_SPECIAL_FLAGS Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 38/39] fuse: dax: do not set VM_MIXEDMAP Lorenzo Stoakes (ARM)
2026-10-13 15:05 ` [PATCH v6 39/39] mm/huge_memory: remove vma_is_special_huge() Lorenzo Stoakes (ARM)
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=sashiko-outbox-170114@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=bpf@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selinux@vger.kernel.org \
/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