[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e3bb7054-c430-232d-7316-bf531218eed8@oracle.com>
Date: Mon, 24 Jan 2022 10:35:00 -0800
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Hugh Dickins <hughd@...gle.com>, Aleksa Sarai <cyphar@...har.com>
Cc: Kir Kolyshkin <kolyshkin@...il.com>, linux-man@...r.kernel.org,
Michael Kerrisk <mtk.manpages@...il.com>,
David Herrmann <dh.herrmann@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fcntl.2: document F_GET_SEALS on tmpfs peculiarity
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@...il.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@...har.com>
>>> Cc: David Herrmann <dh.herrmann@...il.com>
>>> Signed-off-by: Kir Kolyshkin <kolyshkin@...il.com>
>
> Acked-by: Hugh Dickins <hughd@...gle.com>
Acked-by: Mike Kravetz <mike.kravetz@...cle.com>
--
Mike Kravetz
Powered by blists - more mailing lists