]> xenbits.xensource.com Git - xen.git/commitdiff
PPC: Activate UBSAN in testing
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Feb 2025 03:27:33 +0000 (21:27 -0600)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Feb 2025 14:54:46 +0000 (14:54 +0000)
Also enable -fno-sanitize=alignment like x86 since support for unaligned
accesses is guaranteed by the ISA and the existing OPAL setup code
relies on it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
(cherry picked from commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1)

automation/gitlab-ci/build.yaml
xen/arch/ppc/Kconfig
xen/arch/ppc/arch.mk
xen/arch/ppc/include/asm/processor.h
xen/arch/ppc/stubs.c

index 35e224366f62bf4e97349ebc1db26c0332b9a280..6a2e491534d35b755ff75586c8d5be4280784ccc 100644 (file)
@@ -352,6 +352,9 @@ debian-12-ppc64le-gcc-debug:
     CONTAINER: debian:12-ppc64le
     KBUILD_DEFCONFIG: ppc64_defconfig
     HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_UBSAN=y
+      CONFIG_UBSAN_FATAL=y
 
 debian-12-riscv64-gcc-debug:
   extends: .gcc-riscv64-cross-build-debug
index 6db575a48d345e40a678817bd2ffdf7cf9705829..917f5d53a6c3689385f9447aea8d2d1f5f332eec 100644 (file)
@@ -2,6 +2,7 @@ config PPC
        def_bool y
        select FUNCTION_ALIGNMENT_4B
        select HAS_DEVICE_TREE
+       select HAS_UBSAN
        select HAS_VMAP
 
 config PPC64
index 917ad0e6a87c3e0c89fcb1e72e3e3f2ddd5ef6a2..c2ca41924203e7750cfee2335da67366cbd3d66d 100644 (file)
@@ -7,3 +7,9 @@ CFLAGS += -m64 -mlittle-endian -mcpu=$(ppc-march-y)
 CFLAGS += -mstrict-align -mcmodel=medium -mabi=elfv2 -fPIC -mno-altivec -mno-vsx -msoft-float
 
 LDFLAGS += -m elf64lppc
+
+ifeq ($(CONFIG_UBSAN),y)
+# Don't enable alignment sanitisation since Power ISA guarantees hardware
+# support for unaligned accesses.
+$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
+endif
index a01b62b8a451ba117502d198afadd5491db9074b..50161cc32d50f243e8946bd0cc128554bcbbaa02 100644 (file)
@@ -219,6 +219,8 @@ static inline void noreturn die(void)
  */
 #define cpu_relax() asm volatile ( "or %r1, %r1, %r1; or %r2, %r2, %r2" )
 
+#define dump_execution_state() run_in_exception_handler(show_execution_state)
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_PPC_PROCESSOR_H */
index fff82f5cf3cc227a8c7c1a1309d3af0954308205..671e71aa0a60b82335fd0e06c532a2b1e9485857 100644 (file)
@@ -47,7 +47,7 @@ void send_timer_event(struct vcpu *v)
 
 void show_execution_state(const struct cpu_user_regs *regs)
 {
-    BUG_ON("unimplemented");
+    printk("TODO: Implement show_execution_state(regs)\n");
 }
 
 void arch_hypercall_tasklet_result(struct vcpu *v, long res)