Re: [PATCH] file: always lock position

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 24, 2023 at 08:53:32AM -0700, Linus Torvalds wrote:
> Is it too late to just fix pidfd_getfd() to duplicate the 'struct
> file', and act like a new open, and act like /proc/<pid>/fd/<xyz>?

So thinking a little about it I think that doesn't work.
/proc/<pid>/fd/<xyz> does a reopen and for good reasons. The original
open will have gone through the module's/subsytem's ->open() method
which might stash additional refcounted data in e.g., file->private_data
if we simply copy that file or sm then we risk UAFs. If we don't skip
->open() though and effectively emulate /proc/<pid>/fd/<xyz> completely
then we break any such use-cases where a socket or something else is
shared as they cannot be reopened. So the module/subsystem really needs
to be informed that a new struct file is created and not simply refd.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux