diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2019-08-27 17:09:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-09-09 15:16:08 +0200 |
commit | e098835f87dc56f6fa4399d7000af8e1f413bf1d (patch) | |
tree | 7e71b31147e52721f772845b6886e69a830b8444 /arch/sandbox | |
parent | 9bc174167070d358f126631ad407050767a12792 (diff) | |
download | barebox-e098835f87dc56f6fa4399d7000af8e1f413bf1d.tar.gz barebox-e098835f87dc56f6fa4399d7000af8e1f413bf1d.tar.xz |
sandbox: use sanitizer unwind for dump_stack if available
The sanitize unwind looks pretty and is just a function call away if we
are compiling with KASAN or UBSAN. Use it if available.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/Kconfig | 6 | ||||
-rw-r--r-- | arch/sandbox/Makefile | 2 | ||||
-rw-r--r-- | arch/sandbox/lib/Makefile | 1 | ||||
-rw-r--r-- | arch/sandbox/lib/unwind.c | 11 |
4 files changed, 19 insertions, 1 deletions
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig index 5227cb624f..7c0c4c4574 100644 --- a/arch/sandbox/Kconfig +++ b/arch/sandbox/Kconfig @@ -15,3 +15,9 @@ config LINUX config ARCH_LINUX bool + +config SANDBOX_UNWIND + bool + default y + select ARCH_HAS_STACK_DUMP + depends on UBSAN || KASAN diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile index 85c70b5e80..ee6fcf3951 100644 --- a/arch/sandbox/Makefile +++ b/arch/sandbox/Makefile @@ -49,7 +49,7 @@ cmd_barebox__ = $(CC) -o $@ -Wl,-T,$(barebox-lds) \ -Wl,--start-group $(barebox-common) -Wl,--end-group \ -lrt -lpthread $(SDL_LIBS) $(FTDI1_LIBS) -common-y += $(BOARD) arch/sandbox/os/ +common-y += $(BOARD) arch/sandbox/os/ arch/sandbox/lib/ common-$(CONFIG_OFTREE) += arch/sandbox/dts/ diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile new file mode 100644 index 0000000000..b32ca6aaf8 --- /dev/null +++ b/arch/sandbox/lib/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_HAS_STACK_DUMP) += unwind.o diff --git a/arch/sandbox/lib/unwind.c b/arch/sandbox/lib/unwind.c new file mode 100644 index 0000000000..15a2798cc4 --- /dev/null +++ b/arch/sandbox/lib/unwind.c @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright 2019 Ahmad Fatoum + +#include <common.h> + +void __sanitizer_print_stack_trace(void); + +void dump_stack(void) +{ + __sanitizer_print_stack_trace(); +} |