lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 219/279] s390/vdso: filter out -mstack-guard and -mstack-size
    Date
    From: Sven Schnelle <svens@linux.ibm.com>

    commit 00b55eaf45549ce26424224d069a091c7e5d8bac upstream.

    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: stable@kernel.org # 5.10+
    Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
    Reported-by: Janosch Frank <frankja@linux.ibm.com>
    Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
    Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    arch/s390/Makefile | 10 ++++++----
    arch/s390/kernel/vdso64/Makefile | 5 +++--
    2 files changed, 9 insertions(+), 6 deletions(-)

    --- a/arch/s390/Makefile
    +++ b/arch/s390/Makefile
    @@ -79,10 +79,12 @@ KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y
    KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)

    ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),)
    -cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
    -ifeq ($(call cc-option,-mstack-size=8192),)
    -cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
    -endif
    + CC_FLAGS_CHECK_STACK := -mstack-size=$(STACK_SIZE)
    + ifeq ($(call cc-option,-mstack-size=8192),)
    + CC_FLAGS_CHECK_STACK += -mstack-guard=$(CONFIG_STACK_GUARD)
    + endif
    + export CC_FLAGS_CHECK_STACK
    + cflags-$(CONFIG_CHECK_STACK) += $(CC_FLAGS_CHECK_STACK)
    endif

    ifdef CONFIG_EXPOLINE
    --- a/arch/s390/kernel/vdso64/Makefile
    +++ b/arch/s390/kernel/vdso64/Makefile
    @@ -8,8 +8,9 @@ ARCH_REL_TYPE_ABS += R_390_GOT|R_390_PLT
    include $(srctree)/lib/vdso/Makefile
    obj-vdso64 = vdso_user_wrapper.o note.o
    obj-cvdso64 = vdso64_generic.o getcpu.o
    -CFLAGS_REMOVE_getcpu.o = -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE)
    -CFLAGS_REMOVE_vdso64_generic.o = -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE)
    +VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE) $(CC_FLAGS_CHECK_STACK)
    +CFLAGS_REMOVE_getcpu.o = $(VDSO_CFLAGS_REMOVE)
    +CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)

    # Build rules


    \
     
     \ /
      Last update: 2021-11-24 15:02    [W:4.611 / U:0.144 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site