On Sun, Mar 02, 2025 at 02:09:36PM +0100, Oleg Nesterov wrote: > On 02/28, Christian Brauner wrote: > > > > @@ -696,6 +696,10 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags) > > return ERR_PTR(ret); > > > > pidfd_file = dentry_open(&path, flags, current_cred()); > > + /* Raise PIDFD_THREAD explicitly as dentry_open() strips it. */ > ^^^^^^^^^^^^^^^^^^^^^^^ > Hmm, does it? > > dentry_open(flags) just passes "flags" to alloc_empty_file()->init_file(), > and init_file(flags) does > > f->f_flags = flags; > > so it seems that dentry_open() -> do_dentry_open() { f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); f->f_iocb_flags = iocb_flags(f); } > > > @@ -2042,11 +2042,6 @@ static int __pidfd_prepare(struct pid *pid, unsigned int flags, struct file **re > > if (IS_ERR(pidfd_file)) > > return PTR_ERR(pidfd_file); > > > > - /* > > - * anon_inode_getfile() ignores everything outside of the > > - * O_ACCMODE | O_NONBLOCK mask, set PIDFD_THREAD manually. > > - */ > > - pidfd_file->f_flags |= (flags & PIDFD_THREAD); > > we can just kill this outdated code? Unfortunately not.