[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] PPC: Activate UBSAN in testing



commit 7cf163879c5add0a4f7f9c987b61f04f8f7051b1
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Feb 25 21:27:33 2025 -0600
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Feb 26 12:00:23 2025 +0000

    PPC: Activate UBSAN in testing
    
    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@xxxxxxxxxx>
    Signed-off-by: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 automation/gitlab-ci/build.yaml      | 3 +++
 xen/arch/ppc/Kconfig                 | 1 +
 xen/arch/ppc/arch.mk                 | 6 ++++++
 xen/arch/ppc/include/asm/processor.h | 2 ++
 xen/arch/ppc/stubs.c                 | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 35e224366f..6a2e491534 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -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
diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig
index 6db575a48d..917f5d53a6 100644
--- a/xen/arch/ppc/Kconfig
+++ b/xen/arch/ppc/Kconfig
@@ -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
diff --git a/xen/arch/ppc/arch.mk b/xen/arch/ppc/arch.mk
index 917ad0e6a8..c2ca419242 100644
--- a/xen/arch/ppc/arch.mk
+++ b/xen/arch/ppc/arch.mk
@@ -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
diff --git a/xen/arch/ppc/include/asm/processor.h 
b/xen/arch/ppc/include/asm/processor.h
index a01b62b8a4..50161cc32d 100644
--- a/xen/arch/ppc/include/asm/processor.h
+++ b/xen/arch/ppc/include/asm/processor.h
@@ -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 */
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index fff82f5cf3..671e71aa0a 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -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)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.