From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Carlos Bilbao" <carlos.bilbao.osdev@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Hari Mishal" <harimishal1@gmail.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
elena.reshetova@intel.com, huster@cs.uni-goettingen.de,
mhollick@seemoo.de, jiska.classen@hpi.de
Subject: Re: [PATCH v2 1/4] virtio-mem: validate device-reported block size
Date: Mon, 20 Jul 2026 10:19:09 +0100 [thread overview]
Message-ID: <8237ffef-4fb4-40b4-82c3-e9236032ab7e@kernel.org> (raw)
In-Reply-To: <2026072036-outburst-rebel-c71b@gregkh>
>>> We've the virto-mem config struct layout and the kernel source, so for
>>> obvious fixes like a NULL check, static analysis is better than fuzzing.
>>> Claude took a few mins to find me two examples:
>>>
>>> Patch 1: virtio-mem: reject non-power-of-two device_block_size
>>> This one is for virtio_mem_init() to check if
>>> !is_power_of_2(vm->device_block_size)
>>>
>>> Patch 2: virto-mem: validate region_size and usable_region_size
>>> THis one checks region_size != 0 and vm->usable_reion_size >
>>> vm->region_size.
>>>
>>> An endless factory of "silly" checks like these are low hanging fruit.
>>
>> "silly" is the right word.
>
> "silly" in what way?
>
As in producing "silly" low-hanging fruit patches that don't move the needle
when it comes to security.
> Seriously, I'm trying to figure out what you all care about here and
> what exactly the threat model you want this driver to work in, and I'm
> getting conflicting answers.
>
> Either you all do worry about the "device" sending bad data and want to
> protect from that, or you don't and you trust it. Pick one please so
> that we know how to deal with these bug reports we are getting.
>
> For example, for USB we have said our threat model is:
>
> - we do NOT trust the device before a driver is bound to the device,
> so if a malicious device can do something to the kernel, the kernel
> needs to be fixed.
> - During the probe() call for a USB driver, the driver does NOT trust
> the device, and again, anything a malicious device can do to the
> kernel, the kernel should fix.
> - After probe() for a USB driver succeeds, it's up to the driver if it
> wants to validate all data coming from the device or not. Right
> now, in general, the kernel trusts the device at that point in time
> so additional checks are discretionary and at the whim of the
> maintainer.
>
> For that last point, I will note that some BIG users of Linux (i.e.
> billions of Android devices) still explicitly do NOT want to trust the
> USB device at this point in time, and are relying on the kernel to
> protect the system from bad devices. In that case, various patches have
> been taken to different drivers and subsystems to play whack-a-mole on
> while Android gets their act together to finally come up with a solid
> defensive plan (like ChromeOS has had for a decade.) It will be seen
> which happens first, all drivers are properly fuzzed and fixed up, or
> Android gets their act together and finally fixes their b0rked system
> trust model. I think Android management is relying on the kernel
> community to do the kernel work as they keep refusing to staff the
> userspace work that they need to do here...
Right, and for virtio devices trusting the device after probe is just extremely
questionable.
What changes during probe that the device suddenly sends us good data?
Why would a hypervisor that tried to break us before probe not try to break us
after probe?
>
> And yes, I really need to write this up in a more solid document for USB
> and get it into the tree, but at least this email thread has forced me
> to write down the above :)
>
>
> So, again, for virtio drivers, what exactly do you all want to say is
> your threat model that the drivers need to handle? Can you all agree on
> something please? Otherwise, for new developers like Hari, this is
> totaly confusion as to what they should be doing.
Well, I am also totally confused why we end up checking against some MUST
clauses in the spec, but not against others.
I am very much in favor of making virtio-mem completely safe to use even in
coco, where it is currently not used at all.
If it's really about "don't let a device trigger any unexpected kernel code
execution by sanitizing all input data", fine with me. We should do exactly
that. Try checking all MUST clauses etc.
But I don't think doing the "low hanging fruit" adds any security. It should be
done properly or not at all.
--
Cheers,
David
next prev parent reply other threads:[~2026-07-20 9:19 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 14:22 [PATCH 0/4] virtio: validate device-reported values across drivers Hari Mishal
2026-07-15 14:22 ` [PATCH 1/4] virtio-mem: validate device-reported block size Hari Mishal
2026-07-15 15:57 ` Michael S. Tsirkin
2026-07-15 16:41 ` [PATCH v2 " Hari Mishal
2026-07-16 8:55 ` David Hildenbrand (Arm)
2026-07-16 14:18 ` Greg Kroah-Hartman
2026-07-16 15:59 ` David Hildenbrand (Arm)
2026-07-17 5:03 ` Greg Kroah-Hartman
2026-07-17 5:48 ` Michael S. Tsirkin
2026-07-17 8:39 ` David Hildenbrand (Arm)
2026-07-17 8:59 ` Michael S. Tsirkin
2026-07-17 9:14 ` Greg Kroah-Hartman
2026-07-17 10:10 ` Michael S. Tsirkin
2026-07-17 10:15 ` Greg Kroah-Hartman
2026-07-17 10:21 ` David Hildenbrand (Arm)
2026-07-17 10:28 ` Michael S. Tsirkin
2026-07-17 10:44 ` Greg Kroah-Hartman
2026-07-17 11:00 ` David Hildenbrand (Arm)
2026-07-17 10:23 ` Michael S. Tsirkin
2026-07-17 10:46 ` Greg Kroah-Hartman
2026-07-17 10:52 ` Michael S. Tsirkin
2026-07-17 12:07 ` Greg Kroah-Hartman
2026-07-17 13:08 ` Michael S. Tsirkin
2026-07-17 14:31 ` Greg Kroah-Hartman
2026-07-17 15:27 ` Michael Kelley
2026-07-17 16:28 ` Michael S. Tsirkin
2026-07-17 16:30 ` Michael S. Tsirkin
2026-07-18 3:31 ` Carlos Bilbao
2026-07-18 5:29 ` Greg Kroah-Hartman
2026-07-18 17:07 ` Carlos Bilbao
2026-07-18 17:21 ` Michael S. Tsirkin
2026-07-18 17:41 ` Carlos Bilbao
2026-07-20 7:57 ` David Hildenbrand (Arm)
2026-07-20 8:28 ` Greg Kroah-Hartman
2026-07-20 9:19 ` David Hildenbrand (Arm) [this message]
2026-07-15 14:22 ` [PATCH 2/4] virtio_input: validate device-reported multitouch slot count Hari Mishal
2026-07-15 15:50 ` Michael S. Tsirkin
2026-07-15 16:07 ` Hari Mishal
2026-07-15 16:11 ` Michael S. Tsirkin
2026-07-15 18:25 ` Dmitry Torokhov
[not found] ` <CAMmC+=DXS=xs0CZyf+N-71NT8D51xQYatBv=dfVQC1aBohDdmA@mail.gmail.com>
[not found] ` <alkTnRb9qhgcMGGi@google.com>
2026-07-16 17:33 ` Dmitry Torokhov
2026-07-15 16:41 ` [PATCH v2 " Hari Mishal
2026-07-15 14:22 ` [PATCH 3/4] virtio_console: avoid NULL portdev dereference in in_intr() Hari Mishal
2026-07-15 14:22 ` [PATCH 4/4] virtio_console: take a kref in find_port_by_vq() to fix port UAF Hari Mishal
2026-07-15 14:42 ` [PATCH v2 " Hari Mishal
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=8237ffef-4fb4-40b4-82c3-e9236032ab7e@kernel.org \
--to=david@kernel.org \
--cc=carlos.bilbao.osdev@gmail.com \
--cc=elena.reshetova@intel.com \
--cc=eperezma@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=harimishal1@gmail.com \
--cc=huster@cs.uni-goettingen.de \
--cc=jasowangio@gmail.com \
--cc=jiska.classen@hpi.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mhollick@seemoo.de \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome