From: Jiri Slaby <jslaby@suse.cz>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org, Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH] x86/unwind/orc: fix inactive tasks with sp in sp
Date: Wed, 14 Oct 2020 07:08:52 +0200 [thread overview]
Message-ID: <3d0efc97-536c-c669-934a-d2d9feaa90c7@suse.cz> (raw)
In-Reply-To: <20201007145450.32yrrq75csmq7vgo@treble>
On 07. 10. 20, 16:54, Josh Poimboeuf wrote:
> -ENOPARSE on $SUBJECT.
>
> Also please address it to x86@kernel.org, I think the tip maintainers
> can pick up the fix directly.
Hmm, weird, I must have sent an older version as my current patch in the
tree has:
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
> 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?
gcc 7 generated the earlier mentioned prologue (push bp; mov sp,bp). So
we extract stack pointer from bp. gcc 10 no longer generates the
prologue in some of the standalone functions. That's the difference. So
we started extracting stack pointer from sp which contains more than we
expect.
And the problem also (obviously) dismisses when gcc (even 10) inlines
the function.
>> @@ -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!
OK, will resend the correct and fixed version.
thanks,
--
js
suse labs
prev parent reply other threads:[~2020-10-14 5:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 8:19 Jiri Slaby
2020-10-07 14:54 ` Josh Poimboeuf
2020-10-14 5:08 ` Jiri Slaby [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d0efc97-536c-c669-934a-d2d9feaa90c7@suse.cz \
--to=jslaby@suse.cz \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®