Thread (14 messages) 14 messages, 5 authors, 6d ago

Re: [PATCH v3 2/3] proc: query LSMs for introspective mem access (if PROC_MEM_FORCE_ALWAYS)

From: "Serge E. Hallyn" <serge@hallyn.com>
Date: 2026-09-15 17:54:00
Also in: linux-fsdevel, linux-mm, selinux

On Tue, Sep 15, 2026 at 07:44:23PM +0200, Jann Horn wrote:
On Tue, Sep 15, 2026 at 7:04 PM Serge Hallyn (AMD) [off-list ref] wrote:
quoted
On Mon, Sep 07, 2026 at 11:00:17PM +0200, Jann Horn wrote:
quoted
+/**
+ * security_mem_foll_force() - Check if FOLL_FORCE is allowed
+ * @subject: credentials using which /proc/$pid/mem was opened
+ * @opened_by_owner: whether checks on open() were bypassed because the opener
+ *                   has the same MM as the target
+ *
+ * Check if FOLL_FORCE is allowed for accessing process memory through
+ * /proc/$pid/mem. opened_by_owner signals whether the opener's MM was the same
+ * as the target MM, meaning the security_ptrace_access_check() hook was
+ * bypassed on open().
+ * (Current current->mm does not matter for this; for example, if write() is
+ * called on an FD that was received from another process which obtained it with
+ * open("/proc/self/mem"), @opened_by_owner is still true.)
+ *
+ * Note that this hook is only designed to be useful in the opened_by_owner
+ * case, where the subject credentials effectively also describe the object.
Given this, would it make more sense to call the hook something
like `security_mem_foll_force_self()` and only call it in the
opened_by_owner==true case?

I only suggest it because it seems to lower the cognitive load
when looking at this code, so it might make it easier to maintain.
I agree with you, and that is what I did in the previous versions. :P

But given that two relevant maintainers disagreed with me, I changed
it in this version.
Ah, I'm sorry.  Didn't mean to dispute a prior decision.

Sounds good.

IIUC it's already in a tree, but for the record

Reviewed-by: Serge Hallyn <sergeh@kernel.org>

thanks,
-serge
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help