linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
  • * Re: [PATCH v7 0/6] mm/memfd: introduce MFD_NOEXEC_SEAL and MFD_EXEC
           [not found] <20221209160453.3246150-1-jeffxu@google.com>
           [not found] ` <20221209160453.3246150-7-jeffxu@google.com>
    @ 2022-12-09 18:15 ` Paul Moore
           [not found] ` <20221209160453.3246150-3-jeffxu@google.com>
                       ` (2 subsequent siblings)
      4 siblings, 0 replies; 19+ messages in thread
    From: Paul Moore @ 2022-12-09 18:15 UTC (permalink / raw)
      To: jeffxu
      Cc: skhan, keescook, akpm, dmitry.torokhov, dverkamp, hughd, jeffxu,
    	jorgelo, linux-kernel, linux-kselftest, linux-mm, jannh,
    	linux-hardening, linux-security-module
    
    On Fri, Dec 9, 2022 at 11:05 AM <jeffxu@chromium.org> wrote:
    > From: Jeff Xu <jeffxu@google.com>
    >
    > Since Linux introduced the memfd feature, memfd have always had their
    > execute bit set, and the memfd_create() syscall doesn't allow setting
    > it differently.
    >
    > However, in a secure by default system, such as ChromeOS, (where all
    > executables should come from the rootfs, which is protected by Verified
    > boot), this executable nature of memfd opens a door for NoExec bypass
    > and enables “confused deputy attack”.  E.g, in VRP bug [1]: cros_vm
    > process created a memfd to share the content with an external process,
    > however the memfd is overwritten and used for executing arbitrary code
    > and root escalation. [2] lists more VRP in this kind.
    
    ...
    
    > [1] https://crbug.com/1305411
    
    Can you make this accessible so those of us on the public lists can
    view this bug?  If not, please remove it from future postings and
    adjust your description accordingly.
    
    -- 
    paul-moore.com
    
    
    ^ permalink raw reply	[flat|nested] 19+ messages in thread
  • [parent not found: <20221209160453.3246150-3-jeffxu@google.com>]
  • [parent not found: <20221209160453.3246150-4-jeffxu@google.com>]
  • * Re: [PATCH v7 0/6] mm/memfd: introduce MFD_NOEXEC_SEAL and MFD_EXEC
           [not found] <20221209160453.3246150-1-jeffxu@google.com>
                       ` (3 preceding siblings ...)
           [not found] ` <20221209160453.3246150-4-jeffxu@google.com>
    @ 2022-12-14 18:54 ` Kees Cook
      2022-12-14 23:32   ` Jeff Xu
      4 siblings, 1 reply; 19+ messages in thread
    From: Kees Cook @ 2022-12-14 18:54 UTC (permalink / raw)
      To: jeffxu
      Cc: skhan, akpm, dmitry.torokhov, dverkamp, hughd, jeffxu, jorgelo,
    	linux-kernel, linux-kselftest, linux-mm, jannh, linux-hardening,
    	linux-security-module
    
    On Fri, Dec 09, 2022 at 04:04:47PM +0000, jeffxu@chromium.org wrote:
    > From: Jeff Xu <jeffxu@google.com>
    > 
    > Since Linux introduced the memfd feature, memfd have always had their
    > execute bit set, and the memfd_create() syscall doesn't allow setting
    > it differently.
    > 
    > However, in a secure by default system, such as ChromeOS, (where all
    > executables should come from the rootfs, which is protected by Verified
    > boot), this executable nature of memfd opens a door for NoExec bypass
    > and enables “confused deputy attack”.  E.g, in VRP bug [1]: cros_vm
    > process created a memfd to share the content with an external process,
    > however the memfd is overwritten and used for executing arbitrary code
    > and root escalation. [2] lists more VRP in this kind.
    > 
    > On the other hand, executable memfd has its legit use, runc uses memfd’s
    > seal and executable feature to copy the contents of the binary then
    > execute them, for such system, we need a solution to differentiate runc's
    > use of  executable memfds and an attacker's [3].
    > 
    > To address those above, this set of patches add following:
    > 1> Let memfd_create() set X bit at creation time.
    > 2> Let memfd to be sealed for modifying X bit.
    > 3> A new pid namespace sysctl: vm.memfd_noexec to control the behavior of
    >    X bit.For example, if a container has vm.memfd_noexec=2, then
    >    memfd_create() without MFD_NOEXEC_SEAL will be rejected.
    > 4> A new security hook in memfd_create(). This make it possible to a new
    > LSM, which rejects or allows executable memfd based on its security policy.
    
    I think patch 1-5 look good to land. The LSM hook seems separable, and
    could continue on its own. Thoughts?
    
    (Which tree should memfd change go through?)
    
    -Kees
    
    -- 
    Kees Cook
    
    
    ^ permalink raw reply	[flat|nested] 19+ messages in thread

  • end of thread, other threads:[~2025-09-20 18:59 UTC | newest]
    
    Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <20221209160453.3246150-1-jeffxu@google.com>
         [not found] ` <20221209160453.3246150-7-jeffxu@google.com>
    2022-12-09 17:02   ` [PATCH v7 6/6] mm/memfd: security hook for memfd_create Casey Schaufler
    2022-12-09 18:29   ` Paul Moore
    2022-12-13 15:00     ` Jeff Xu
    2022-12-13 15:37       ` Casey Schaufler
    2022-12-13 19:22       ` Paul Moore
    2022-12-13 23:05         ` Jeff Xu
    2025-09-20  5:54         ` Abhinav Saxena
    2025-09-20 18:58           ` Jeff Xu
    2022-12-09 18:15 ` [PATCH v7 0/6] mm/memfd: introduce MFD_NOEXEC_SEAL and MFD_EXEC Paul Moore
         [not found] ` <20221209160453.3246150-3-jeffxu@google.com>
    2022-12-14 18:52   ` [PATCH v7 2/6] selftests/memfd: add tests for F_SEAL_EXEC Kees Cook
         [not found] ` <20221209160453.3246150-4-jeffxu@google.com>
    2022-12-14 18:53   ` [PATCH v7 3/6] mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC Kees Cook
    2022-12-16 18:39   ` SeongJae Park
    2022-12-16 19:03     ` Jeff Xu
    2022-12-16 19:21       ` Andrew Morton
    2022-12-16 19:31         ` SeongJae Park
    2022-12-14 18:54 ` [PATCH v7 0/6] mm/memfd: introduce " Kees Cook
    2022-12-14 23:32   ` Jeff Xu
    2022-12-15  0:08     ` Kees Cook
    2022-12-15 16:55       ` Jeff Xu
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox