From: Daniel P. Berrangé <[email protected]>

When using the 'crash' policy with -compat options, QEMU will
abort() on a policy violation. All the user sees is a core
dump though and while the stack trace will ultimately show
what the violation was, it can be hard to reverse engineer
the cause when variables are optimized out. If the crash is
within a CI system, it can be even harder to determine what
the cause was as a core dump may not be available.

Printing a message when crashing is easier to diagnose when
limited context is available.

Signed-off-by: Daniel P. Berrangé <[email protected]>
Message-ID: <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
---
 qapi/qapi-util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index 29d01653e7..7067b4ddf6 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -38,6 +38,9 @@ static bool compat_policy_input_ok1(CompatPolicyInput policy,
                   adjective, kind, name);
         return false;
     case COMPAT_POLICY_INPUT_CRASH:
+        error_report("%s %s %s disabled by policy, aborting",
+                     adjective, kind, name);
+        /* fallthrough */
     default:
         abort();
     }
-- 
2.55.0


Reply via email to