From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@ozlabs.org
Cc: abdhalee@linux.vnet.ibm.com, joel@jms.id.au
Subject: Re: powerpc: Fix stack protector crashes on CPU hotplug
Date: Mon, 22 Oct 2018 20:40:29 +1100 (AEDT) [thread overview]
Message-ID: <42ds2P5bdVz9sDJ@ozlabs.org> (raw)
In-Reply-To: <20181019055927.20009-1-mpe@ellerman.id.au>
On Fri, 2018-10-19 at 05:59:27 UTC, Michael Ellerman wrote:
> Recently in commit 7241d26e8175 ("powerpc/64: properly initialise
> the stackprotector canary on SMP.") we fixed a crash with stack
> protector on SMP by initialising the stack canary in
> cpu_idle_thread_init().
>
> But this can also causes crashes, when a CPU comes back online after
> being offline:
>
> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: pnv_smp_cpu_kill_self+0x2a0/0x2b0
> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.0-rc3-gcc-7.3.1-00168-g4ffe713b7587 #94
> Call Trace:
> dump_stack+0xb0/0xf4 (unreliable)
> panic+0x144/0x328
> __stack_chk_fail+0x2c/0x30
> pnv_smp_cpu_kill_self+0x2a0/0x2b0
> cpu_die+0x48/0x70
> arch_cpu_idle_dead+0x20/0x40
> do_idle+0x274/0x390
> cpu_startup_entry+0x38/0x50
> start_secondary+0x5e4/0x600
> start_secondary_prolog+0x10/0x14
>
> Looking at the stack we see that the canary value in the stack frame
> doesn't match the canary in the task/paca. That is because we have
> reinitialised the task/paca value, but then the CPU coming online has
> returned into a function using the old canary value. That causes the
> comparison to fail.
>
> Instead we can call boot_init_stack_canary() from start_secondary()
> which never returns. This is essentially what the generic code does in
> cpu_startup_entry() under #ifdef X86, we should make that non-x86
> specific in a future patch.
>
> Fixes: 7241d26e8175 ("powerpc/64: properly initialise the stackprotector canary on SMP.")
> Reported-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/b6aeddea74b08518289fc86545297c
cheers
next prev parent reply other threads:[~2018-10-22 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-19 5:59 [PATCH] powerpc: Fix stack protector crashes on CPU hotplug Michael Ellerman
2018-10-19 6:20 ` Christophe LEROY
2018-10-21 8:37 ` Michael Ellerman
2018-10-22 9:40 ` Michael Ellerman [this message]
2018-10-22 13:40 ` Abdul Haleem
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=42ds2P5bdVz9sDJ@ozlabs.org \
--to=patch-notifications@ellerman.id.au \
--cc=abdhalee@linux.vnet.ibm.com \
--cc=joel@jms.id.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).