From: Randy Dunlap <rdunlap@infradead.org>
To: jeffxu@chromium.org
Cc: akpm@linux-foundation.org, cyphar@cyphar.com, david@readahead.eu,
dmitry.torokhov@gmail.com, dverkamp@chromium.org,
hughd@google.com, jeffxu@google.com, jorgelo@chromium.org,
keescook@chromium.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
pobrn@protonmail.com, skhan@linuxfoundation.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/1] mm/memfd: add documentation for MFD_NOEXEC_SEAL MFD_EXEC
Date: Tue, 11 Jun 2024 15:40:59 -0700 [thread overview]
Message-ID: <595b6353-6da6-432b-96b4-42c4e3ec1146@infradead.org> (raw)
In-Reply-To: <20240611034903.3456796-2-jeffxu@chromium.org>
On 6/10/24 8:49 PM, jeffxu@chromium.org wrote:
> From: Jeff Xu <jeffxu@chromium.org>
>
> Add documentation for memfd_create flags: MFD_NOEXEC_SEAL
> and MFD_EXEC
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Jeff Xu <jeffxu@chromium.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@chromium.org>
> + Jeff Xu <jeffxu@chromium.org>
> +
> +:Contributor:
> + Aleksa Sarai <cyphar@cyphar.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.
--
~Randy
next prev parent reply other threads:[~2024-06-11 22:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 3:49 [PATCH v2 0/1] mm/memfd: add documentation for MFD_NOEXEC_SEAL jeffxu
2024-06-11 3:49 ` [PATCH v2 1/1] mm/memfd: add documentation for MFD_NOEXEC_SEAL MFD_EXEC jeffxu
2024-06-11 22:40 ` Randy Dunlap [this message]
2024-06-11 23:03 ` Jeff Xu
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=595b6353-6da6-432b-96b4-42c4e3ec1146@infradead.org \
--to=rdunlap@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cyphar@cyphar.com \
--cc=david@readahead.eu \
--cc=dmitry.torokhov@gmail.com \
--cc=dverkamp@chromium.org \
--cc=hughd@google.com \
--cc=jeffxu@chromium.org \
--cc=jeffxu@google.com \
--cc=jorgelo@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pobrn@protonmail.com \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
/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