All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v2 00/32] Encode object type security status in code
Date: Thu, 23 Oct 2025 14:38:43 +0200	[thread overview]
Message-ID: <87o6px6be4.fsf@pond.sub.org> (raw)
In-Reply-To: <20250926140144.1998694-1-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Fri, 26 Sep 2025 15:01:11 +0100")

Daniel P. Berrangé <berrange@redhat.com> writes:

> Our docs/system/security.rst file loosely classifies code into that
> applicable for 'virtualization' vs 'non-virtualization' use cases.
> Only code relevant to the former group is eligible for security
> bug handling. Peter's recent proposal pointed out that we are
> increasingly hitting the limits of such a crude classification
>
> Michael suggested that with the increased complexity, docs are not
> going to be an effective way to convey the information, and we
> need to re-consider embedding this info in code.  This also allows
> users to validate a configuration's security status when starting
> a guest, or modifying a running guest.
>
> This series is an attempt to start the embedding process.
>
> Probably I should split in multiple series. One introducing the
> overall framework, and then multiple series doing type annotations,
> as the latter really need to be CC'd to maintainers, but the CC
> list would be way too huge on this combined series. At least this
> combined series shows what the real world implictions of this code
> approach will be though.

I appreciate seeing the entire work.  We can split later if it helps
with review.

> It starts with QOM, adding a "bool secure" property to the
> TypeInfo struct, which get turned into a flag on the Type
> struct. This enables querying any ObjectClass to ask whether or
> not it is declared secure.
>
> By only using a single boolean flag, at runtime we are unable
> to distinguish between "marked insecure" and "no decision,
> implicitly insecure". As such, all our existing code is
> initially considered insecure, except for that which gets
> explicit annotation.
>
> The "-compat" argument gains a new parameter
>
>   * insecure-types=accept|reject|warn
>
>     The default 'accept' preserves historical behaviour of
>     anything being permissible. The other two options both
>     identify use of types that are not explicitly marked
>     as secure.
>
> The code annotations are useful immediately, but to make the
> new -compat switch useful, we need to annotate as much as is
> possible. This series makes a strong attempt to do that across
> a large subset of the codebase. My guidance was to mark enough
> as being 'secure', that a downstream RHEL build of QEMU would
> have explicit anntation of most of its devices, with most being
> secure given they target virtualization use cases.
>
> This annotation is 90% complete for the x86 target, but more
> work is needed to finish it and then address the arch specific
> devices for arm, ppc, s390.
>
> Example: TCG is explicitly insecure, KVM is explicitly secure:

[...]

>  281 files changed, 632 insertions(+), 38 deletions(-)

PATCH 01..13, i.e. just the infrastructure:

 docs/system/security.rst     | 43 +++++++++++++++++++++++++++++++++++++++++++
 qapi/compat.json             | 24 +++++++++++++++++++++++-
 qapi/machine.json            |  8 +++++++-
 qapi/qom.json                | 10 ++++++++--
 include/hw/boards.h          | 12 +++++++++++-
 include/hw/i386/pc.h         | 13 ++++++++++++-
 include/qapi/compat-policy.h |  5 +++++
 include/qom/object.h         | 13 +++++++++++++
 hw/core/machine-qmp-cmds.c   |  1 +
 qapi/qapi-util.c             | 30 ++++++++++++++++++++++++++++++
 qom/object.c                 | 30 +++++++++++++++++++++++-------
 qom/qom-qmp-cmds.c           | 30 ++++++++++++++++++++++++------
 system/qdev-monitor.c        | 12 ++++++++++++
 system/vl.c                  | 35 ++++++++++++++++++++++++++++++-----
 14 files changed, 242 insertions(+), 24 deletions(-)

Quite tractable.

The remainder is purely declarative:

    $ git-diff -U0 3f6db27c42..review | egrep '^[-+][^-+]'| sed 's/  */ /g' | sort -u
    + .abstract = true,
    + .class_init = i2c_ddc_class_init,
    + .instance_init = aw_emac_init,
    + .instance_init = xhci_sysbus_instance_init,
    + .secure = false,
    + .secure = true,
    + .secure = true, \
    + isapc_machine_options);
    + type_info.secure = false,
    + type_info.secure = false;
    + type_info.secure = true,
    + xenfv_machine_3_1_options);
    + xenfv_machine_4_2_options);
    +DEFINE_INSECURE_MACHINE("none", machine_none_machine_init)
    +DEFINE_INSECURE_PC_MACHINE(isapc, "isapc", pc_init_isa,
    +DEFINE_SECURE_MACHINE("xenpv", xenpv_machine_init)
    +DEFINE_SECURE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
    +DEFINE_SECURE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
    - .abstract = true
    - .class_init = i2c_ddc_class_init
    - .instance_init = aw_emac_init,
    - .instance_init = xhci_sysbus_instance_init
    - isapc_machine_options);
    - xenfv_machine_3_1_options);
    - xenfv_machine_4_2_options);
    -DEFINE_MACHINE("none", machine_none_machine_init)
    -DEFINE_MACHINE("xenpv", xenpv_machine_init)
    -DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
    -DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
    -DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,

I like it.



      parent reply	other threads:[~2025-10-23 12:42 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 14:01 [PATCH v2 00/32] Encode object type security status in code Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 01/32] qom: replace 'abstract' with 'flags' Daniel P. Berrangé
2025-10-23 10:26   ` Markus Armbruster
2025-10-24 13:39     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 02/32] qom: add tracking of security state of object types Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 03/32] qapi: add 'insecure-types' option for -compat argument Daniel P. Berrangé
2025-10-23 10:38   ` Markus Armbruster
2025-09-26 14:01 ` [PATCH v2 04/32] system: check security for accelerator types Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 05/32] system: report acclerator security status in help output Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 06/32] system: check security for machine types Daniel P. Berrangé
2025-10-23 11:51   ` Markus Armbruster
2025-09-26 14:01 ` [PATCH v2 07/32] system: report machine security status in help output Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 08/32] system: check security of device types Daniel P. Berrangé
2025-10-23 11:54   ` Markus Armbruster
2025-10-24 13:28     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 09/32] system: report device security status in help output Daniel P. Berrangé
2025-10-23 11:57   ` Markus Armbruster
2025-09-26 14:01 ` [PATCH v2 10/32] hw/core: report security status in query-machines Daniel P. Berrangé
2025-10-23 12:17   ` Markus Armbruster
2025-10-24 13:32     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 11/32] qom: report & filter on security status in qom-list-types Daniel P. Berrangé
2025-10-23 10:58   ` Markus Armbruster
2025-10-24 13:38     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 12/32] docs: expand security docs with info about security status Daniel P. Berrangé
2025-10-23 12:22   ` Markus Armbruster
2025-10-24 13:42     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 13/32] machine: add helpers for declaring secure/insecure machine types Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 14/32] hw: mark x86, s390, ppc, arm versioned machine types as secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 15/32] hw: declare Xen & microvm machines as secure, isapc as insecure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 16/32] hw/core: declare 'none' machine to be insecure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 17/32] accel: mark kvm, xen & hvf as secure; tcg & qtest as insecure Daniel P. Berrangé
2026-03-10 13:09   ` Philippe Mathieu-Daudé
2026-03-10 13:28     ` Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 18/32] hw: mark all virtio PCI devices as secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 19/32] hw: mark all virtio CCW " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 20/32] hw: mark all vhost devices a secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 21/32] hw: mark all remaining virtio object types as secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 22/32] hw/vfio: mark all VFIO object classes " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 23/32] hw/xen: mark all Xen related object types as being secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 24/32] hw/net: mark most non-virtio NICs as insecure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 25/32] hw/usb: mark most USB devices/hosts as secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 26/32] hw/watchdog: mark some watchdog devices " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 27/32] hw/scsi: mark most SCSI controllers as insecure / " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 28/32] hw/ide: mark ICH9 and ide-hd/ide-cd " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 29/32] hw: mark test/demo devices as insecure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 30/32] hw: define most common PCI types as secure Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 31/32] hw/pci-host: define some PCI hosts " Daniel P. Berrangé
2025-09-26 14:01 ` [PATCH v2 32/32] hw/display: mark most display adapters as insecure Daniel P. Berrangé
2025-10-23  7:23 ` [PATCH v2 00/32] Encode object type security status in code Markus Armbruster
2025-10-23  9:00   ` Daniel P. Berrangé
2025-10-23 12:38 ` Markus Armbruster [this message]

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=87o6px6be4.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@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.