public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Yuan Yu <yuanyu@google.com>, devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	Julien Grall <julien@xen.org>, Gerd Hoffmann <kraxel@redhat.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [PATCH v1 0/2] Add support to disable VirtIo net at runtime
Date: Thu, 4 Aug 2022 07:55:41 +0200	[thread overview]
Message-ID: <087048c2-d9d7-c50b-8b62-8bfe1267e4a0@redhat.com> (raw)
In-Reply-To: <20220804025239.918263-1-yuanyu@google.com>

On 08/04/22 04:52, Yuan Yu wrote:
> Currently networking can only be enabled/disabled at compile time. This
> patch series will add support to disable VirtIo net at runtime even if
> the functionality is built into binary at compile time.
> 
> This will enable VMM to reduce attack surface without recompilation.
> 
> The changes can be seen at:
> https://github.com/yyu/edk2/tree/network_cfg_lib_v1
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Julien Grall <julien@xen.org>
> 
> Yuan Yu (2):
>   OvmfPkg: Introduce NetworkCfgLib
>   OvmfPkg: Use PcdNetworkSupport to enable/disable VirtIo net
> 
>  OvmfPkg/OvmfPkg.dec                             |  3 ++
>  OvmfPkg/OvmfPkgX64.dsc                          |  7 ++++-
>  OvmfPkg/Library/NetworkCfgLib/NetworkCfgLib.inf | 29 ++++++++++++++++++
>  OvmfPkg/VirtioNetDxe/VirtioNet.inf              |  3 ++
>  OvmfPkg/Library/NetworkCfgLib/NetworkCfgLib.c   | 32 ++++++++++++++++++++
>  OvmfPkg/VirtioNetDxe/EntryPoint.c               | 10 ++++++
>  6 files changed, 83 insertions(+), 1 deletion(-)
>  create mode 100644 OvmfPkg/Library/NetworkCfgLib/NetworkCfgLib.inf
>  create mode 100644 OvmfPkg/Library/NetworkCfgLib/NetworkCfgLib.c
> 

Well I've not been reviewing upstream edk2 patches for a while, but the
virtio-net driver is still very close to my heart, so this patch kind of
hits a nerve.

I think I disagree with the idea and the implementation both.

Minimally, the idea needs a much better elaboration -- what is the
threat model? Do you want to protect the host from the guest, or the
guest from the host? Or something else? How does controlling a single
SNP driver via fw_cfg (which is also dictated by the host) help?

Regarding the implementation: there is much more to networking in edk2
than VirtioNetDxe. UEFI driver binaries (SNP drivers) built from iPXE
can be passed in via the NICs' option ROMs. SNP drivers can be loaded
from the UEFI system partition (for example, Intel's binary-only driver
for QEMU's e1000* cards).

If you can control this fw_cfg switch from the VMM side, you can also
control the VMM enough to simply *not give* a virtio-net device to the
guest. Then the driver (it being a UEFI driver following the UEFI driver
model) will simply not have anything to bind.

Sorry I find this approach very wrong. If you really need it for your
particular VMM, I kind of suggest not upstreaming this patch. I see it
as a step backwards for the upstream project.

Anyway: I emphasize I'm no longer a reviewer for OvmfPkg, and it's quite
exceptional that I'm reacting at all to being CC'd on this.

Laszlo


  parent reply	other threads:[~2022-08-04  5:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04  2:52 [PATCH v1 0/2] Add support to disable VirtIo net at runtime Yuan Yu
2022-08-04  2:52 ` [PATCH v1 1/2] OvmfPkg: Introduce NetworkCfgLib Yuan Yu
2022-08-04  2:52 ` [PATCH v1 2/2] OvmfPkg: Use PcdNetworkSupport to enable/disable VirtIo net Yuan Yu
2022-08-04  5:55 ` Laszlo Ersek [this message]
2022-08-04  9:58   ` [edk2-devel] [PATCH v1 0/2] Add support to disable VirtIo net at runtime Ard Biesheuvel
2022-08-04 10:54     ` Laszlo Ersek

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-list 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=087048c2-d9d7-c50b-8b62-8bfe1267e4a0@redhat.com \
    --to=devel@edk2.groups.io \
    /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