From: Mike Kravetz <mike.kravetz@oracle.com>
To: Hugh Dickins <hughd@google.com>, Aleksa Sarai <cyphar@cyphar.com>
Cc: Kir Kolyshkin <kolyshkin@gmail.com>,
linux-man@vger.kernel.org,
Michael Kerrisk <mtk.manpages@gmail.com>,
David Herrmann <dh.herrmann@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fcntl.2: document F_GET_SEALS on tmpfs peculiarity
Date: Mon, 24 Jan 2022 10:35:00 -0800 [thread overview]
Message-ID: <e3bb7054-c430-232d-7316-bf531218eed8@oracle.com> (raw)
In-Reply-To: <d7ca2658-b63b-7437-9bd0-82bc59c7c981@google.com>
On 1/23/22 20:18, Hugh Dickins wrote:
> On Sat, 22 Jan 2022, Aleksa Sarai wrote:
>
>> Adding the maintainers of mm/{shmem,memfd}.c and fs/hugetlbfs/ just in
>> case this was not intended behaviour.
>
> Kir is correct - thanks - and it is intended behaviour. Not consciously
> intended to make for a difficult manpage, but the implementation was
> intended to be simple, so tmpfs and hugetlbfs do not internally
> distinguish memfd objects from filesystem files - their filesystem
> files simply start off with F_SEAL_SEAL to rule out any sealing.
>
Thanks Hugh, I agree.
>> On 2022-01-21, Kir Kolyshkin <kolyshkin@gmail.com> wrote:
>>> Currently, from the description of file sealing it can be deduced that
>>> unless the fd is a memfd, all sealing operations fail with EINVAL.
>>>
>>> Apparently, it's not true for tmpfs or hugetlbfs -- F_GET_SEALS returns
>>> 1 (F_SEAL_SEAL) for an fd opened on these filesystems (probably because
>>> those are used to back memfd files).
>>>
>>> Fix the description to mention that peculiarity. Not knowing this can
>>> result in incorrect code logic (see [1], where the code mistook a
>>> descriptor of a file opened on on tmpfs for a memfd).
>>>
>>> While at it, clarify that fcntl does not actually return EINVAL, but
>>> sets errno to it (as it is usually said elsewhere).
>>>
>>> [1] https://github.com/opencontainers/runc/pull/3342
>>>
>>> Cc: Aleksa Sarai <cyphar@cyphar.com>
>>> Cc: David Herrmann <dh.herrmann@gmail.com>
>>> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
>
> Acked-by: Hugh Dickins <hughd@google.com>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz
prev parent reply other threads:[~2022-01-24 18:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220122005251.1441343-1-kolyshkin@gmail.com>
[not found] ` <20220122090441.ktxh43lpgsd2dxj4@senku>
2022-01-24 4:18 ` [PATCH] fcntl.2: document F_GET_SEALS on tmpfs peculiarity Hugh Dickins
2022-01-24 18:35 ` Mike Kravetz [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=e3bb7054-c430-232d-7316-bf531218eed8@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=cyphar@cyphar.com \
--cc=dh.herrmann@gmail.com \
--cc=hughd@google.com \
--cc=kolyshkin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtk.manpages@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).