From: Jeff Xu <jeffxu@google.com>
To: jeffxu@chromium.org
Cc: skhan@linuxfoundation.org, keescook@chromium.org,
akpm@linux-foundation.org, dmitry.torokhov@gmail.com,
dverkamp@chromium.org, hughd@google.com, jorgelo@chromium.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-mm@kvack.org, jannh@google.com,
linux-hardening@vger.kernel.org,
linux-security-module@vger.kernel.org,
Dominique Martinet <asmadeus@codewreck.org>
Subject: Re: [PATCH v2] Documentation: mm/memfd: vm.memfd_noexec
Date: Thu, 29 Jun 2023 20:27:02 -0700 [thread overview]
Message-ID: <CALmYWFtj1rEwJQmE4nrpCswxWf8TuW9T-p7NVGsA39JoZm+nnA@mail.gmail.com> (raw)
In-Reply-To: <20230629233454.4166842-1-jeffxu@google.com>
On Thu, Jun 29, 2023 at 4:34 PM <jeffxu@chromium.org> wrote:
>
> From: Jeff Xu <jeffxu@google.com>
>
Please ignore this, I resent V3 with a cover letter.
> Add documentation for sysctl vm.memfd_noexec
>
> Link:https://lore.kernel.org/linux-mm/CABi2SkXUX_QqTQ10Yx9bBUGpN1wByOi_=gZU6WEy5a8MaQY3Jw@mail.gmail.com/T/
> Reported-by: Dominique Martinet <asmadeus@codewreck.org>
> Signed-off-by: Jeff Xu <jeffxu@google.com>
> ---
> Documentation/admin-guide/sysctl/vm.rst | 30 +++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst
> index 45ba1f4dc004..621588041a9e 100644
> --- a/Documentation/admin-guide/sysctl/vm.rst
> +++ b/Documentation/admin-guide/sysctl/vm.rst
> @@ -424,6 +424,36 @@ e.g., up to one or two maps per allocation.
>
> The default value is 65530.
>
> +memfd_noexec:
> +=============
> +This pid namespaced sysctl controls memfd_create().
> +
> +The new MFD_NOEXEC_SEAL and MFD_EXEC flags of memfd_create() allows
> +application to set executable bit at creation time.
> +
> +When MFD_NOEXEC_SEAL is set, memfd is created without executable bit
> +(mode:0666), and sealed with F_SEAL_EXEC, so it can't be chmod to
> +be executable (mode: 0777) after creation.
> +
> +when MFD_EXEC flag is set, memfd is created with executable bit
> +(mode:0777), this is the same as the old behavior of memfd_create.
> +
> +The new pid namespaced sysctl vm.memfd_noexec has 3 values:
> +0: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL acts like
> + MFD_EXEC was set.
> +1: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL acts like
> + MFD_NOEXEC_SEAL was set.
> +2: memfd_create() without MFD_NOEXEC_SEAL will be rejected.
> +
> +The default value is 0.
> +
> +Once set, it can't be downgraded at runtime, i.e. 2=>1, 1=>0
> +are denied.
> +
> +This is pid namespaced sysctl, child processes inherit the parent
> +process's memfd_noexec at the time of fork. Changes to the parent
> +process after fork are not automatically propagated to the child
> +process.
>
> memory_failure_early_kill:
> ==========================
> --
> 2.41.0.255.g8b1d071c50-goog
>
prev parent reply other threads:[~2023-06-30 3:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 23:34 jeffxu
2023-06-30 3:27 ` Jeff Xu [this message]
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=CALmYWFtj1rEwJQmE4nrpCswxWf8TuW9T-p7NVGsA39JoZm+nnA@mail.gmail.com \
--to=jeffxu@google.com \
--cc=akpm@linux-foundation.org \
--cc=asmadeus@codewreck.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dverkamp@chromium.org \
--cc=hughd@google.com \
--cc=jannh@google.com \
--cc=jeffxu@chromium.org \
--cc=jorgelo@chromium.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=skhan@linuxfoundation.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