All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org, mtk.manpages@gmail.com
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@kernel.org>,
	dancol@google.com, Hugh Dickins <hughd@google.com>,
	Jann Horn <jannh@google.com>,
	John Stultz <john.stultz@linaro.org>,
	linux-api@vger.kernel.org, linux-man@vger.kernel.org,
	linux-mm@kvack.org, marcandre.lureau@redhat.com,
	Matthew Wilcox <willy@infradead.org>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Shuah Khan <shuah@kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: [PATCH -manpage 2/2] memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal
Date: Sat, 12 Jan 2019 19:14:46 -0500	[thread overview]
Message-ID: <20190113001446.158789-3-joel@joelfernandes.org> (raw)
In-Reply-To: <20190113001446.158789-1-joel@joelfernandes.org>

From: "Joel Fernandes (Google)" <joel@joelfernandes.org>

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(-)

diff --git a/man2/memfd_create.2 b/man2/memfd_create.2
index 3cd392d1b..fce2bf8d0 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, "\\t\\tg \- F_SEAL_GROW\\n");
         fprintf(stderr, "\\t\\ts \- F_SEAL_SHRINK\\n");
         fprintf(stderr, "\\t\\tw \- F_SEAL_WRITE\\n");
+        fprintf(stderr, "\\t\\tW \- F_SEAL_FUTURE_WRITE\\n");
         fprintf(stderr, "\\t\\tS \- F_SEAL_SEAL\\n");
         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("\\n");
-- 
2.20.1.97.g81188d93c3-goog


  parent reply	other threads:[~2019-01-13  0:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-13  0:14 [PATCH -manpage 0/2] Document memfd F_SEAL_FUTURE_WRITE seal Joel Fernandes
2019-01-13  0:14 ` [PATCH -manpage 1/2] fcntl.2: Update manpage with new " Joel Fernandes
2019-01-13  0:14 ` Joel Fernandes [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-14 21:48 [PATCH -manpage 0/2] Joel Fernandes (Google)
2019-03-14 21:48 ` [PATCH -manpage 2/2] memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal Joel Fernandes (Google)
2020-02-08 11:58   ` Michael Kerrisk (man-pages)
2020-02-08 11:58     ` Michael Kerrisk (man-pages)
2018-12-12 22:05 [PATCH -manpage 1/2] fcntl.2: " Joel Fernandes (Google)
2018-12-12 22:05 ` [PATCH -manpage 2/2] memfd_create.2: " Joel Fernandes (Google)
2018-11-20  5:25 [PATCH -manpage 1/2] fcntl.2: " Joel Fernandes (Google)
2018-11-20  5:25 ` [PATCH -manpage 2/2] memfd_create.2: " Joel Fernandes (Google)
2018-11-20  5:25   ` Joel Fernandes (Google)
2018-11-20  5:25   ` joel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190113001446.158789-3-joel@joelfernandes.org \
    --to=joel@joelfernandes.org \
    --cc=akpm@linux-foundation.org \
    --cc=dancol@google.com \
    --cc=hughd@google.com \
    --cc=jannh@google.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=mike.kravetz@oracle.com \
    --cc=mtk.manpages@gmail.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shuah@kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.