Bug 201891
Summary: | “-mstack-protector-guard-offset=xxx” got lost, for out-of-tree modules, which cause it's kernel stack corrupted | ||
---|---|---|---|
Product: | Other | Reporter: | wangxu (wangxu72) |
Component: | Modules | Assignee: | other_configuration (other_configuration) |
Status: | NEW --- | ||
Severity: | high | CC: | avadhutshedeeduwork, solarpanelcp |
Priority: | P1 | ||
Hardware: | PPC-32 | ||
OS: | Linux | ||
Kernel Version: | 4.20-rc5 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | “-mstack-protector-guard-offset=xxx” got lost, for out-of-tree modules, which cause it's kernel stack corrupted |
Created attachment 279859 [details] “-mstack-protector-guard-offset=xxx” got lost, for out-of-tree modules, which cause it's kernel stack corrupted "-mstack-protector-guard-offset=xxx" got lost, when build modules out-of-tree for PPC32 and PPC64. As a result, for out-of-tree modules, the default offset value was used( -0x7008 for PPC32), which may cause out-of-tree build modules panic. Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: cd5df2c4 CPU:0 PID: 1278 Comm: createfile Tainted G O 4.20 Call Trace: .... Further more, " $(eval KBUILD_CFLAGS_MODULE += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) " was set in arch/powerpc/Makefile only, and when build out-of-tree modules, arch/powerpc/Makefile will not be included. This patch looks ugly, but works well... --- a/Makefile 2018-12-05 15:46:18.957594000 +0800 +++ b/Makefile 2018-12-05 15:46:33.353594000 +0800 @@ -645,6 +645,11 @@ PHONY += include/config/auto.conf include/config/auto.conf: +ifdef CONFIG_PPC64 + $(eval KBUILD_CFLAGS_MODULE += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) +else ifdef CONFIG_PPC32 + $(eval KBUILD_CFLAGS_MODULE += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h)) +endif $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ Reference: 1. For gcc-7.3.0, the default stack-protector-guard-offset = TARGET_THREAD_SSP_OFFSET. gcc/config/rs6000/linux64.h #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008)