From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 02/14] qapi: add 'insecure-types' option for -compat argument
Date: Wed, 9 Sep 2026 18:56:44 +0100 [thread overview]
Message-ID: <20260909175656.1572689-3-berrange@redhat.com> (raw)
In-Reply-To: <20260909175656.1572689-1-berrange@redhat.com>
This introduces a new 'insecure-types' option for the 'compat'
argument that accepts three values
* accept: Allow any usage
* reject: Reject with an error reported
* warn: Allow any usage, with a warning reported
For historical compatibility it defaults to 'accept'.
The 'reject' and 'warn' values will take effect for any type
that has been explicitly marked insecure, or is lacking an
explicit declaration of its security status.
This new command line option is currently a no-op, but will
become functional as following patches enable the checks.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
include/qapi/compat-policy.h | 5 +++++
qapi/compat.json | 23 ++++++++++++++++++++++-
qapi/qapi-util.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/include/qapi/compat-policy.h b/include/qapi/compat-policy.h
index ea65e10744..f5af209069 100644
--- a/include/qapi/compat-policy.h
+++ b/include/qapi/compat-policy.h
@@ -24,6 +24,11 @@ bool compat_policy_input_ok(uint64_t features,
const char *kind, const char *name,
Error **errp);
+bool compat_policy_check_security(const CompatPolicy *policy,
+ const char *typename,
+ bool is_secure,
+ Error **errp);
+
/*
* Create a QObject input visitor for @obj for use with QMP
*
diff --git a/qapi/compat.json b/qapi/compat.json
index 90b8d51cf2..d57f25e112 100644
--- a/qapi/compat.json
+++ b/qapi/compat.json
@@ -37,6 +37,23 @@
{ '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: 10.2
+##
+{ 'enum': 'CompatPolicySecurity',
+ 'data': [ 'accept', 'reject', 'warn' ] }
+
##
# @CompatPolicy:
#
@@ -62,10 +79,14 @@
# @unstable-output: how to handle unstable output (default 'accept')
# (since 6.2)
#
+# @insecure-types: how to handle types that are not declared secure
+# (default 'accept') (since 10.2)
+#
# Since: 6.0
##
{ 'struct': 'CompatPolicy',
'data': { '*deprecated-input': 'CompatPolicyInput',
'*deprecated-output': 'CompatPolicyOutput',
'*unstable-input': 'CompatPolicyInput',
- '*unstable-output': 'CompatPolicyOutput' } }
+ '*unstable-output': 'CompatPolicyOutput',
+ '*insecure-types': 'CompatPolicySecurity' } }
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index 3d849fe034..38b1cec7a4 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -14,6 +14,7 @@
#include "qapi/compat-policy.h"
#include "qapi/error.h"
#include "qemu/ctype.h"
+#include "qemu/error-report.h"
#include "qapi/qmp/qerror.h"
CompatPolicy compat_policy;
@@ -58,6 +59,35 @@ bool compat_policy_input_ok(uint64_t features,
return true;
}
+bool compat_policy_check_security(const CompatPolicy *policy,
+ const char *typename,
+ bool is_secure,
+ Error **errp)
+{
+ if (is_secure) {
+ return true;
+ }
+
+ switch (policy->insecure_types) {
+ 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);
+ 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();
+ }
+}
+
+
const char *qapi_enum_lookup(const QEnumLookup *lookup, int val)
{
assert(val >= 0 && val < lookup->size);
--
2.55.0
next prev parent reply other threads:[~2026-09-09 17:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 17:56 [PATCH 00/14] Encode object type security status in code Daniel P. Berrangé
2026-09-09 17:56 ` [PATCH 01/14] qom: add tracking of security state of object types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` Daniel P. Berrangé [this message]
2026-09-09 20:19 ` [PATCH 02/14] qapi: add 'insecure-types' option for -compat argument marcandre.lureau
2026-09-09 17:56 ` [PATCH 03/14] qom: add helper APIs for checking object security policy compliance Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 04/14] system: check security for accelerator types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 05/14] system: report acclerator security status in help output Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 06/14] system: check security for machine types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 07/14] system: report machine security status in help output Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 08/14] system: check security of device types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 09/14] system: report device security status in help output Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 10/14] hw/core: report security status in query-machines Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 11/14] qom: refactor data passing for QOM list filtering Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 12/14] qom: report & filter on security status in qom-list-types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 13/14] docs: expand security docs with info about security status Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
2026-09-09 17:56 ` [PATCH 14/14] machine: add helpers for declaring secure/insecure machine types Daniel P. Berrangé
2026-09-09 20:19 ` marcandre.lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909175656.1572689-3-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.