All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities
@ 2019-01-18  9:39 Erik Skultety
  2019-01-18 10:16 ` Daniel P. Berrangé
  2019-01-18 12:51 ` Singh, Brijesh
  0 siblings, 2 replies; 23+ messages in thread
From: Erik Skultety @ 2019-01-18  9:39 UTC (permalink / raw)
  To: libvir-list; +Cc: qemu-devel, brijesh.singh, berrange, dinechin, mkletzan

Hi,
this is a summary of a private discussion I've had with guys CC'd on this email
about finding a solution to [1] - basically, the default permissions on
/dev/sev (below) make it impossible to query for SEV platform capabilities,
since by default we run QEMU as qemu:qemu when probing for capabilities. It's
worth noting is that this is only relevant to probing, since for a proper QEMU
VM we create a mount namespace for the process and chown all the nodes (needs a
SEV fix though).

# ll /dev/sev
crw-------. 1 root root

I suggested either force running QEMU as root for probing (despite the obvious
security implications) or using namespaces for probing too. Dan argued that
this would have a significant perf impact and suggested we ask systemd to add a
global udev rule.

I proceeded with cloning [1] to systemd and creating an udev rule that I planned
on submitting to systemd upstream - the initial idea was to mimic /dev/kvm and
make it world accessible to which Brijesh from AMD expressed a concern that
regular users might deplete the resources (limit on the number of guests
allowed by the platform). But since the limit is claimed to be around 4, Dan
discouraged me to continue with restricting the udev rule to only the 'kvm'
group which Laszlo suggested earlier as the limit is so small that a malicious
QEMU could easily deplete this during probing. This fact also ruled out any
kind of ACL we could create dynamically. Instead, he suggested that we filter
out the kvm-capable QEMU and put only that one in the namespace without a
significant perf impact.
    - my take on this is that there could potentially be more than a single
      kvm-enabled QEMU and therefore we'd need to create more than just a
      single namespace.
    - I also argued that I can image that the same kind of DOS attack might be
      possible from within the namespace, even if we created the /dev/sev node
      only in SEV-enabled guests (which we currently don't). All of us have
      agreed that allowing /dev/sev in the namespace for only SEV-enabled
      guests is worth doing nonetheless.

In the meantime, Christophe went through the kernel code to verify how the SEV
resources are managed and what protection is currently in place to mitigate the
chance of a process easily depleting the limit on SEV guests. He found that
ASID, which determines the encryption key, is allocated from a single ASID
bitmap and essentially guarded by a single 'sev->active' flag.

So, in conclusion, we absolutely need input from Brijesh (AMD) whether there
was something more than the low limit on number of guests behind the default
permissions. Also, we'd like to get some details on how the limit is managed,
helping to assess the approaches mentioned above.

Thanks and please do share your ideas,
Erik

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1665400
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1561113

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-01-31 15:28 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18  9:39 [Qemu-devel] AMD SEV's /dev/sev permissions and probing QEMU for capabilities Erik Skultety
2019-01-18 10:16 ` Daniel P. Berrangé
2019-01-18 10:56   ` [Qemu-devel] [libvirt] " Erik Skultety
2019-01-18 11:11   ` [Qemu-devel] " Martin Kletzander
2019-01-18 11:17     ` Daniel P. Berrangé
2019-01-18 11:31       ` Martin Kletzander
2019-01-18 12:51 ` Singh, Brijesh
2019-01-23 12:55   ` Erik Skultety
2019-01-23 13:10     ` Daniel P. Berrangé
2019-01-23 13:22       ` Erik Skultety
2019-01-23 13:24         ` Daniel P. Berrangé
2019-01-23 13:33           ` Erik Skultety
2019-01-23 13:36             ` Daniel P. Berrangé
2019-01-23 15:02               ` Singh, Brijesh
2019-01-23 15:29                 ` Erik Skultety
2019-01-29 16:15                 ` Erik Skultety
2019-01-29 18:40                   ` Daniel P. Berrangé
2019-01-30  8:06                     ` Erik Skultety
2019-01-30 10:37                       ` Daniel P. Berrangé
2019-01-30 13:39                         ` Erik Skultety
2019-01-30 17:47                           ` Singh, Brijesh
2019-01-30 18:18                           ` Daniel P. Berrangé
2019-01-31 15:28                             ` Erik Skultety

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.