All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PULL 01/14] qom: add tracking of security state of object types
Date: Thu, 17 Sep 2026 17:05:12 +0100	[thread overview]
Message-ID: <20260917160525.1275388-2-berrange@redhat.com> (raw)
In-Reply-To: <20260917160525.1275388-1-berrange@redhat.com>

This introduces a new flag "secure" against the Type/TypeInfo
structs, and helpers to check this against the ObjectClass
struct.

If an object is considered to provide a security boundary to
protect against untrusted code, the "secure" flag must be
explicitly set to true.

If it is set to false, or left unset, this indicates that
the object does not intend to provide a security boundary.
Bugs related to this object class will be ineligible for
CVE assignment.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 include/qom/object.h | 13 +++++++++++++
 qom/object.c         |  7 +++++++
 rust/qom/src/qom.rs  |  4 ++++
 3 files changed, 24 insertions(+)

diff --git a/include/qom/object.h b/include/qom/object.h
index 7ecd0f210fb..687ceb6bba0 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -453,6 +453,10 @@ struct Object
  *   function.
  * @abstract: If this field is true, then the class is considered abstract and
  *   cannot be directly instantiated.
+ * @secure: If this field is initialized to true, then the class is considered
+ *   to provide a security boundary. If initialized to false, the class does
+ *   not provide a security boundary. If uninitialized (and thus implicitly
+ *   false) its status is not yet defined.
  * @class_size: The size of the class object (derivative of #ObjectClass)
  *   for this object.  If @class_size is 0, then the size of the class will be
  *   assumed to be the size of the parent class.  This allows a type to avoid
@@ -487,6 +491,7 @@ struct TypeInfo
     void (*instance_finalize)(Object *obj);
 
     bool abstract;
+    bool secure;
     size_t class_size;
 
     void (*class_init)(ObjectClass *klass, const void *data);
@@ -1074,6 +1079,14 @@ const char *object_class_get_name(ObjectClass *klass);
  */
 bool object_class_is_abstract(ObjectClass *klass);
 
+/**
+ * object_class_is_secure:
+ * @klass: The class to check security of
+ *
+ * Returns: %true if @klass is declared to be secure, %false if not declared
+ */
+bool object_class_is_secure(ObjectClass *klass);
+
 /**
  * object_class_by_name:
  * @typename: The QOM typename to obtain the class for.
diff --git a/qom/object.c b/qom/object.c
index b1834a57cc9..32736a01114 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -67,6 +67,7 @@ struct TypeImpl
     void (*instance_finalize)(Object *obj);
 
     bool abstract;
+    bool secure;
 
     const char *parent;
     TypeImpl *parent_type;
@@ -122,6 +123,7 @@ static TypeImpl *type_new(const TypeInfo *info)
     ti->instance_finalize = info->instance_finalize;
 
     ti->abstract = info->abstract;
+    ti->secure = info->secure;
 
     for (i = 0; info->interfaces && info->interfaces[i].type; i++) {
         ti->interfaces[i].typename = g_strdup(info->interfaces[i].type);
@@ -1144,6 +1146,11 @@ bool object_class_is_abstract(ObjectClass *klass)
     return klass->type->abstract;
 }
 
+bool object_class_is_secure(ObjectClass *klass)
+{
+    return klass->type->secure;
+}
+
 const char *object_class_get_name(ObjectClass *klass)
 {
     return klass->type->name;
diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs
index bbb485e2cfd..81449eeefad 100644
--- a/rust/qom/src/qom.rs
+++ b/rust/qom/src/qom.rs
@@ -651,6 +651,9 @@ pub trait ObjectImpl: ObjectType + IsA<Object> {
     /// Whether the object can be instantiated
     const ABSTRACT: bool = false;
 
+    /// Whether the object provides a security boundary for untrusted access
+    const SECURE: bool = false;
+
     /// Function that is called to initialize an object.  The parent class will
     /// have already been initialized so the type is only responsible for
     /// initializing its own members.
@@ -687,6 +690,7 @@ pub trait ObjectImpl: ObjectType + IsA<Object> {
         },
         instance_finalize: Some(drop_object::<Self>),
         abstract_: Self::ABSTRACT,
+        secure: Self::SECURE,
         class_size: core::mem::size_of::<Self::Class>(),
         class_init: Some(rust_class_init::<Self>),
         class_base_init: Self::CLASS_BASE_INIT,
-- 
2.55.0



  reply	other threads:[~2026-09-17 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 16:05 [PULL 00/14] QOM security status patches Daniel P. Berrangé
2026-09-17 16:05 ` Daniel P. Berrangé [this message]
2026-09-17 16:05 ` [PULL 02/14] qapi: add 'insecure-types' option for -compat argument Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 03/14] qom: add helper API for checking object class security policy compliance Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 04/14] system: check security for accelerator types Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 05/14] system: report acclerator security status in help output Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 06/14] system: check security for machine types Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 07/14] system: report machine security status in help output Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 08/14] system: check security of device types Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 09/14] system: report device security status in help output Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 10/14] hw/core: report security status in query-machines Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 11/14] qom: refactor data passing for QOM list filtering Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 12/14] qom: report & filter on security status in qom-list-types Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 13/14] docs: expand security docs with info about security status Daniel P. Berrangé
2026-09-17 16:05 ` [PULL 14/14] machine: add helpers for declaring secure/insecure machine types Daniel P. Berrangé
2026-09-17 21:50 ` [PULL 00/14] QOM security status patches Richard Henderson

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=20260917160525.1275388-2-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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.