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

[xen master] ubsan: Introduce CONFIG_UBSAN_FATAL to panic on UBSAN failure



commit afb2692c473cd6b559bf774224e00cc614217705
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Mon Nov 27 15:41:55 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Dec 5 17:59:32 2023 +0000

    ubsan: Introduce CONFIG_UBSAN_FATAL to panic on UBSAN failure
    
    Introduce the CONFIG_UBSAN_FATAL option to cater to scenarios where prompt
    attention to undefined behavior issues, notably during CI test runs, is
    essential. When enabled, this option causes Xen to panic upon detecting
    UBSAN failure (as the last step in ubsan_epilogue()).
    
    Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/Kconfig.debug        | 7 +++++++
 xen/common/ubsan/ubsan.c | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 94e818ee09..e19e9d4881 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -107,6 +107,13 @@ config UBSAN
 
          If unsure, say N here.
 
+config UBSAN_FATAL
+       bool "Panic on UBSAN failure"
+       depends on UBSAN
+       help
+         Enabling this option will cause Xen to panic when an undefined 
behavior
+         is detected by UBSAN. If unsure, say N here.
+
 config DEBUG_TRACE
        bool "Debug trace support"
        ---help---
diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
index a3a80fa99e..5d50c10742 100644
--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -174,6 +174,9 @@ static void ubsan_epilogue(unsigned long *flags)
                "========================================\n");
        spin_unlock_irqrestore(&report_lock, *flags);
        current->in_ubsan--;
+
+       if (IS_ENABLED(CONFIG_UBSAN_FATAL))
+           panic("UBSAN failure detected\n");
 }
 
 static void handle_overflow(struct overflow_data *data, unsigned long lhs,
--
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®.