* [PATCH] Documentation: mm/memfd: vm.memfd_noexec
@ 2023-06-29 23:25 jeffxu
2023-07-13 16:10 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: jeffxu @ 2023-06-29 23:25 UTC (permalink / raw)
To: skhan, keescook
Cc: akpm, dmitry.torokhov, dverkamp, hughd, jeffxu, jorgelo,
linux-kernel, linux-kselftest, linux-mm, jannh, linux-hardening,
linux-security-module, Dominique Martinet
From: Jeff Xu <jeffxu@google.com>
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 | 29 +++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-guide/sysctl/vm.rst
index 45ba1f4dc004..71923c3d7044 100644
--- a/Documentation/admin-guide/sysctl/vm.rst
+++ b/Documentation/admin-guide/sysctl/vm.rst
@@ -424,6 +424,35 @@ 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 pid 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Documentation: mm/memfd: vm.memfd_noexec
2023-06-29 23:25 [PATCH] Documentation: mm/memfd: vm.memfd_noexec jeffxu
@ 2023-07-13 16:10 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2023-07-13 16:10 UTC (permalink / raw)
To: jeffxu, keescook
Cc: akpm, dmitry.torokhov, dverkamp, hughd, jeffxu, jorgelo,
linux-kernel, linux-kselftest, linux-mm, jannh, linux-hardening,
linux-security-module, Dominique Martinet, Shuah Khan
On 6/29/23 17:25, jeffxu@chromium.org wrote:
> From: Jeff Xu <jeffxu@google.com>
>
> 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 | 29 +++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
Looks goo to me. Kees and Andrew might have comments on the
specifics.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-13 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 23:25 [PATCH] Documentation: mm/memfd: vm.memfd_noexec jeffxu
2023-07-13 16:10 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox