kconfig: generalised stack protection options

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-09-08 21:14:06 -04:00 committed by Andrew Boie
commit 46f66f4295
8 changed files with 30 additions and 27 deletions

View file

@ -35,6 +35,21 @@ config XTENSA
endchoice
menu "General Architecture Options"
config HW_STACK_PROTECTION
bool "Hardware Stack Protection"
depends on ARCH_HAS_STACK_PROTECTION
help
Select this option to enable hardware stack protection.
endmenu
config ARCH_HAS_STACK_PROTECTION
bool
#
# Hidden PM feature configs which are to be selected by
# individual SoC.

View file

@ -55,6 +55,7 @@ menu "ARCv2 Family Options"
config CPU_ARCV2
bool
select ARCH_HAS_STACK_PROTECTION
default y
help
This option signifies the use of a CPU of the ARCv2 family.
@ -104,10 +105,9 @@ config RGF_NUM_BANKS
and restore general purpose registers.
config ARC_STACK_CHECKING
bool "Enable Stack Checking"
depends on CPU_ARCV2
bool
default y if HW_STACK_PROTECTION
select THREAD_STACK_INFO
default n
help
ARCV2 has a special feature allowing to check stack overflows. This
enables code that allows using this debug feature

View file

@ -13,18 +13,16 @@ choice
source "arch/x86/soc/*/Kconfig.soc"
endchoice
menu "x86 Options"
menu "X86 Architecture Options"
depends on X86
config ARCH
default "x86"
config ARCH_DEFCONFIG
string
default "arch/x86/defconfig"
source "arch/x86/core/Kconfig"
#
@ -36,11 +34,13 @@ config CPU_ATOM
bool
select CMOV
select CPU_HAS_FPU
select ARCH_HAS_STACK_PROTECTION if X86_MMU
help
This option signifies the use of a CPU from the Atom family.
config CPU_MINUTEIA
# Hidden
select ARCH_HAS_STACK_PROTECTION if X86_MMU
bool
help
This option signifies the use of a CPU from the Minute IA family.
@ -80,11 +80,9 @@ config X86_MMU
config X86_STACK_PROTECTION
bool
default n
depends on X86_MMU
default y if HW_STACK_PROTECTION
select SET_GDT
select GDT_DYNAMIC
prompt "MMU-based stack overflow protection"
help
This option leverages the MMU to cause a system fatal error if the
bounds of the current process stack are overflowed. This is done
@ -247,9 +245,7 @@ config CACHE_FLUSHING
This links in the sys_cache_flush() function. A mechanism for flushing the
cache must be selected as well. By default, that mechanism is discovered at
runtime.
endmenu
menu "Board Capabilities"
config PIC_DISABLE
bool "Disable PIC"
default n
@ -308,8 +304,6 @@ config X86_FIXED_IRQ_MAPPING
endmenu
source "arch/x86/soc/*/Kconfig"
endmenu

View file

@ -1 +0,0 @@
CONFIG_ARC_STACK_CHECKING=y

View file

@ -1,3 +0,0 @@
CONFIG_X86_MMU=y
CONFIG_X86_STACK_PROTECTION=y

View file

@ -1,3 +1,2 @@
CONFIG_STACK_SENTINEL=y
CONFIG_X86_STACK_PROTECTION=n
CONFIG_HW_STACK_PROTECTION=y

View file

@ -0,0 +1,3 @@
CONFIG_STACK_SENTINEL=y
CONFIG_HW_STACK_PROTECTION=n

View file

@ -2,12 +2,8 @@ tests:
- stack-sentinel:
arch_exclude: arc
tags: core ignore_faults
- arc-stack-checking:
arch_whitelist: arc
extra_args: CONF_FILE=prj-arc.conf
extra_args: CONF_FILE=sentinel.conf
- stack-protection:
extra_args: CONF_FILE=prj.conf
tags: core ignore_faults
- x86-mmu-stack-checking:
platform_whitelist: qemu_x86 qemu_x86_iamcu
extra_args: CONF_FILE=prj-x86-mmu.conf
tags: core ignore_faults
filter: ARCH_HAS_STACK_PROTECTION