Re: [PATCH v2] man/man2const/F_{ADD,GET}_SEALS.2const: document F_SEAL_EXEC

Alejandro Colomar <[email protected]> Tue, 2 Jun 2026 01:41:48 +0200
Newsgroups org.kernel.vger.linux-man,org.kvack.linux-mm
Message-ID <ah4YmXpL6rxHlo4r@devuan>
Hi Pratyush,

On 2026-05-29T16:05:55+0200, Pratyush Yadav wrote:
> From: "Pratyush Yadav (Google)" <[email protected]>
> 
> 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) <[email protected]>
> ---
> 
> 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/[email protected]/

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>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmoeGLwACgkQ64mZXMKQ
wqlumw//R7PxIUzCmHCHyJWiab8qt4v7Y9PBVejZoH7w7WSFvfQ4jOBXwNgQ6/4l
mY4p04QrV07jGNbiEENcyOIpjVPCp/ziub5Wg8IK86jmhq+P1KGpTIEtJTNa83oO
zegeo0R469vpW2ABOOZX0L0z+NnPmQD9TwIqTNEs9QV5V0BaJY/vwFpLm1bw3hRW
Hm1QTUUk0WCP0gZQ7oHvK4U3gTff2pEfxpTPGhxQ0vSBs+c1xx0C4GE+DWb2MD2E
G5fkdVfV1ggx6xZ1z0mRBQKN0u8d745nXIOwCoA3bMBx1BL4vpxnm0610tslc0jB
6MYRIw5U6UnzqLVCBa+I3v2gCFVFj7yO6HJWZ8n0aEMJq1E0WK2nOmFNedWqi7wS
EUo0F29Eg4Gl3TVAFt8P5WdMh/czz3D1vG32B6kClEQLQ8fFyzeYd3jZZ0v7eJz5
MR0nSjaDOflJme8cLe2GEr1D0SwROc95bVv5ezUqzFhTIdyeCfzR4BsPJNQXm7Zb
WLQoy4b8IsqAU+VP486ZyLDv8/vjcGDWi/anW3ZawIPZvLopKVVmVXSNwe6heMAI
CKuQVgxq06Gfy8qJhBIISqjYZwISPJaGD3+nxx1VQbOVUzSicK7hSSZkmAOwfH77
y7ZFpXGudIHOPWjvh09z5/y7JBCo1k+9h/3f/CngXuweHounNHk=
=7Zav
-----END PGP SIGNATURE-----