kconfig: generalised stack protection options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
939889a202
commit
46f66f4295
8 changed files with 30 additions and 27 deletions
15
arch/Kconfig
15
arch/Kconfig
|
@ -35,6 +35,21 @@ config XTENSA
|
||||||
|
|
||||||
endchoice
|
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
|
# Hidden PM feature configs which are to be selected by
|
||||||
# individual SoC.
|
# individual SoC.
|
||||||
|
|
|
@ -55,6 +55,7 @@ menu "ARCv2 Family Options"
|
||||||
|
|
||||||
config CPU_ARCV2
|
config CPU_ARCV2
|
||||||
bool
|
bool
|
||||||
|
select ARCH_HAS_STACK_PROTECTION
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
This option signifies the use of a CPU of the ARCv2 family.
|
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.
|
and restore general purpose registers.
|
||||||
|
|
||||||
config ARC_STACK_CHECKING
|
config ARC_STACK_CHECKING
|
||||||
bool "Enable Stack Checking"
|
bool
|
||||||
depends on CPU_ARCV2
|
default y if HW_STACK_PROTECTION
|
||||||
select THREAD_STACK_INFO
|
select THREAD_STACK_INFO
|
||||||
default n
|
|
||||||
help
|
help
|
||||||
ARCV2 has a special feature allowing to check stack overflows. This
|
ARCV2 has a special feature allowing to check stack overflows. This
|
||||||
enables code that allows using this debug feature
|
enables code that allows using this debug feature
|
||||||
|
|
|
@ -13,18 +13,16 @@ choice
|
||||||
source "arch/x86/soc/*/Kconfig.soc"
|
source "arch/x86/soc/*/Kconfig.soc"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
menu "x86 Options"
|
menu "X86 Architecture Options"
|
||||||
depends on X86
|
depends on X86
|
||||||
|
|
||||||
config ARCH
|
config ARCH
|
||||||
default "x86"
|
default "x86"
|
||||||
|
|
||||||
|
|
||||||
config ARCH_DEFCONFIG
|
config ARCH_DEFCONFIG
|
||||||
string
|
string
|
||||||
default "arch/x86/defconfig"
|
default "arch/x86/defconfig"
|
||||||
|
|
||||||
|
|
||||||
source "arch/x86/core/Kconfig"
|
source "arch/x86/core/Kconfig"
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -36,11 +34,13 @@ config CPU_ATOM
|
||||||
bool
|
bool
|
||||||
select CMOV
|
select CMOV
|
||||||
select CPU_HAS_FPU
|
select CPU_HAS_FPU
|
||||||
|
select ARCH_HAS_STACK_PROTECTION if X86_MMU
|
||||||
help
|
help
|
||||||
This option signifies the use of a CPU from the Atom family.
|
This option signifies the use of a CPU from the Atom family.
|
||||||
|
|
||||||
config CPU_MINUTEIA
|
config CPU_MINUTEIA
|
||||||
# Hidden
|
# Hidden
|
||||||
|
select ARCH_HAS_STACK_PROTECTION if X86_MMU
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
This option signifies the use of a CPU from the Minute IA family.
|
This option signifies the use of a CPU from the Minute IA family.
|
||||||
|
@ -80,11 +80,9 @@ config X86_MMU
|
||||||
|
|
||||||
config X86_STACK_PROTECTION
|
config X86_STACK_PROTECTION
|
||||||
bool
|
bool
|
||||||
default n
|
default y if HW_STACK_PROTECTION
|
||||||
depends on X86_MMU
|
|
||||||
select SET_GDT
|
select SET_GDT
|
||||||
select GDT_DYNAMIC
|
select GDT_DYNAMIC
|
||||||
prompt "MMU-based stack overflow protection"
|
|
||||||
help
|
help
|
||||||
This option leverages the MMU to cause a system fatal error if the
|
This option leverages the MMU to cause a system fatal error if the
|
||||||
bounds of the current process stack are overflowed. This is done
|
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
|
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
|
cache must be selected as well. By default, that mechanism is discovered at
|
||||||
runtime.
|
runtime.
|
||||||
endmenu
|
|
||||||
|
|
||||||
menu "Board Capabilities"
|
|
||||||
config PIC_DISABLE
|
config PIC_DISABLE
|
||||||
bool "Disable PIC"
|
bool "Disable PIC"
|
||||||
default n
|
default n
|
||||||
|
@ -308,8 +304,6 @@ config X86_FIXED_IRQ_MAPPING
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
source "arch/x86/soc/*/Kconfig"
|
source "arch/x86/soc/*/Kconfig"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
CONFIG_ARC_STACK_CHECKING=y
|
|
|
@ -1,3 +0,0 @@
|
||||||
CONFIG_X86_MMU=y
|
|
||||||
CONFIG_X86_STACK_PROTECTION=y
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
CONFIG_STACK_SENTINEL=y
|
CONFIG_HW_STACK_PROTECTION=y
|
||||||
CONFIG_X86_STACK_PROTECTION=n
|
|
||||||
|
|
||||||
|
|
3
tests/kernel/fatal/sentinel.conf
Normal file
3
tests/kernel/fatal/sentinel.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
CONFIG_STACK_SENTINEL=y
|
||||||
|
CONFIG_HW_STACK_PROTECTION=n
|
||||||
|
|
|
@ -2,12 +2,8 @@ tests:
|
||||||
- stack-sentinel:
|
- stack-sentinel:
|
||||||
arch_exclude: arc
|
arch_exclude: arc
|
||||||
tags: core ignore_faults
|
tags: core ignore_faults
|
||||||
- arc-stack-checking:
|
extra_args: CONF_FILE=sentinel.conf
|
||||||
arch_whitelist: arc
|
- stack-protection:
|
||||||
extra_args: CONF_FILE=prj-arc.conf
|
extra_args: CONF_FILE=prj.conf
|
||||||
tags: core ignore_faults
|
tags: core ignore_faults
|
||||||
- x86-mmu-stack-checking:
|
filter: ARCH_HAS_STACK_PROTECTION
|
||||||
platform_whitelist: qemu_x86 qemu_x86_iamcu
|
|
||||||
extra_args: CONF_FILE=prj-x86-mmu.conf
|
|
||||||
tags: core ignore_faults
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue