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]>
---
 qapi/qapi-util.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index c845cadbdf2..1141813747b 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -37,6 +37,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.56.0


Reply via email to