linux-stable/include
Aleksa Sarai 6c7e870567 memfd: do not -EACCES old memfd_create() users with vm.memfd_noexec=2
[ Upstream commit 202e14222f ]

Given the difficulty of auditing all of userspace to figure out whether
every memfd_create() user has switched to passing MFD_EXEC and
MFD_NOEXEC_SEAL flags, it seems far less distruptive to make it possible
for older programs that don't make use of executable memfds to run under
vm.memfd_noexec=2.  Otherwise, a small dependency change can result in
spurious errors.  For programs that don't use executable memfds, passing
MFD_NOEXEC_SEAL is functionally a no-op and thus having the same

In addition, every failure under vm.memfd_noexec=2 needs to print to the
kernel log so that userspace can figure out where the error came from.
The concerns about pr_warn_ratelimited() spam that caused the switch to
pr_warn_once()[1,2] do not apply to the vm.memfd_noexec=2 case.

This is a user-visible API change, but as it allows programs to do
something that would be blocked before, and the sysctl itself was broken
and recently released, it seems unlikely this will cause any issues.

[1]: https://lore.kernel.org/Y5yS8wCnuYGLHMj4@x1n/
[2]: https://lore.kernel.org/202212161233.85C9783FB@keescook/

Link: https://lkml.kernel.org/r/20230814-memfd-vm-noexec-uapi-fixes-v2-2-7ff9e3e10ba6@cyphar.com
Fixes: 105ff5339f ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Daniel Verkamp <dverkamp@chromium.org>
Cc: Jeff Xu <jeffxu@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-13 09:48:44 +02:00
..
acpi ACPI: sleep: Avoid breaking S3 wakeup due to might_sleep() 2023-06-15 18:05:19 +02:00
asm-generic word-at-a-time: use the same return type for has_zero regardless of endianness 2023-08-11 12:14:08 +02:00
clocksource
crypto crypto: api - Use work queue in crypto_destroy_instance 2023-09-13 09:48:03 +02:00
drm drm/display/dp: Fix the DP DSC Receiver cap size 2023-08-30 14:52:37 +02:00
dt-bindings dt-bindings: clock: Update GCC clocks for QDU1000 and QRU1000 SoCs 2023-09-13 09:48:22 +02:00
keys
kunit
kvm KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2023-07-27 08:56:43 +02:00
linux memfd: do not -EACCES old memfd_create() users with vm.memfd_noexec=2 2023-09-13 09:48:44 +02:00
math-emu
media media: cec: core: add adap_unconfigured() callback 2023-09-13 09:48:30 +02:00
memory
misc
net Bluetooth: HCI: Introduce HCI_QUIRK_BROKEN_LE_CODED 2023-09-13 09:48:44 +02:00
pcmcia
ras
rdma RDMA/cma: Always set static rate to 0 for RoCE 2023-06-11 11:26:02 +03:00
rv
scsi scsi: core: Use 32-bit hostnum in scsi_host_lookup() 2023-09-13 09:48:33 +02:00
soc net: dsa: felix: make vsc9959_tas_guard_bands_update() visible to ocelot->ops 2023-07-23 13:53:40 +02:00
sound ASoC: Intel: avs: Account for UID of ACPI device 2023-05-22 11:18:24 +01:00
target scsi: target: iscsi: Remove unused transport_timer 2023-05-22 16:29:39 -04:00
trace jbd2: remove journal_clean_one_cp_list() 2023-08-30 14:52:28 +02:00
uapi dma-buf/sync_file: Fix docs syntax 2023-09-13 09:48:29 +02:00
ufs scsi: ufs: Fix residual handling 2023-09-13 09:48:27 +02:00
vdso
video
xen