Skip to content

Commit 00b55ea

Browse files
svens-s390hcahca
authored andcommitted
s390/vdso: filter out -mstack-guard and -mstack-size
When CONFIG_VMAP_STACK is disabled, the user can enable CONFIG_STACK_CHECK, which adds a stack overflow check to each C function in the kernel. This is also done for functions in the vdso page. These functions are run in user context and user stack sizes are usually different to what the kernel uses. This might trigger the stack check although the stack size is valid. Therefore filter the -mstack-guard and -mstack-size flags when compiling vdso C files. Cc: [email protected] # 5.10+ Fixes: 4bff8cb ("s390: convert to GENERIC_VDSO") Reported-by: Janosch Frank <[email protected]> Signed-off-by: Sven Schnelle <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 7b737ad commit 00b55ea

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

arch/s390/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
7777
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
7878

7979
ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),)
80-
cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
81-
ifeq ($(call cc-option,-mstack-size=8192),)
82-
cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
83-
endif
80+
CC_FLAGS_CHECK_STACK := -mstack-size=$(STACK_SIZE)
81+
ifeq ($(call cc-option,-mstack-size=8192),)
82+
CC_FLAGS_CHECK_STACK += -mstack-guard=$(CONFIG_STACK_GUARD)
83+
endif
84+
export CC_FLAGS_CHECK_STACK
85+
cflags-$(CONFIG_CHECK_STACK) += $(CC_FLAGS_CHECK_STACK)
8486
endif
8587

8688
ifdef CONFIG_EXPOLINE

arch/s390/kernel/vdso64/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ ARCH_REL_TYPE_ABS += R_390_GOT|R_390_PLT
88
include $(srctree)/lib/vdso/Makefile
99
obj-vdso64 = vdso_user_wrapper.o note.o
1010
obj-cvdso64 = vdso64_generic.o getcpu.o
11-
CFLAGS_REMOVE_getcpu.o = -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE)
12-
CFLAGS_REMOVE_vdso64_generic.o = -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE)
11+
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE) $(CC_FLAGS_CHECK_STACK)
12+
CFLAGS_REMOVE_getcpu.o = $(VDSO_CFLAGS_REMOVE)
13+
CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
1314

1415
# Build rules
1516

0 commit comments

Comments
 (0)