From: Mike Rapoport <rppt@linux.ibm.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>,
Michael Kerrisk <mtk.manpages@gmail.com>,
linux-man@vger.kernel.org
Subject: Re: [PATCH] memfd_secret.2: add NOTES section ...
Date: Sun, 12 Sep 2021 08:11:27 +0300 [thread overview]
Message-ID: <YT2L/0KjIW2jDwFH@linux.ibm.com> (raw)
In-Reply-To: <29fa3a87-77d6-9f41-821b-55ae8a611cbe@gmail.com>
Hi Alex,
On Fri, Sep 10, 2021 at 03:12:37PM +0200, Alejandro Colomar (man-pages) wrote:
> Hi Mike,
>
> On 9/2/21 9:50 AM, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> >
> > ... that explains the rationale for the system call
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
>
> I found a few formatting/wording issues (see below; but I fixed them myself,
> so you don't need to worry about them).
Thanks a lot!
> In general, I understood the rationale for the system call,
> so I applied the patch to my tree. However, there are some parts that I
> didn't understand well, mostly related to kernel internals, but since
> Michael knows more about those, I expect him to review those again when I
> send him the patch.
> Thanks!
>
> Alex
>
> > ---
> > man2/memfd_secret.2 | 61 +++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 61 insertions(+)
> >
> > diff --git a/man2/memfd_secret.2 b/man2/memfd_secret.2
> > index f3380818e..869480b48 100644
> > --- a/man2/memfd_secret.2
> > +++ b/man2/memfd_secret.2
> > @@ -147,6 +147,67 @@ system call first appeared in Linux 5.14.
> > The
> > .BR memfd_secret ()
> > system call is Linux-specific.
> > +.SH NOTES
> > +.PP
>
> Unnecessary .PP after .SH or .SS
>
> > +The
> > +.BR memfd_secret ()
> > +system call is designed to allow a user-space process
> > +to create a range of memory that is inaccessible to anybody else -
> > +kernel included.
> > +There is no 100% guarantee that kernel won't be able to access
> > +memory ranges backed by
> > +.BR memfd_secret ()
> > +in any circumstances, but nevertheless,
> > +it is much harder to exfiltrate data from these regions.
> > +.PP
> > +The
>
> /The/d
>
> > +.BR memfd_secret ()
> > +provides the following protections:
> > +.IP \(bu 3
> > +Enhanced protection
> > +(in conjunction with all the other in-kernel attack prevention systems)
> > +against ROP attacks.
> > +Absence of any in-kernel primitive for accessing memory backed by
> > +.BR memfd_secret ()
> > +means that one-gadget ROP attack
> > +can't work to perform data exfiltration.
> > +The attacker would need to find enough ROP gadgets
> > +to reconstruct the missing page table entries,
> > +which significantly increases difficulty of the attack,
> > +especially when other protections like the kernel stack size limit
> > +and address space layout randomization are in place.
> > +.IP \(bu
> > +Prevent cross-process userspace memory exposures.
>
> s/userspace/user-space/
>
> > +Once a region for a
> > +.BR memfd_secret ()
> > +memory mapping is allocated,
> > +the user can't accidentally pass it into the kernel
> > +to be transmitted somewhere.
> > +The memory pages in this region cannot be accessed via the direct map
> > +and they are disallowed in get_user_pages.
> > +.IP \(bu
> > +Harden against exploited kernel flaws.
> > +In order to access memory areas backed by
> > +.BR memfd_secret(),
> > +a kernel-side attack would need to
> > +either walk the page tables and create new ones,
> > +or spawn a new privileged userspace process to perform
>
> s/userspace/user-space/
>
> > +secrets exfiltration using
> > +.BR ptrace (2).
> > +.PP
> > +The way
> > +.BR memfd_secret ()
> > +allocates and locks the memory may impact overall system performance,
> > +therefore the system call is disabled by default and only available
> > +if the system administrator turned it on using
> > +"secretmem.enable=y" kernel parameter.
> > +.PP
> > +To prevent potiential data leaks of memory regions backed by
> > +.BR memfd_secret()
> > +from a hybernation image,
> > +hybernation is prevented when there are active
> > +.BR memfd_secret ()
> > +users.
> > .SH SEE ALSO
> > .BR fcntl (2),
> > .BR ftruncate (2),
> >
>
>
> --
> Alejandro Colomar
> Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
> http://www.alejandro-colomar.es/
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2021-09-12 5:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 7:50 [PATCH] memfd_secret.2: add NOTES section Mike Rapoport
2021-09-10 13:12 ` Alejandro Colomar (man-pages)
2021-09-12 5:11 ` Mike Rapoport [this message]
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=YT2L/0KjIW2jDwFH@linux.ibm.com \
--to=rppt@linux.ibm.com \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=rppt@kernel.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.