Re: [PATCH 04/46] mm/memfd: make f_pos accesses atomic
From: David Hildenbrand (Arm)
Date: Tue Oct 27 2026 - 15:10:07 EST
On 10/27/26 04:34, Gregory Price wrote:
> On 2026-10-27 00:17 +0100, David Hildenbrand (Arm) wrote:
>> From: Josef Bacik <josef@xxxxxxxxxxxxxx>
>>
>> Commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX") made
>> read(), write() and lseek() on a shared open file description of a regular
>> file serialize on ->f_pos_lock. The flag that asks for it,
>> FMODE_ATOMIC_POS, is set in do_dentry_open(). A memfd is a regular file
>> too, but its struct file comes from alloc_file_pseudo() and never passes
>> through do_dentry_open(), so it does not get the flag:
>>
> ... snip ...
>>
>> Fixes: 9183df25fe7b ("shm: add memfd_create() syscall")
>> Cc: stable@xxxxxxxxxxxxxxx
>> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
>> [ david: minor description tweaks ]
>> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
> Reviewed-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> Tested-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
Thanks!
>
> This one arguably should have at least a trivial selftest.
Yes, best to bundle some of these and send them out after the fixes landed. Thanks!
--
Cheers,
David