]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
RISCV: Activate UBSAN in testing
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 7 Feb 2025 21:19:21 +0000 (21:19 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 10 Feb 2025 23:40:12 +0000 (23:40 +0000)
RISC-V has less complicated headers, so update ubsan.c to pull in everything
it needs.  Provide dump_execution_state(), and update the printk() message to
make it more obvious that it's an outstanding task.

As with commit 8ef2ac727e21 ("automation: enable UBSAN for debug tests"),
enable UBSAN in RISC-V testing too.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
automation/gitlab-ci/build.yaml
xen/arch/riscv/Kconfig
xen/arch/riscv/include/asm/processor.h
xen/arch/riscv/traps.c
xen/common/ubsan/ubsan.c

index fb55d4ce55682035939bc552604ac468b5c349fa..35e224366f62bf4e97349ebc1db26c0332b9a280 100644 (file)
@@ -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
 
index 00f329054c94f46b3647de10421fd8ec68637c66..fa95cd0a42134125788c86f775a7e2ac36a1cb8b 100644 (file)
@@ -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
index 90b800956303996ef283a194bf2aff3f4168b350..39696fb58dc6263490450f88e9e95ec826690513 100644 (file)
@@ -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 */
index d55a4a827b8c2138e47a32aa9302219df8a562b9..ea3638a54fed943a6bbb10a1c07726b19a9203e1 100644 (file)
@@ -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)
index 7f73f94759db1581eccc52bbc2997ca0a4079afd..e99370322b44bc9941d702859d1f2d627deaddc6 100644 (file)
  *
  */
 
-#include <xen/spinlock.h>
+#include <xen/bitops.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
 #include <xen/percpu.h>
+#include <xen/spinlock.h>
 
 #define __noreturn    noreturn
 #define pr_err(...) printk(XENLOG_ERR __VA_ARGS__)