Re: [PATCH] x86/unwind/orc: fix inactive tasks with sp in sp

From: Josh Poimboeuf
Date: Wed Oct 07 2020 - 10:55:02 EST


-ENOPARSE on $SUBJECT.

Also please address it to x86@xxxxxxxxxx, I think the tip maintainers
can pick up the fix directly.

Also it might be a good idea to Cc the live-patching mailing list, I
presume this causes a livepatch stall?

On Wed, Oct 07, 2020 at 10:19:09AM +0200, Jiri Slaby wrote:
> gcc-10 optimizes the scheduler code differently than its predecessors,
> depending on DEBUG_SECTION_MISMATCH=y config -- the config sets
> -fno-inline-functions-called-once.

Weird. Was GCC ignoring this flag before?

> @@ -663,7 +656,13 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
> } else {
> struct inactive_task_frame *frame = (void *)task->thread.sp;
>
> - state->sp = task->thread.sp;
> + /*
> + * @ret_addr is in __schedule _before_ the @frame is pushed to
> + * the stack, but @thread.sp is saved in __switch_to_asm only
> + * _after_ saving the @frame, so subtract the @frame size, i.e.
> + * add it to @thread.sp.
> + */
> + state->sp = task->thread.sp + sizeof(*frame);

IMO, the code speaks for itself and the comment may be superfluous.

Otherwise it looks good to me. Thanks for fixing it!

--
Josh