[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210930010511.3387967-5-sathyanarayanan.kuppuswamy@linux.intel.com>
Date: Wed, 29 Sep 2021 18:05:09 -0700
From: Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Borislav Petkov <bp@...en8.de>
Cc: x86@...nel.org, Bjorn Helgaas <bhelgaas@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Andreas Noever <andreas.noever@...il.com>,
"Michael S . Tsirkin" <mst@...hat.com>,
Michael Jamet <michael.jamet@...el.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jonathan Corbet <corbet@....net>,
Jason Wang <jasowang@...hat.com>,
Dan Williams <dan.j.williams@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-usb@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest
Confidential guest platforms like TDX have a requirement to allow
only trusted devices. By default the confidential-guest core will
arrange for all devices to default to unauthorized (via
dev_default_authorization) in device_initialize(). Since virtio
driver is already hardened against the attack from the un-trusted host,
override the confidential computing default unauthorized state
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
---
drivers/virtio/virtio.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 588e02fb91d3..377b0ccdc503 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -5,6 +5,8 @@
#include <linux/module.h>
#include <linux/idr.h>
#include <linux/of.h>
+#include <linux/cc_platform.h>
+#include <linux/device.h>
#include <uapi/linux/virtio_ids.h>
/* Unique numbering for virtio devices. */
@@ -390,6 +392,13 @@ int register_virtio_device(struct virtio_device *dev)
dev->config_enabled = false;
dev->config_change_pending = false;
+ /*
+ * For Confidential guest (like TDX), virtio devices are
+ * trusted. So set authorized status as true.
+ */
+ if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
+ dev->dev.authorized = true;
+
/* We always start by resetting the device, in case a previous
* driver messed it up. This also tests that code path a little. */
dev->config->reset(dev);
--
2.25.1
Powered by blists - more mailing lists