mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
s390/Kconfig: Select VMAP_STACK unconditionally
There is no point in supporting !VMAP_STACK kernel builds. VMAP_STACK has proven to work since many years. Also, since KASAN_VMALLOC is supported, kernels built with !VMAP_STACK are completely untested. Therefore select VMAP_STACK unconditionally and remove all config options and code required for !VMAP_STACK builds. Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Reviewed-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
e7256acac3
commit
27939d6cde
@ -256,6 +256,7 @@ config S390
|
|||||||
select USER_STACKTRACE_SUPPORT
|
select USER_STACKTRACE_SUPPORT
|
||||||
select VDSO_GETRANDOM
|
select VDSO_GETRANDOM
|
||||||
select VIRT_CPU_ACCOUNTING
|
select VIRT_CPU_ACCOUNTING
|
||||||
|
select VMAP_STACK
|
||||||
select ZONE_DMA
|
select ZONE_DMA
|
||||||
# Note: keep the above list sorted alphabetically
|
# Note: keep the above list sorted alphabetically
|
||||||
|
|
||||||
@ -689,32 +690,6 @@ config MAX_PHYSMEM_BITS
|
|||||||
Increasing the number of bits also increases the kernel image size.
|
Increasing the number of bits also increases the kernel image size.
|
||||||
By default 46 bits (64TB) are supported.
|
By default 46 bits (64TB) are supported.
|
||||||
|
|
||||||
config CHECK_STACK
|
|
||||||
def_bool y
|
|
||||||
depends on !VMAP_STACK
|
|
||||||
prompt "Detect kernel stack overflow"
|
|
||||||
help
|
|
||||||
This option enables the compiler option -mstack-guard and
|
|
||||||
-mstack-size if they are available. If the compiler supports them
|
|
||||||
it will emit additional code to each function prolog to trigger
|
|
||||||
an illegal operation if the kernel stack is about to overflow.
|
|
||||||
|
|
||||||
Say N if you are unsure.
|
|
||||||
|
|
||||||
config STACK_GUARD
|
|
||||||
int "Size of the guard area (128-1024)"
|
|
||||||
range 128 1024
|
|
||||||
depends on CHECK_STACK
|
|
||||||
default "256"
|
|
||||||
help
|
|
||||||
This allows you to specify the size of the guard area at the lower
|
|
||||||
end of the kernel stack. If the kernel stack points into the guard
|
|
||||||
area on function entry an illegal operation is triggered. The size
|
|
||||||
needs to be a power of 2. Please keep in mind that the size of an
|
|
||||||
interrupt frame is 184 bytes for 31 bit and 328 bytes on 64 bit.
|
|
||||||
The minimum size for the stack guard should be 256 for 31 bit and
|
|
||||||
512 for 64 bit.
|
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "I/O subsystem"
|
menu "I/O subsystem"
|
||||||
|
@ -72,15 +72,6 @@ cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
|
|||||||
KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
|
KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
|
||||||
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
|
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)
|
||||||
|
|
||||||
ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),)
|
|
||||||
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
|
ifdef CONFIG_EXPOLINE
|
||||||
ifdef CONFIG_EXPOLINE_EXTERN
|
ifdef CONFIG_EXPOLINE_EXTERN
|
||||||
CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern
|
CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern
|
||||||
|
@ -52,16 +52,7 @@ _LPP_OFFSET = __LC_LPP
|
|||||||
ALT_FACILITY(193)
|
ALT_FACILITY(193)
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro CHECK_STACK savearea, lowcore
|
|
||||||
#ifdef CONFIG_CHECK_STACK
|
|
||||||
tml %r15,THREAD_SIZE - CONFIG_STACK_GUARD
|
|
||||||
la %r14,\savearea(\lowcore)
|
|
||||||
jz stack_overflow
|
|
||||||
#endif
|
|
||||||
.endm
|
|
||||||
|
|
||||||
.macro CHECK_VMAP_STACK savearea, lowcore, oklabel
|
.macro CHECK_VMAP_STACK savearea, lowcore, oklabel
|
||||||
#ifdef CONFIG_VMAP_STACK
|
|
||||||
lgr %r14,%r15
|
lgr %r14,%r15
|
||||||
nill %r14,0x10000 - THREAD_SIZE
|
nill %r14,0x10000 - THREAD_SIZE
|
||||||
oill %r14,STACK_INIT_OFFSET
|
oill %r14,STACK_INIT_OFFSET
|
||||||
@ -77,9 +68,6 @@ _LPP_OFFSET = __LC_LPP
|
|||||||
je \oklabel
|
je \oklabel
|
||||||
la %r14,\savearea(\lowcore)
|
la %r14,\savearea(\lowcore)
|
||||||
j stack_overflow
|
j stack_overflow
|
||||||
#else
|
|
||||||
j \oklabel
|
|
||||||
#endif
|
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -326,8 +314,7 @@ SYM_CODE_START(pgm_check_handler)
|
|||||||
jnz 2f # -> enabled, can't be a double fault
|
jnz 2f # -> enabled, can't be a double fault
|
||||||
tm __LC_PGM_ILC+3(%r13),0x80 # check for per exception
|
tm __LC_PGM_ILC+3(%r13),0x80 # check for per exception
|
||||||
jnz .Lpgm_svcper # -> single stepped svc
|
jnz .Lpgm_svcper # -> single stepped svc
|
||||||
2: CHECK_STACK __LC_SAVE_AREA,%r13
|
2: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
||||||
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
|
||||||
# CHECK_VMAP_STACK branches to stack_overflow or 4f
|
# CHECK_VMAP_STACK branches to stack_overflow or 4f
|
||||||
CHECK_VMAP_STACK __LC_SAVE_AREA,%r13,4f
|
CHECK_VMAP_STACK __LC_SAVE_AREA,%r13,4f
|
||||||
3: lg %r15,__LC_KERNEL_STACK(%r13)
|
3: lg %r15,__LC_KERNEL_STACK(%r13)
|
||||||
@ -394,8 +381,7 @@ SYM_CODE_START(\name)
|
|||||||
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
||||||
SIEEXIT __SF_SIE_CONTROL(%r15),%r13
|
SIEEXIT __SF_SIE_CONTROL(%r15),%r13
|
||||||
#endif
|
#endif
|
||||||
0: CHECK_STACK __LC_SAVE_AREA,%r13
|
0: aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
||||||
aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE)
|
|
||||||
j 2f
|
j 2f
|
||||||
1: lctlg %c1,%c1,__LC_KERNEL_ASCE(%r13)
|
1: lctlg %c1,%c1,__LC_KERNEL_ASCE(%r13)
|
||||||
lg %r15,__LC_KERNEL_STACK(%r13)
|
lg %r15,__LC_KERNEL_STACK(%r13)
|
||||||
@ -603,7 +589,6 @@ SYM_CODE_END(early_pgm_check_handler)
|
|||||||
|
|
||||||
.section .kprobes.text, "ax"
|
.section .kprobes.text, "ax"
|
||||||
|
|
||||||
#if defined(CONFIG_CHECK_STACK) || defined(CONFIG_VMAP_STACK)
|
|
||||||
/*
|
/*
|
||||||
* The synchronous or the asynchronous stack overflowed. We are dead.
|
* The synchronous or the asynchronous stack overflowed. We are dead.
|
||||||
* No need to properly save the registers, we are going to panic anyway.
|
* No need to properly save the registers, we are going to panic anyway.
|
||||||
@ -621,7 +606,6 @@ SYM_CODE_START(stack_overflow)
|
|||||||
lgr %r2,%r11 # pass pointer to pt_regs
|
lgr %r2,%r11 # pass pointer to pt_regs
|
||||||
jg kernel_stack_overflow
|
jg kernel_stack_overflow
|
||||||
SYM_CODE_END(stack_overflow)
|
SYM_CODE_END(stack_overflow)
|
||||||
#endif
|
|
||||||
|
|
||||||
.section .data, "aw"
|
.section .data, "aw"
|
||||||
.balign 4
|
.balign 4
|
||||||
|
@ -359,25 +359,17 @@ void *restart_stack;
|
|||||||
|
|
||||||
unsigned long stack_alloc(void)
|
unsigned long stack_alloc(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_VMAP_STACK
|
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
ret = __vmalloc_node(THREAD_SIZE, THREAD_SIZE, THREADINFO_GFP,
|
ret = __vmalloc_node(THREAD_SIZE, THREAD_SIZE, THREADINFO_GFP,
|
||||||
NUMA_NO_NODE, __builtin_return_address(0));
|
NUMA_NO_NODE, __builtin_return_address(0));
|
||||||
kmemleak_not_leak(ret);
|
kmemleak_not_leak(ret);
|
||||||
return (unsigned long)ret;
|
return (unsigned long)ret;
|
||||||
#else
|
|
||||||
return __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stack_free(unsigned long stack)
|
void stack_free(unsigned long stack)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_VMAP_STACK
|
|
||||||
vfree((void *) stack);
|
vfree((void *) stack);
|
||||||
#else
|
|
||||||
free_pages(stack, THREAD_SIZE_ORDER);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long __init stack_alloc_early(void)
|
static unsigned long __init stack_alloc_early(void)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
include $(srctree)/lib/vdso/Makefile
|
include $(srctree)/lib/vdso/Makefile
|
||||||
obj-vdso64 = vdso_user_wrapper.o note.o vgetrandom-chacha.o
|
obj-vdso64 = vdso_user_wrapper.o note.o vgetrandom-chacha.o
|
||||||
obj-cvdso64 = vdso64_generic.o getcpu.o vgetrandom.o
|
obj-cvdso64 = vdso64_generic.o getcpu.o vgetrandom.o
|
||||||
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE) $(CC_FLAGS_CHECK_STACK)
|
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE) $(CC_FLAGS_EXPOLINE)
|
||||||
CFLAGS_REMOVE_getcpu.o = $(VDSO_CFLAGS_REMOVE)
|
CFLAGS_REMOVE_getcpu.o = $(VDSO_CFLAGS_REMOVE)
|
||||||
CFLAGS_REMOVE_vgetrandom.o = $(VDSO_CFLAGS_REMOVE)
|
CFLAGS_REMOVE_vgetrandom.o = $(VDSO_CFLAGS_REMOVE)
|
||||||
CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
|
CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
|
||||||
|
Loading…
Reference in New Issue
Block a user