From: Jann Horn <jannh@google.com>
To: "Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Stephen Smalley" <stephen.smalley.work@gmail.com>,
"Jeff Xu" <jeffxu@google.com>,
"Thiébaud Weksteen" <tweek@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org,
Ondrej Mosnacek <omosnace@redhat.com>,
selinux@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <liam@infradead.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Vlastimil Babka <vbabka@kernel.org>,
Pedro Falcato <pfalcato@suse.de>,
David Hildenbrand <david@kernel.org>,
linux-mm@kvack.org, Jann Horn <jannh@google.com>
Subject: [PATCH v2 0/3] proc,security,selinux: let SELinux block FOLL_FORCE for /proc/self/mem
Date: Tue, 25 Aug 2026 20:39:16 +0200 [thread overview]
Message-ID: <20260825-selinux-pokemem-v2-0-b46bc64916d8@google.com> (raw)
The goal of this series is to let SELinux prevent the use of FOLL_FORCE
when a process writes into /proc/self/mem and the system is configured
with PROC_MEM_FORCE_ALWAYS (which used to be the default behavior, and
is still used by current Android devices).
Android has SELinux policy that attempts to ensure that only trusted
code can be mapped as executable in several system processes, but this
protection can currently be bypassed by writing into /proc/self/mem.
I wrote this series after discussion with Android security folks about
the state of proc_mem_foll_force() restrictions on Android.
I'm sending this to:
- maintainers for LSM hooks
- maintainers for SELinux
- maintainers for VFS (because I think they generally own procfs?)
- some MM folks just as FYI since this touches GUP usage
- the Android folks I talked to about this
I think this should probably go through either the VFS tree or the
LSM tree.
The motivation for this series is that Project Zero managed to write a
remote exploit for Google Pixel partly because of /proc/self/mem, see
<https://projectzero.google/2026/01/pixel-0-click-part-1.html#whats-the-plan-seth-and-jann>.
Signed-off-by: Jann Horn <jannh@google.com>
---
Changes in v2:
- change SELinux hook to only check PROCESS__PTRACE (Stephen Smalley)
- rename ->introspection to ->opened_by_owner (David Hildenbrand)
- rename introspect_mem_foll_force hook to mem_foll_force_opened_by_owner
- improve comments
- add ack/review trailers
- Link to v1: https://patch.msgid.link/20260818-selinux-pokemem-v1-0-90cd2357ee05@google.com
---
Jann Horn (3):
proc: refactor /proc/$pid/mem to use struct as private_data
proc: query LSMs for introspective mem access (if PROC_MEM_FORCE_ALWAYS)
selinux: require PROCESS__PTRACE for FOLL_FORCE introspection
fs/proc/base.c | 38 +++++++++++++++++++++++++++++++++++---
include/linux/lsm_hook_defs.h | 1 +
include/linux/security.h | 6 ++++++
security/security.c | 20 ++++++++++++++++++++
security/selinux/hooks.c | 22 ++++++++++++++++++++++
5 files changed, 84 insertions(+), 3 deletions(-)
---
base-commit: 2f1baf1fc8929e6c48370be543ad028ac7ad4131
change-id: 20260814-selinux-pokemem-44625557c4d4
Best regards,
--
Jann Horn <jannh@google.com>
next reply other threads:[~2026-08-25 18:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 18:39 Jann Horn [this message]
2026-08-25 18:39 ` [PATCH v2 1/3] proc: refactor /proc/$pid/mem to use struct as private_data Jann Horn
2026-08-25 18:39 ` [PATCH v2 2/3] proc: query LSMs for introspective mem access (if PROC_MEM_FORCE_ALWAYS) Jann Horn
2026-08-26 13:06 ` Lorenzo Stoakes (ARM)
2026-08-27 16:59 ` David Hildenbrand (Arm)
2026-08-28 1:10 ` Paul Moore
2026-08-28 13:03 ` Jann Horn
2026-08-28 13:20 ` Jann Horn
2026-08-28 21:10 ` Paul Moore
2026-08-28 21:04 ` Paul Moore
2026-08-25 18:39 ` [PATCH v2 3/3] selinux: require PROCESS__PTRACE for FOLL_FORCE introspection Jann Horn
2026-08-25 19:30 ` Stephen Smalley
2026-08-27 17:46 ` Lorenzo Stoakes (ARM)
2026-08-28 1:10 ` Paul Moore
2026-08-28 13:04 ` Jann Horn
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=20260825-selinux-pokemem-v2-0-b46bc64916d8@google.com \
--to=jannh@google.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jeffxu@google.com \
--cc=jmorris@namei.org \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=pfalcato@suse.de \
--cc=selinux@vger.kernel.org \
--cc=serge@hallyn.com \
--cc=stephen.smalley.work@gmail.com \
--cc=tweek@google.com \
--cc=vbabka@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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