Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] man/man2const/F_{ADD,GET}_SEALS.2const: document F_SEAL_EXEC
@ 2026-05-29 14:05 Pratyush Yadav
  2026-06-01 23:41 ` Alejandro Colomar
  0 siblings, 1 reply; 2+ messages in thread
From: Pratyush Yadav @ 2026-05-29 14:05 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: Pratyush Yadav (Google), David Hildenbrand, Daniel Verkamp,
	Jeff Xu, Pasha Tatashin, Baolin Wang, Hugh Dickins, linux-man,
	linux-mm

From: "Pratyush Yadav (Google)" <pratyush@kernel.org>

F_SEAL_EXEC was added in Linux v6.3. It blocks changing of the exec bits
once added. Document it.

Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
---

Notes:
    I discovered this was missing when working on [0]. I had to look at the
    code to figure out how it was supposed to behave.
    
    Changes in v2:
    - Re-write the documentation by hand.
    
    [0] https://lore.kernel.org/linux-mm/20260505133922.797635-1-pratyush@kernel.org/

 man/man2const/F_GET_SEALS.2const | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/man/man2const/F_GET_SEALS.2const b/man/man2const/F_GET_SEALS.2const
index 175025c10..f41e1748a 100644
--- a/man/man2const/F_GET_SEALS.2const
+++ b/man/man2const/F_GET_SEALS.2const
@@ -176,6 +176,25 @@ will fail with
 Using this seal,
 one process can create a memory buffer that it can continue to modify
 while sharing that buffer on a "read-only" basis with other processes.
+.TP
+.BR F_SEAL_EXEC " (since Linux 6.3)"
+If this seal is set, the execute mode bits of the file cannot be modified.
+Attempting to change the execute mode bits via
+.BR fchmod (2)
+or similar will fail with
+.BR EPERM .
+This results in a memfd that is either permanently executable or
+permanently un-executable.
+.IP
+Adding this seal implicitly adds
+.BR F_SEAL_GROW ,
+.BR F_SEAL_SHRINK ,
+.BR F_SEAL_WRITE ,
+and
+.BR F_SEAL_FUTURE_WRITE .
+This ensures that the executable code is not writeable.
+All the pre-requisites to add the implied seals must be met to successfully add
+.BR F_SEAL_EXEC .
 .SH RETURN VALUE
 .TP
 .B F_GET_SEALS

base-commit: 9db8ca91f920b9aba40ed68de6b8da0ca9dbefaa
-- 
2.54.0.1013.g208068f2d8-goog



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] man/man2const/F_{ADD,GET}_SEALS.2const: document F_SEAL_EXEC
  2026-05-29 14:05 [PATCH v2] man/man2const/F_{ADD,GET}_SEALS.2const: document F_SEAL_EXEC Pratyush Yadav
@ 2026-06-01 23:41 ` Alejandro Colomar
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro Colomar @ 2026-06-01 23:41 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: David Hildenbrand, Daniel Verkamp, Jeff Xu, Pasha Tatashin,
	Baolin Wang, Hugh Dickins, linux-man, linux-mm

[-- Attachment #1: Type: text/plain, Size: 3362 bytes --]

Hi Pratyush,

On 2026-05-29T16:05:55+0200, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
> 
> F_SEAL_EXEC was added in Linux v6.3. It blocks changing of the exec bits
> once added. Document it.
> 
> Signed-off-by: Pratyush Yadav (Google) <pratyush@kernel.org>
> ---
> 
> Notes:
>     I discovered this was missing when working on [0]. I had to look at the
>     code to figure out how it was supposed to behave.
>     
>     Changes in v2:
>     - Re-write the documentation by hand.
>     
>     [0] https://lore.kernel.org/linux-mm/20260505133922.797635-1-pratyush@kernel.org/

Thanks!  I've applied the patch, with a few minor tweaks:

	diff --git i/man/man2const/F_GET_SEALS.2const w/man/man2const/F_GET_SEALS.2const
	index f41e1748acd0..686a92fddefe 100644
	--- i/man/man2const/F_GET_SEALS.2const
	+++ w/man/man2const/F_GET_SEALS.2const
	@@ -178,13 +178,15 @@ .SH DESCRIPTION
	 while sharing that buffer on a "read-only" basis with other processes.
	 .TP
	 .BR F_SEAL_EXEC " (since Linux 6.3)"
	-If this seal is set, the execute mode bits of the file cannot be modified.
	+If this seal is set,
	+the execute mode bits of the file cannot be modified.
	 Attempting to change the execute mode bits via
	 .BR fchmod (2)
	 or similar will fail with
	 .BR EPERM .
	-This results in a memfd that is either permanently executable or
	-permanently un-executable.
	+This results in a memfd that is
	+either permanently executable
	+or permanently not executable.
	 .IP
	 Adding this seal implicitly adds
	 .BR F_SEAL_GROW ,
	@@ -193,7 +195,8 @@ .SH DESCRIPTION
	 and
	 .BR F_SEAL_FUTURE_WRITE .
	 This ensures that the executable code is not writeable.
	-All the pre-requisites to add the implied seals must be met to successfully add
	+All the pre-requisites to add the implied seals must be met
	+to successfully add
	 .BR F_SEAL_EXEC .
	 .SH RETURN VALUE
	 .TP


Have a lovely night!
Alex

> 
>  man/man2const/F_GET_SEALS.2const | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/man/man2const/F_GET_SEALS.2const b/man/man2const/F_GET_SEALS.2const
> index 175025c10..f41e1748a 100644
> --- a/man/man2const/F_GET_SEALS.2const
> +++ b/man/man2const/F_GET_SEALS.2const
> @@ -176,6 +176,25 @@ will fail with
>  Using this seal,
>  one process can create a memory buffer that it can continue to modify
>  while sharing that buffer on a "read-only" basis with other processes.
> +.TP
> +.BR F_SEAL_EXEC " (since Linux 6.3)"
> +If this seal is set, the execute mode bits of the file cannot be modified.
> +Attempting to change the execute mode bits via
> +.BR fchmod (2)
> +or similar will fail with
> +.BR EPERM .
> +This results in a memfd that is either permanently executable or
> +permanently un-executable.
> +.IP
> +Adding this seal implicitly adds
> +.BR F_SEAL_GROW ,
> +.BR F_SEAL_SHRINK ,
> +.BR F_SEAL_WRITE ,
> +and
> +.BR F_SEAL_FUTURE_WRITE .
> +This ensures that the executable code is not writeable.
> +All the pre-requisites to add the implied seals must be met to successfully add
> +.BR F_SEAL_EXEC .
>  .SH RETURN VALUE
>  .TP
>  .B F_GET_SEALS
> 
> base-commit: 9db8ca91f920b9aba40ed68de6b8da0ca9dbefaa
> -- 
> 2.54.0.1013.g208068f2d8-goog
> 
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-01 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 14:05 [PATCH v2] man/man2const/F_{ADD,GET}_SEALS.2const: document F_SEAL_EXEC Pratyush Yadav
2026-06-01 23:41 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox