Re: [PATCH v2 2/2] x86: Rewrite ret_from_fork() in C

From: Peter Zijlstra
Date: Wed Jul 19 2023 - 16:02:51 EST


On Wed, Jul 19, 2023 at 05:21:11PM +0200, Petr Mladek wrote:

> This patch broke livepatching. Kthreads never have a reliable stack.
> It works when I revert it.

> > +SYM_CODE_START(ret_from_fork_asm)
> > + UNWIND_HINT_REGS

It works again when I change the above hint to UNWIND_HINT_END_OF_STACK,
so yeah. Doing this makes objtool unhappy with something else though,
so I'll go prod at things with something sharp...

Thanks!

> > ANNOTATE_NOENDBR // copy_thread
> > CALL_DEPTH_ACCOUNT
> >
> > + movq %rax, %rdi /* prev */
> > + movq %rsp, %rsi /* regs */
> > + movq %rbx, %rdx /* fn */
> > + movq %r12, %rcx /* fn_arg */
> > + call ret_from_fork
> >
> > +SYM_CODE_END(ret_from_fork_asm)