Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Christian Borntraeger
Am 30.09.21 um 03:20 schrieb Halil Pasic: This patch fixes a regression introduced by commit 82e89ea077b9 ("virtio-blk: Add validation for block size in config space") and enables similar checks in verify() on big endian platforms. The problem with checking multi-byte config fields in the

[PATCH][next] drm/virtio: fix potential integer overflow on shift of a int

2021-09-30 Thread Colin King
From: Colin Ian King The left shift of unsigned int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then assigned to a signed 64 bit integer. In the case where i is 32 or more this can lead to an overflow. Fix this by shifting the value 1ULL instead. Addresses-Coverity:

Re: [PATCH RFC v1 01/11] uapi/virtio-iommu: Add page request grp-id and flags information

2021-09-30 Thread Jean-Philippe Brucker
On Thu, Sep 30, 2021 at 10:26:35AM +0530, Vivek Kumar Gautam wrote: > > I'm not sure why we made it 32-bit in Linux UAPI, it's a little wasteful. > > PCIe PRGI is 9-bits and SMMU STAG is 16-bits. Since the scope of the grpid > > is the endpoint, 16-bit means 64k in-flight faults per endpoint,

Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Cornelia Huck
On Thu, Sep 30 2021, Halil Pasic wrote: > This patch fixes a regression introduced by commit 82e89ea077b9 > ("virtio-blk: Add validation for block size in config space") and > enables similar checks in verify() on big endian platforms. > > The problem with checking multi-byte config fields in

[PATCH][next] drm/virtio: fix another potential integer overflow on shift of a int

2021-09-30 Thread Colin King
From: Colin Ian King The left shift of unsigned int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then assigned to a signed 64 bit integer. In the case where value is 32 or more this can lead to an overflow (value can be in range 0..MAX_CAPSET_ID (63). Fix this by shifting

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Rafael J. Wysocki
On Thu, Sep 30, 2021 at 6:59 AM Dan Williams wrote: > > On Wed, Sep 29, 2021 at 7:39 PM Kuppuswamy, Sathyanarayanan > wrote: > > > > > > > > On 9/29/21 6:55 PM, Dan Williams wrote: > > >> Also, you ignored the usb_[de]authorize_interface() functions and > > >> their friends. > > > Ugh, yes. > >

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 4:03 AM Michael S. Tsirkin wrote: > > On Wed, Sep 29, 2021 at 06:05:09PM -0700, Kuppuswamy Sathyanarayanan wrote: > > Confidential guest platforms like TDX have a requirement to allow > > only trusted devices. By default the confidential-guest core will > > arrange for all

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 06:36:18AM -0700, Dan Williams wrote: > On Thu, Sep 30, 2021 at 4:03 AM Michael S. Tsirkin wrote: > > > > On Wed, Sep 29, 2021 at 06:05:09PM -0700, Kuppuswamy Sathyanarayanan wrote: > > > Confidential guest platforms like TDX have a requirement to allow > > > only trusted

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan wrote: > > > While the common case for device-authorization is to skip probe of > > >

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > I don't see any point in talking about "untrusted drivers". If a > driver isn't trusted then it doesn't belong in your kernel. Period. > When you load a driver into your kernel, you are implicitly trusting > it (aside from

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan wrote: > While the common case for device-authorization is to skip probe of > unauthorized devices, some buses may still want to emit a message on > probe failure (Thunderbolt), or base probe failures on the > authorization

Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Halil Pasic
On Thu, 30 Sep 2021 11:28:23 +0200 Cornelia Huck wrote: > On Thu, Sep 30 2021, Halil Pasic wrote: > > > This patch fixes a regression introduced by commit 82e89ea077b9 > > ("virtio-blk: Add validation for block size in config space") and > > enables similar checks in verify() on big endian

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Michael S. Tsirkin
On Wed, Sep 29, 2021 at 06:05:09PM -0700, Kuppuswamy Sathyanarayanan wrote: > 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)

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan wrote: > > While the common case for device-authorization is to skip probe of > > unauthorized devices, some buses may still want to emit a message on > >

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 10:38:42AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan > > > wrote:

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan > > > wrote: > > > >

Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Cornelia Huck
On Thu, Sep 30 2021, "Michael S. Tsirkin" wrote: > On Thu, Sep 30, 2021 at 03:20:49AM +0200, Halil Pasic wrote: >> This patch fixes a regression introduced by commit 82e89ea077b9 >> ("virtio-blk: Add validation for block size in config space") and >> enables similar checks in verify() on big

Re: [PATCH 2/2] virtio-blk: set NUMA affinity for a tagset

2021-09-30 Thread Stefan Hajnoczi
On Wed, Sep 29, 2021 at 06:07:52PM +0300, Max Gurtovoy wrote: > > On 9/28/2021 9:47 AM, Stefan Hajnoczi wrote: > > On Mon, Sep 27, 2021 at 08:39:30PM +0300, Max Gurtovoy wrote: > > > On 9/27/2021 11:09 AM, Stefan Hajnoczi wrote: > > > > On Sun, Sep 26, 2021 at 05:55:18PM +0300, Max Gurtovoy

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Alan Stern
On Wed, Sep 29, 2021 at 06:55:12PM -0700, Dan Williams wrote: > On Wed, Sep 29, 2021 at 6:43 PM Alan Stern wrote: > > > > On Wed, Sep 29, 2021 at 06:05:06PM -0700, Kuppuswamy Sathyanarayanan wrote: > > > Currently bus drivers like "USB" or "Thunderbolt" implement a custom > > > version of device

Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 03:20:49AM +0200, Halil Pasic wrote: > This patch fixes a regression introduced by commit 82e89ea077b9 > ("virtio-blk: Add validation for block size in config space") and > enables similar checks in verify() on big endian platforms. > > The problem with checking multi-byte

Re: [RFC PATCH 1/1] virtio: write back features before verify

2021-09-30 Thread Cornelia Huck
On Thu, Sep 30 2021, Halil Pasic wrote: > On Thu, 30 Sep 2021 11:28:23 +0200 > Cornelia Huck wrote: > >> On Thu, Sep 30 2021, Halil Pasic wrote: >> >> > This patch fixes a regression introduced by commit 82e89ea077b9 >> > ("virtio-blk: Add validation for block size in config space") and >> >

[PATCH] x86/paravirt: use %rip-relative addressing in hook calls

2021-09-30 Thread Jan Beulich via Virtualization
While using a plain (constant) address works, its use needlessly invokes a SIB addressing mode, making every call site one byte larger than necessary. Instead of using an "i" constraint with address-of operator and a 'c' operand modifier, simply use an ordinary "m" constraint, which the 64-bit

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Alan Stern
On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > On Wed, Sep 29, 2021 at 06:05:07PM -0700, Kuppuswamy Sathyanarayanan wrote: > > > While the common case for device-authorization is to skip probe of > > >

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 11:32:41AM -0400, Alan Stern wrote: > On Thu, Sep 30, 2021 at 10:48:54AM -0400, Michael S. Tsirkin wrote: > > On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > > > I don't see any point in talking about "untrusted drivers". If a > > > driver isn't trusted then

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 08:18:18AM -0700, Kuppuswamy, Sathyanarayanan wrote: > > > On 9/30/21 6:36 AM, Dan Williams wrote: > > > And in particular, not all virtio drivers are hardened - > > > I think at this point blk and scsi drivers have been hardened - so > > > treating them all the same

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 08:18:18AM -0700, Kuppuswamy, Sathyanarayanan wrote: > > > On 9/30/21 6:36 AM, Dan Williams wrote: > > > And in particular, not all virtio drivers are hardened - > > > I think at this point blk and scsi drivers have been hardened - so > > > treating them all the same

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 11:00:07AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 30, 2021 at 04:49:23PM +0200, Greg Kroah-Hartman wrote: > > On Thu, Sep 30, 2021 at 10:38:42AM -0400, Michael S. Tsirkin wrote: > > > On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > > > > On

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 8:00 AM Alan Stern wrote: > > On Wed, Sep 29, 2021 at 06:55:12PM -0700, Dan Williams wrote: > > On Wed, Sep 29, 2021 at 6:43 PM Alan Stern > > wrote: > > > > > > On Wed, Sep 29, 2021 at 06:05:06PM -0700, Kuppuswamy Sathyanarayanan > > > wrote: > > > > Currently bus

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 4:20 AM Yehezkel Bernat wrote: > > On Thu, Sep 30, 2021 at 4:05 AM Kuppuswamy Sathyanarayanan > wrote: > > > > no functional > > changes other than value 2 being not visible to the user. > > > > Are we sure we don't break any user-facing tool with it? Tools might use this

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 11:35:09AM -0400, Alan Stern wrote: > On Thu, Sep 30, 2021 at 10:58:07AM -0400, Michael S. Tsirkin wrote: > > On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > > > I don't see any point in talking about "untrusted drivers". If a > > > driver isn't trusted then

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Andi Kleen
The "it" that I referred to is the claim that no driver should be touching hardware in their module init call. Andi seems to think such drivers are worth working around with a special remap API. Andi is wrong. While overall it's a small percentage of the total, there are still quite a few

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Michael S. Tsirkin
On Thu, Sep 30, 2021 at 04:49:23PM +0200, Greg Kroah-Hartman wrote: > On Thu, Sep 30, 2021 at 10:38:42AM -0400, Michael S. Tsirkin wrote: > > On Thu, Sep 30, 2021 at 03:52:52PM +0200, Greg Kroah-Hartman wrote: > > > On Thu, Sep 30, 2021 at 06:59:36AM -0400, Michael S. Tsirkin wrote: > > > > On

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Alan Stern
On Thu, Sep 30, 2021 at 10:48:54AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > > I don't see any point in talking about "untrusted drivers". If a > > driver isn't trusted then it doesn't belong in your kernel. Period. > > When you load a

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Alan Stern
On Thu, Sep 30, 2021 at 10:58:07AM -0400, Michael S. Tsirkin wrote: > On Thu, Sep 30, 2021 at 10:43:05AM -0400, Alan Stern wrote: > > I don't see any point in talking about "untrusted drivers". If a > > driver isn't trusted then it doesn't belong in your kernel. Period. > > When you load a

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Greg Kroah-Hartman
On Thu, Sep 30, 2021 at 10:17:09AM -0700, Andi Kleen wrote: > > > > The "it" that I referred to is the claim that no driver should be > > > touching hardware in their module init call. Andi seems to think > > > such drivers are worth working around with a special remap API. > > Andi is wrong. >

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Andi Kleen
I don't think the current mitigations under discussion here are about keeping the system working. In fact most encrypted VM configs tend to stop booting as a preferred way to handle security issues. Maybe we should avoid the "trusted" term here. We're only really using it because USB is

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 12:50 PM Kuppuswamy, Sathyanarayanan wrote: > > > > On 9/30/21 12:04 PM, Dan Williams wrote: > >>> That's why it was highlighted in the changelog. Hopefully a > >>> Thunderbolt developer can confirm if it is a non-issue. > >>>

Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 11:25 AM Yehezkel Bernat wrote: > > On Thu, Sep 30, 2021 at 6:28 PM Dan Williams wrote: > > > > On Thu, Sep 30, 2021 at 4:20 AM Yehezkel Bernat > > wrote: > > > > > > On Thu, Sep 30, 2021 at 4:05 AM Kuppuswamy Sathyanarayanan > > > wrote: > > > > > > > > no functional

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Andi Kleen
On 9/30/2021 8:18 AM, Kuppuswamy, Sathyanarayanan wrote: On 9/30/21 6:36 AM, Dan Williams wrote: And in particular, not all virtio drivers are hardened - I think at this point blk and scsi drivers have been hardened - so treating them all the same looks wrong. My understanding was that

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Andi Kleen
If all you want to do is prevent someone from loading a bunch of drivers that you have identified as unhardened, why not just use a modprobe blacklist? That wouldn't help for builtin drivers, we cannot control initcalls. This LWN article has more details on the background.

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Alan Stern
On Thu, Sep 30, 2021 at 12:23:36PM -0700, Andi Kleen wrote: > > > I don't think the current mitigations under discussion here are about > > keeping the system working. In fact most encrypted VM configs tend to > > stop booting as a preferred way to handle security issues. > > Maybe we should

Re: [PATCH v2 4/6] virtio: Initialize authorized attribute for confidential guest

2021-09-30 Thread Andi Kleen
On 9/30/2021 12:04 PM, Kuppuswamy, Sathyanarayanan wrote: On 9/30/21 8:23 AM, Greg Kroah-Hartman wrote: On Thu, Sep 30, 2021 at 08:18:18AM -0700, Kuppuswamy, Sathyanarayanan wrote: On 9/30/21 6:36 AM, Dan Williams wrote: And in particular, not all virtio drivers are hardened - I think

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Andi Kleen
On 9/30/2021 10:23 AM, Greg Kroah-Hartman wrote: On Thu, Sep 30, 2021 at 10:17:09AM -0700, Andi Kleen wrote: The "it" that I referred to is the claim that no driver should be touching hardware in their module init call. Andi seems to think such drivers are worth working around with a special

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 1:44 PM Alan Stern wrote: > > On Thu, Sep 30, 2021 at 12:23:36PM -0700, Andi Kleen wrote: > > > > > I don't think the current mitigations under discussion here are about > > > keeping the system working. In fact most encrypted VM configs tend to > > > stop booting as a

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Alan Stern
On Thu, Sep 30, 2021 at 01:52:59PM -0700, Dan Williams wrote: > On Thu, Sep 30, 2021 at 1:44 PM Alan Stern wrote: > > > > On Thu, Sep 30, 2021 at 12:23:36PM -0700, Andi Kleen wrote: > > > > > > > I don't think the current mitigations under discussion here are about > > > > keeping the system

Re: [PATCH v2 2/6] driver core: Add common support to skip probe for un-authorized devices

2021-09-30 Thread Dan Williams
On Thu, Sep 30, 2021 at 6:41 PM Alan Stern wrote: > > On Thu, Sep 30, 2021 at 01:52:59PM -0700, Dan Williams wrote: > > On Thu, Sep 30, 2021 at 1:44 PM Alan Stern > > wrote: > > > > > > On Thu, Sep 30, 2021 at 12:23:36PM -0700, Andi Kleen wrote: > > > > > > > > > I don't think the current