Message ID | 1482305192.15937.58.camel@kernel.crashing.org |
---|---|
State | Accepted |
Headers | show |
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes: > Depending on how it was built, gcc will use the canary from a global > (works for us) or from the TLS (doesn't work for us and accesses > random stuff instead). > > Fixing that would be tricky. There are talks of adding a gcc option > to force use of globals, but in the meantime, disable the stack > protector > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > Makefile.main | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) With the addition of -fno-stack-protector as discussed on IRC, merged: to master as of fe6f1f982b562ba855bb68fb51545f104078f546 to skiboot-5.4.x as of f51848680915eae487fefb74e2eca008b8649745 to skiboot-5.1.x as of 41cace5f87d95664e91f38ee767e01b6737c8299
diff --git a/Makefile.main b/Makefile.main index 238a1e9..1c448f7 100644 --- a/Makefile.main +++ b/Makefile.main @@ -78,12 +78,17 @@ ifeq ($(SKIBOOT_GCOV),1) CFLAGS += -fprofile-arcs -ftest-coverage -DSKIBOOT_GCOV=1 endif +# Stack protector disabled for now. gcc tends to use the TLS to +# access the canary (depending on how gcc was built), and this won't +# work for us. +# ifeq ($(STACK_CHECK),1) -CFLAGS += -fstack-protector-all -pg +#CFLAGS += -fstack-protector-all -pg +CFLAGS += -pg CPPFLAGS += -DSTACK_CHECK_ENABLED -else -CFLAGS += -fstack-protector -CFLAGS += $(call try-cflag,$(CC),-fstack-protector-strong) +#else +#CFLAGS += -fstack-protector +#CFLAGS += $(call try-cflag,$(CC),-fstack-protector-strong) endif CFLAGS += $(call try-cflag,$(CC),-Wjump-misses-init) \
Depending on how it was built, gcc will use the canary from a global (works for us) or from the TLS (doesn't work for us and accesses random stuff instead). Fixing that would be tricky. There are talks of adding a gcc option to force use of globals, but in the meantime, disable the stack protector Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- Makefile.main | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)