[PATCH v3 0/3] proc,security,selinux: let SELinux block FOLL_FORCE for /proc/self/mem

Paul Moore paul at paul-moore.com
Thu Dec 3 02:22:57 UTC 2026


On Mon, Sep 7, 2026 at 5:00 PM Jann Horn <jannh at google.com> wrote:
>
> 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 at google.com>
> ---
> Changes in v3:
> - pass opened_by_owner as boolean flag (Christian, Paul)
> - call security hook independent of kernel config
> - documentation changes (mainly to adjust for changes above or suggested by Paul)
> - add acks
> - Link to v2: https://patch.msgid.link/20260825-selinux-pokemem-v2-0-b46bc64916d8@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                | 43 ++++++++++++++++++++++++++++++++++++++-----
>  include/linux/lsm_hook_defs.h |  1 +
>  include/linux/security.h      |  7 +++++++
>  security/security.c           | 25 +++++++++++++++++++++++++
>  security/selinux/hooks.c      | 31 +++++++++++++++++++++++++++++++
>  5 files changed, 102 insertions(+), 5 deletions(-)

While working through a patchwork queue I ran into this patchset
again, which caused me to double check Linus' tree and linux-next for
the patches.  Somewhat surprisingly, I didn't see them.  I'm guessing
this was a misunderstanding as last I saw Christian had merged them
into a topic branch for v7.4, I argued that was premature as I hadn't
ACK'd the LSM bits (Stephen had ACK'd the SELinux bits), and there was
no real resolution in the thread.  Since I didn't hear otherwise from
Christian, I assumed he was still planning to send the patch for v7.4,
but apparently that wasn't the case.

Regardless, not wanting to lose these patches I pulled the first two
patches from Christian's topic branch (the procfs refactor and the LSM
hook addition) complete with his sign-off, forward ported them to
v7.4-rc1, merged the SELinux patch on top of those into a new topic
branch for v7.5, and did some basic smoke tests tonight (everything
looked okay to me).  The three patches are in the
lsm/topic-7.5-03-lsm_foll_force branch and unless I hear an objection
from someone, I'll plan to send these up to Linus during the next
merge window.

https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git/log/?h=topic-7.5-03-lsm_foll_force

-- 
paul-moore.com



More information about the Linux-security-module-archive mailing list