From: Michael Ellerman <mpe@ellerman.id.au>
To: Samuel Holland <samuel@sholland.org>,
Christophe Leroy <christophe.leroy@c-s.fr>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>
Subject: Re: [PATCH v5 1/2] powerpc/32: add stack protector support
Date: Mon, 14 Jan 2019 11:46:40 +1100 [thread overview]
Message-ID: <87k1j8dq1b.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <f5600a1d-71ca-f1d7-3973-026462990059@sholland.org>
Samuel Holland <samuel@sholland.org> writes:
> Hello all,
>
> On 09/27/18 02:05, Christophe Leroy wrote:
> [..snip..]
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index 07d9dce7eda6..45b8eb4d8fe7 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -112,6 +112,9 @@ KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
>> KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
>> endif
>>
>> +cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls
>> +cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
>> +
>> LDFLAGS_vmlinux-y := -Bstatic
>> LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
>> LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
>> @@ -404,6 +407,13 @@ archclean:
>>
>> archprepare: checkbin
>>
>> +ifdef CONFIG_STACKPROTECTOR
>> +prepare: stack_protector_prepare
>> +
>> +stack_protector_prepare: prepare0
>> + $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
>> +endif
>> +
>
> This breaks when building out-of-tree kernel modules. GCC is not getting passed
> the -mstack-protector-guard-offset argument, so the default offset is used. The
> kernel then panics the first time a function with stack protector is called.
>
> I'm seeing this on powerpc64. It looks like it was reported for powerpc on
> kernel bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201891
Thanks for the bug report.
Alexey also hit this and sent an RFC fix.
https://patchwork.ozlabs.org/patch/1022751/
But Masahiro thought we could do something less hacky, and hopefully he
can help us come up with something better.
cheers
prev parent reply other threads:[~2019-01-14 0:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 7:05 Christophe Leroy
2018-09-27 7:05 ` [PATCH v5 2/2] powerpc/64: " Christophe Leroy
2018-10-04 6:14 ` [v5,1/2] powerpc/32: " Michael Ellerman
2019-01-12 23:32 ` [PATCH v5 1/2] " Samuel Holland
2019-01-14 0:46 ` Michael Ellerman [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=87k1j8dq1b.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=Jason@zx2c4.com \
--cc=aik@ozlabs.ru \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=samuel@sholland.org \
--cc=yamada.masahiro@socionext.com \
/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®