Skip to contentSkip to conversation

memfd_create01: Reject F_SEAL_EXEC over a writable mapping

PATCH In review Stephen Bertram via ltp 2 participants 2 messages Nov 5

lore
Share & tools
lore
#0 lore raw

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.

---
 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
index d70954ea7..d826acba5 100644
@@ -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
#1 lore raw

Hi Stephen,

Quoted 1 line · Stephen Bertram

memfd_create01: Reject F_SEAL_EXEC over 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