Re: [PATCH RESEND 2/2] tracing: syscall_regfunc() should not skip kernel threads

From: Oleg Nesterov
Date: Fri Apr 11 2014 - 08:03:57 EST


On 04/10, Steven Rostedt wrote:
>
> On Thu, 10 Apr 2014 21:38:20 +0200
> Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>
> > I _think_ that the kernel thread can only return from "call *%rbx" if
> > it is no longer a kernel thread, iow, do_execve() was called.
>
> Ah right. But only in special cases.
>
> Actually, it only returns if the function in kernel_thread() returns,
> and in the case of ____call_usermodehelper, it does an exec and
> returns on success. But if it fails, it needs to call do_exit().

Yes. If it simply returns the kernel will crash, without start_thread/etc
"int_ret_from_sys_call" can do nothing good.

So we can conclude that "there is only one case when a kernel thread can
reach the usual syscall exit tracing path:" from cc3b13c11c567c69 is no
longer valid and we can kille the PF_KTHREAD check in regfuncs.

> Thus, it's not sufficient to just say "only if do_execve is called" but
> to say, if the handler that is called is only allowed to return iff it
> did a execve first and succeeded.

I do remember, I already told you are pedant!

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/