memfd_create01: Reject F_SEAL_EXEC over a writable mapping
PATCH 1/1 memfd_create01: Reject F_SEAL_EXEC over a writable mapping
From: Stephen Bertram <[email protected]>
On an executable memfd, F_SEAL_EXEC implies the write and size seals. Adding it while a writable shared mapping exists must fail with EBUSY. With no mapping held, the implied seals must be set.
Assisted-by Cursor <[email protected]>
Signed-off-by Stephen Bertram <[email protected]>
--- include/lapi/fcntl.h | 6 + .../syscalls/memfd_create/memfd_create01.c | 107 +++++++++++++++++- 2 files changed, 111 insertions(+), 2 deletions(-)
include/lapi/fcntl.h +6 -0
@@ -65,6 +65,12 @@#ifndef F_SEAL_WRITE # define F_SEAL_WRITE 0x0008/* prevent writes */ #endif +#ifndef F_SEAL_FUTURE_WRITE +# define F_SEAL_FUTURE_WRITE 0x0010/* prevent future writes while mapped */ +#endif +#ifndef F_SEAL_EXEC +# define F_SEAL_EXEC 0x0020/* prevent chmod modifying exec bits */ +#endif #ifndef F_OWNER_PGRP # define F_OWNER_PGRP 2
testcases/kernel/syscalls/memfd_create/memfd_create01.c +105 -2
151 lines not on this page · raw message
Signature · 5 lines
2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Stephen,
Quoted 1 line · Stephen Bertram
memfd_create01: RejectF_SEAL_EXECover a writable mapping
Verdict - Reviewed
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp