qapi: drop CompatPolicySecurity and use CompatPolicyInput

With 'CompatPolicyInput' gaining a 'warn' option, the 'insecure-input'
option can use the 'CompatPolicySecurity' type, dropping the former.
This replacement means that the 'insecure-input' option gains the
ability use the 'crash' policy option.

Note the error message for insecure-input changes from

   Type 'rtl8139' does not provide a security boundary
   to protect against untrusted data or actions

To

   Insecure QOM type rtl8139 disabled by policy
   This type does does not provide a security boundary
   to protect against untrusted data or actions

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20261030141713.2841710-5-berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Daniel P. Berrangé authored and Markus Armbruster committed 2026-11-02 11:27:16 +01:00
1 parent ec3b03084e
commit 74b80cfb21
2 files changed
+12 -32

No files matched your search

+1 -17
View File
@@ -40,22 +40,6 @@
{ 'enum': 'CompatPolicyOutput',
'data': [ 'accept', 'hide' ] }
##
# @CompatPolicySecurity:
# Policy for handling any devices or backends which do not provide
# a security boundary to protect against untrusted environments
#
# @accept: Allow any usage
#
# @reject: Reject with an error reported
#
# @warn: Allow any usage, with a warning reported
#
# Since: 11.2
##
{ 'enum': 'CompatPolicySecurity',
'data': [ 'accept', 'reject', 'warn' ] }
##
# @CompatPolicy:
# Policy for handling problematic management interfaces.
@@ -91,4 +75,4 @@
'*deprecated-output': 'CompatPolicyOutput',
'*unstable-input': 'CompatPolicyInput',
'*unstable-output': 'CompatPolicyOutput',
'*insecure-input': 'CompatPolicySecurity' } }
'*insecure-input': 'CompatPolicyInput' } }
+11 -15
View File
@@ -16,6 +16,7 @@
#include "qemu/ctype.h"
#include "qemu/error-report.h"
#include "qapi/qmp/qerror.h"
#include "qapi/error.h"
CompatPolicy compat_policy;
@@ -68,27 +69,22 @@ bool compat_policy_check_security(const CompatPolicy *policy,
bool is_secure,
Error **errp)
{
ERRP_GUARD();
if (is_secure) {
return true;
}
switch (policy->insecure_input) {
case COMPAT_POLICY_SECURITY_ACCEPT:
return true;
case COMPAT_POLICY_SECURITY_REJECT:
error_setg(errp, "Type '%s' does not provide a security boundary "
"to protect against untrusted data or actions", typename);
if (!compat_policy_input_ok1(policy->insecure_input,
"Insecure",
ERROR_CLASS_GENERIC_ERROR,
"QOM type", typename, errp)) {
error_append_hint(errp, "This type does does not provide a "
"security boundary to protect against "
"untrusted data or actions\n");
return false;
case COMPAT_POLICY_SECURITY_WARN:
warn_report("Type '%s' does not provide a security boundary "
"to protect against untrusted data or actions", typename);
return true;
default:
g_assert_not_reached();
}
return true;
}