diff mbox series

[-manpage,2/2] memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal

Message ID 20190314214844.207430-3-joel@joelfernandes.org (mailing list archive)
State New, archived
Headers show
Series [-manpage,1/2] fcntl.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal | expand

Commit Message

Joel Fernandes March 14, 2019, 9:48 p.m. UTC
More details of the seal can be found in the LKML patch:
https://lore.kernel.org/lkml/20181120052137.74317-1-joel@joelfernandes.org/T/#t

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 man2/memfd_create.2 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Michael Kerrisk (man-pages) Feb. 8, 2020, 11:58 a.m. UTC | #1
Hello Joel,

On 3/14/19 10:48 PM, Joel Fernandes (Google) wrote:
> More details of the seal can be found in the LKML patch:
> https://lore.kernel.org/lkml/20181120052137.74317-1-joel@joelfernandes.org/T/#t
> 
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>

Thanks! Patch applied

Cheers,

Michael



> ---
>  man2/memfd_create.2 | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/man2/memfd_create.2 b/man2/memfd_create.2
> index 15b1362f5525..3b7f032407ed 100644
> --- a/man2/memfd_create.2
> +++ b/man2/memfd_create.2
> @@ -280,7 +280,15 @@ in order to restrict further modifications on the file.
>  (If placing the seal
>  .BR F_SEAL_WRITE ,
>  then it will be necessary to first unmap the shared writable mapping
> -created in the previous step.)
> +created in the previous step. Otherwise, behavior similar to
> +.BR F_SEAL_WRITE
> +can be achieved, by using
> +.BR F_SEAL_FUTURE_WRITE
> +which will prevent future writes via
> +.BR mmap (2)
> +and
> +.BR write (2)
> +from succeeding, while keeping existing shared writable mappings).
>  .IP 4.
>  A second process obtains a file descriptor for the
>  .BR tmpfs (5)
> @@ -425,6 +433,7 @@ main(int argc, char *argv[])
>          fprintf(stderr, "\et\etg \- F_SEAL_GROW\en");
>          fprintf(stderr, "\et\ets \- F_SEAL_SHRINK\en");
>          fprintf(stderr, "\et\etw \- F_SEAL_WRITE\en");
> +        fprintf(stderr, "\et\etW \- F_SEAL_FUTURE_WRITE\en");
>          fprintf(stderr, "\et\etS \- F_SEAL_SEAL\en");
>          exit(EXIT_FAILURE);
>      }
> @@ -463,6 +472,8 @@ main(int argc, char *argv[])
>              seals |= F_SEAL_SHRINK;
>          if (strchr(seals_arg, \(aqw\(aq) != NULL)
>              seals |= F_SEAL_WRITE;
> +        if (strchr(seals_arg, \(aqW\(aq) != NULL)
> +            seals |= F_SEAL_FUTURE_WRITE;
>          if (strchr(seals_arg, \(aqS\(aq) != NULL)
>              seals |= F_SEAL_SEAL;
>  
> @@ -518,6 +529,8 @@ main(int argc, char *argv[])
>          printf(" GROW");
>      if (seals & F_SEAL_WRITE)
>          printf(" WRITE");
> +    if (seals & F_SEAL_FUTURE_WRITE)
> +        printf(" FUTURE_WRITE");
>      if (seals & F_SEAL_SHRINK)
>          printf(" SHRINK");
>      printf("\en");
>
diff mbox series

Patch

diff --git a/man2/memfd_create.2 b/man2/memfd_create.2
index 15b1362f5525..3b7f032407ed 100644
--- a/man2/memfd_create.2
+++ b/man2/memfd_create.2
@@ -280,7 +280,15 @@  in order to restrict further modifications on the file.
 (If placing the seal
 .BR F_SEAL_WRITE ,
 then it will be necessary to first unmap the shared writable mapping
-created in the previous step.)
+created in the previous step. Otherwise, behavior similar to
+.BR F_SEAL_WRITE
+can be achieved, by using
+.BR F_SEAL_FUTURE_WRITE
+which will prevent future writes via
+.BR mmap (2)
+and
+.BR write (2)
+from succeeding, while keeping existing shared writable mappings).
 .IP 4.
 A second process obtains a file descriptor for the
 .BR tmpfs (5)
@@ -425,6 +433,7 @@  main(int argc, char *argv[])
         fprintf(stderr, "\et\etg \- F_SEAL_GROW\en");
         fprintf(stderr, "\et\ets \- F_SEAL_SHRINK\en");
         fprintf(stderr, "\et\etw \- F_SEAL_WRITE\en");
+        fprintf(stderr, "\et\etW \- F_SEAL_FUTURE_WRITE\en");
         fprintf(stderr, "\et\etS \- F_SEAL_SEAL\en");
         exit(EXIT_FAILURE);
     }
@@ -463,6 +472,8 @@  main(int argc, char *argv[])
             seals |= F_SEAL_SHRINK;
         if (strchr(seals_arg, \(aqw\(aq) != NULL)
             seals |= F_SEAL_WRITE;
+        if (strchr(seals_arg, \(aqW\(aq) != NULL)
+            seals |= F_SEAL_FUTURE_WRITE;
         if (strchr(seals_arg, \(aqS\(aq) != NULL)
             seals |= F_SEAL_SEAL;
 
@@ -518,6 +529,8 @@  main(int argc, char *argv[])
         printf(" GROW");
     if (seals & F_SEAL_WRITE)
         printf(" WRITE");
+    if (seals & F_SEAL_FUTURE_WRITE)
+        printf(" FUTURE_WRITE");
     if (seals & F_SEAL_SHRINK)
         printf(" SHRINK");
     printf("\en");