Skip to content

Commit 8341dcf

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
riscv: Enable Undefined Behavior Sanitizer UBSAN
Select ARCH_HAS_UBSAN_SANITIZE_ALL in order to allow the user to enable CONFIG_UBSAN_SANITIZE_ALL and instrument the entire kernel for ubsan checks. VDSO is excluded because its build doesn't include the __ubsan_handle_*() functions from lib/ubsan.c, and the VDSO has no sane way to report errors even if it has definitions of these functions. Passed lib/test_ubsan.c test. Signed-off-by: Jisheng Zhang <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 7f85b04 commit 8341dcf

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config RISCV
2828
select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
2929
select ARCH_HAS_STRICT_MODULE_RWX if MMU && !XIP_KERNEL
3030
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
31+
select ARCH_HAS_UBSAN_SANITIZE_ALL
3132
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
3233
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
3334
select ARCH_STACKWALK

arch/riscv/kernel/vdso/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
3636
GCOV_PROFILE := n
3737
KCOV_INSTRUMENT := n
3838
KASAN_SANITIZE := n
39+
UBSAN_SANITIZE := n
3940

4041
# Force dependency
4142
$(obj)/vdso.o: $(obj)/vdso.so

0 commit comments

Comments
 (0)