* FAILED: patch "[PATCH] selinux: check MAP_SHARED_VALIDATE mappings as shared" failed to apply to 6.1-stable tree
@ 2026-12-02 13:44 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2026-12-02 13:44 UTC (permalink / raw)
To: stephen.smalley.work, paul; +Cc: stable
The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x beb0ae6bcd7505e2e61babe5d98a8dd3b3f03c7f
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120258-blog-astrology-e2ad@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From beb0ae6bcd7505e2e61babe5d98a8dd3b3f03c7f Mon Sep 17 00:00:00 2001
From: Stephen Smalley <stephen.smalley.work@gmail.com>
Date: Fri, 6 Nov 2026 13:29:13 -0500
Subject: [PATCH] selinux: check MAP_SHARED_VALIDATE mappings as shared
selinux_mmap_file() only recognizes MAP_SHARED as a shared mapping,
but MAP_SHARED_VALIDATE is also a shared mapping type. The mmap flags
reach this hook before the mm code processes the mapping type.
Consequently, a writable MAP_SHARED_VALIDATE mapping was failing to
check the file write permission at mmap time, and a writable
executable file mapping was wrongly checking process execmem
permission as if it were private.
Cc: stable@vger.kernel.org
Link: https://github.com/SELinuxProject/selinux-kernel/issues/78
Fixes: 1c9725974074 ("mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags")
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9950f89dfaa2..6c4c64d6e904 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4179,8 +4179,11 @@ static int selinux_mmap_file(struct file *file,
unsigned long reqprot __always_unused,
unsigned long prot, unsigned long flags)
{
+ const unsigned long map_type = (flags & MAP_TYPE);
+
return selinux_mmap_file_common(file, prot,
- (flags & MAP_TYPE) == MAP_SHARED,
+ (map_type == MAP_SHARED ||
+ map_type == MAP_SHARED_VALIDATE),
false);
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 14:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 13:44 FAILED: patch "[PATCH] selinux: check MAP_SHARED_VALIDATE mappings as shared" failed to apply to 6.1-stable tree gregkh
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.