Re: [PATCH v2 3/3] coredump: hand a pidfd to the usermode coredump helper

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

 



On Mon, Apr 14, 2025 at 04:28:07PM +0200, Oleg Nesterov wrote:
> On 04/14, Oleg Nesterov wrote:
> >
> > On 04/14, Christian Brauner wrote:
> > >
> > > -static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
> > > +static int umh_coredump_setup(struct subprocess_info *info, struct cred *new)
> > >  {
> > >  	struct file *files[2];
> > >  	struct coredump_params *cp = (struct coredump_params *)info->data;
> > >  	int err;
> > >
> > > +	if (cp->pid) {
> > > +		struct file *pidfs_file __free(fput) = NULL;
> > > +
> > > +		pidfs_file = pidfs_alloc_file(cp->pid, 0);
> > > +		if (IS_ERR(pidfs_file))
> > > +			return PTR_ERR(pidfs_file);
> > > +
> > > +		/*
> > > +		 * Usermode helpers are childen of either
> > > +		 * system_unbound_wq or of kthreadd. So we know that
> > > +		 * we're starting off with a clean file descriptor
> > > +		 * table. So we should always be able to use
> > > +		 * COREDUMP_PIDFD_NUMBER as our file descriptor value.
> > > +		 */
> > > +		VFS_WARN_ON_ONCE((pidfs_file = fget_raw(COREDUMP_PIDFD_NUMBER)) != NULL);
> > > +
> > > +		err = replace_fd(COREDUMP_PIDFD_NUMBER, pidfs_file, 0);
> > > +		if (err < 0)
> > > +			return err;
> >
> > Yes, but if replace_fd() succeeds we need to nullify pidfs_file
> > to avoid fput from __free(fput) ?
> 
> Aah, please ignore me ;) replace_fd/do_dup2 does get_file() .
> 
> For this series:

Thanks for the excellent review as usual!




[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