stack_sentinel: hang system on failure
Stack sentinel doesn't prevent corruption, it just notices when it happens. Any memory could be in a bad state and it's more appropriate to take the entire system down rather than just kill the thread. Fatal testcase will still work since it installs its own _SysFatalErrorHandler. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
000429c069
commit
e3550a29ff
5 changed files with 25 additions and 0 deletions
|
@ -44,6 +44,11 @@ void __weak _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||||
|
goto hang_system;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||||
goto hang_system;
|
goto hang_system;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,6 +226,11 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||||
|
goto hang_system;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||||
goto hang_system;
|
goto hang_system;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,11 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(esf);
|
ARG_UNUSED(esf);
|
||||||
|
|
||||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||||
|
goto hang_system;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||||
goto hang_system;
|
goto hang_system;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,11 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||||
|
goto hang_system;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||||
goto hang_system;
|
goto hang_system;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,11 @@ FUNC_NORETURN __weak void _SysFatalErrorHandler(unsigned int reason,
|
||||||
ARG_UNUSED(pEsf);
|
ARG_UNUSED(pEsf);
|
||||||
|
|
||||||
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
#if !defined(CONFIG_SIMPLE_FATAL_ERROR_HANDLER)
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
if (reason == _NANO_ERR_STACK_CHK_FAIL) {
|
||||||
|
goto hang_system;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
if (reason == _NANO_ERR_KERNEL_PANIC) {
|
||||||
goto hang_system;
|
goto hang_system;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue