lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250414-boiler-expedition-3f27837c513f@brauner>
Date: Mon, 14 Apr 2025 16:41:21 +0200
From: Christian Brauner <brauner@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: linux-fsdevel@...r.kernel.org, Luca Boccassi <luca.boccassi@...il.com>, 
	Lennart Poettering <lennart@...ttering.net>, Daan De Meyer <daan.j.demeyer@...il.com>, 
	Mike Yuan <me@...dnzj.com>, Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] coredump: hand a pidfd to the usermode coredump
 helper

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!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ