[PATCH v2 04/47] mm/memfd: make f_pos accesses atomic
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Oct 29 20:40:21 PDT 2026
> From: Josef Bacik <josef at toxicpanda.com>
>
> 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:
>
> CPU0 CPU1
> write(memfd, "a", 1) write(memfd, "b", 1)
> pos = file->f_pos (= 0)
> pos = file->f_pos (= 0)
> vfs_write(..., &pos)
> vfs_write(..., &pos)
> [ ... ]
> Acked-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> Reviewed-by: Pedro Falcato <pfalcato at suse.de>
> Reviewed-by: Kiryl Shutsemau (Meta) <kas at kernel.org>
> Reviewed-by: Pasha Tatashin <pasha.tatashin at soleen.com>
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029-fixes_core-v2-0-a64ce7f83abb@kernel.org?part=4
More information about the kexec
mailing list