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: <20250821095030.GA1923@redhat.com>
Date: Thu, 21 Aug 2025 11:50:30 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Rick Edgecombe <rick.p.edgecombe@...el.com>,
	Mark Brown <broonie@...nel.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/process: fix the misleading comment about
 PF_USER_WORKERs in copy_thread()

On 08/20, Dave Hansen wrote:
>
> On 8/20/25 09:46, Oleg Nesterov wrote:
> >  	if (unlikely(args->fn)) {
> >  		/*
> > -		 * A user space thread, but it doesn't return to
> > -		 * ret_after_fork().
> > +		 * A non-PF_KTHREAD thread, but it doesn't return from
> > +		 * ret_from_fork().
> > +		 *
> > +		 * Either a PF_USER_WORKER kernel thread, in this case
> > +		 * arg->fn() must not return.
> > +		 * Or a user space task created by user_mode_thread(), in
> > +		 * this case arg->fn() can only return after a successful
> > +		 * kernel_execve().
> >  		 *
> >  		 * In order to indicate that to tools like gdb,
> >  		 * we reset the stack and instruction pointers.
> >  		 *
> >  		 * It does the same kernel frame setup to return to a kernel
> > -		 * function that a kernel thread does.
> > +		 * function that a PF_KTHREAD thread does.
> >  		 */
>
> I'm not sure that comment clarifies things,

OK, lets forger this patch then. But note that the 1st paragraph is
obviously wrong.

> especially the new
> paragraph.

I was going to fix the typos in the 1st paragraph, then decided to add more
details to clarify "doesn't return" and to "sync" this comment with the
related comment in ret_from_fork().

And to make it clear that PF_USER_WORKER can never return to usermode, this
connects to the recent discussion about PF_USER_WORKER && shstk.

> This does _not_ seem like the place to me to be explaining
> what the conventions are around arg->fn(). It would be better to put it
> near the definition or 'kernel_clone_args' or the place the function
> gets called, but not here.

Not sure. To me this comment is more about kthread_frame_init() and
ret_from_fork(). But I won't argue.

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ