diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml index fb55d4ce55..35e224366f 100644 --- a/automation/gitlab-ci/build.yaml +++ b/automation/gitlab-ci/build.yaml @@ -359,6 +359,9 @@ debian-12-riscv64-gcc-debug: CONTAINER: debian:12-riscv64 KBUILD_DEFCONFIG: tiny64_defconfig HYPERVISOR_ONLY: y + EXTRA_XEN_CONFIG: | + CONFIG_UBSAN=y + CONFIG_UBSAN_FATAL=y # Arm32 cross-build diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig index 00f329054c..fa95cd0a42 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -4,6 +4,7 @@ config RISCV select GENERIC_BUG_FRAME select HAS_DEVICE_TREE select HAS_PMAP + select HAS_UBSAN select HAS_VMAP config RISCV_64 diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h index 90b8009563..39696fb58d 100644 --- a/xen/arch/riscv/include/asm/processor.h +++ b/xen/arch/riscv/include/asm/processor.h @@ -91,6 +91,8 @@ static inline void sfence_vma(void) asm volatile ( "sfence.vma" ::: "memory" ); } +#define dump_execution_state() run_in_exception_handler(show_execution_state) + #endif /* __ASSEMBLY__ */ #endif /* ASM__RISCV__PROCESSOR_H */ diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c index d55a4a827b..ea3638a54f 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -140,7 +140,7 @@ void vcpu_show_execution_state(struct vcpu *v) void show_execution_state(const struct cpu_user_regs *regs) { - printk("implement show_execution_state(regs)\n"); + printk("TODO: Implement show_execution_state(regs)\n"); } void arch_hypercall_tasklet_result(struct vcpu *v, long res) diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c index 7f73f94759..e99370322b 100644 --- a/xen/common/ubsan/ubsan.c +++ b/xen/common/ubsan/ubsan.c @@ -10,8 +10,11 @@ * */ -#include +#include +#include +#include #include +#include #define __noreturn noreturn #define pr_err(...) printk(XENLOG_ERR __VA_ARGS__)