lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALmYWFvxAvG1ZmbmZf=VedTdwEq8Yz36Xp8o9rhw=Wfae1ei8w@mail.gmail.com>
Date: Tue, 11 Jun 2024 16:03:56 -0700
From: Jeff Xu <jeffxu@...gle.com>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: jeffxu@...omium.org, akpm@...ux-foundation.org, cyphar@...har.com, 
	david@...dahead.eu, dmitry.torokhov@...il.com, dverkamp@...omium.org, 
	hughd@...gle.com, jorgelo@...omium.org, keescook@...omium.org, 
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org, 
	linux-mm@...ck.org, pobrn@...tonmail.com, skhan@...uxfoundation.org, 
	stable@...r.kernel.org
Subject: Re: [PATCH v2 1/1] mm/memfd: add documentation for MFD_NOEXEC_SEAL MFD_EXEC

On Tue, Jun 11, 2024 at 3:41 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>
>
>
> On 6/10/24 8:49 PM, jeffxu@...omium.org wrote:
> > From: Jeff Xu <jeffxu@...omium.org>
> >
> > Add documentation for memfd_create flags: MFD_NOEXEC_SEAL
> > and MFD_EXEC
> >
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Jeff Xu <jeffxu@...omium.org>
> >
> > ---
> >  Documentation/userspace-api/index.rst      |  1 +
> >  Documentation/userspace-api/mfd_noexec.rst | 86 ++++++++++++++++++++++
> >  2 files changed, 87 insertions(+)
> >  create mode 100644 Documentation/userspace-api/mfd_noexec.rst
> >
> > diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
> > index 5926115ec0ed..8a251d71fa6e 100644
> > --- a/Documentation/userspace-api/index.rst
> > +++ b/Documentation/userspace-api/index.rst
> > @@ -32,6 +32,7 @@ Security-related interfaces
> >     seccomp_filter
> >     landlock
> >     lsm
> > +   mfd_noexec
> >     spec_ctrl
> >     tee
> >
> > diff --git a/Documentation/userspace-api/mfd_noexec.rst b/Documentation/userspace-api/mfd_noexec.rst
> > new file mode 100644
> > index 000000000000..ec6e3560fbff
> > --- /dev/null
> > +++ b/Documentation/userspace-api/mfd_noexec.rst
> > @@ -0,0 +1,86 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +==================================
> > +Introduction of non executable mfd
>
> Missed:
>                    non-executable
>
> > +==================================
> > +:Author:
> > +    Daniel Verkamp <dverkamp@...omium.org>
> > +    Jeff Xu <jeffxu@...omium.org>
> > +
> > +:Contributor:
> > +     Aleksa Sarai <cyphar@...har.com>
> > +
> > +Since Linux introduced the memfd feature, memfds 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 of 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 a system, we need a solution to differentiate runc's
> > +use of executable memfds and an attacker's [3].
> > +
> > +To address those above:
> > + - Let memfd_create() set X bit at creation time.
> > + - Let memfd be sealed for modifying X bit when NX is set.
> > + - Add a new pid namespace sysctl: vm.memfd_noexec to help applications to
>
>                                                          help applications in
>
> > +   migrating and enforcing non-executable MFD.
> > +
> > +User API
> > +========
>
> The rest looks good. Thanks.
>
Thanks for your review!

> --
> ~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ