lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aN1dCAuOfy5RADR0@google.com>
Date: Wed, 1 Oct 2025 09:55:36 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Vishal Annapurve <vannapurve@...gle.com>
Cc: Ackerley Tng <ackerleytng@...gle.com>, kvm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Yan Zhao <yan.y.zhao@...el.com>, 
	Fuad Tabba <tabba@...gle.com>, Binbin Wu <binbin.wu@...ux.intel.com>, 
	Michael Roth <michael.roth@....com>, Ira Weiny <ira.weiny@...el.com>, 
	Rick P Edgecombe <rick.p.edgecombe@...el.com>, David Hildenbrand <david@...hat.com>, 
	Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [RFC PATCH v2 02/51] KVM: guest_memfd: Introduce and use
 shareability to guard faulting

On Wed, Oct 01, 2025, Vishal Annapurve wrote:
> On Tue, Sep 30, 2025 at 4:40 PM Sean Christopherson <seanjc@...gle.com> wrote:
> >
> > > +};
> > > +
> > > +enum shareability {
> > > +     SHAREABILITY_GUEST = 1, /* Only the guest can map (fault) folios in this range. */
> > > +     SHAREABILITY_ALL = 2,   /* Both guest and host can fault folios in this range. */
> > > +};
> >
> > Rather than define new values and new KVM uAPI, I think we should instead simply
> > support KVM_SET_MEMORY_ATTRIBUTES.  We'll probably need a new CAP, as I'm not sure
> > supporting KVM_CHECK_EXTENSION+KVM_CAP_MEMORY_ATTRIBUTES on a gmem fd would be a
> > good idea (e.g. trying to do KVM_CAP_GUEST_MEMFD_FLAGS on a gmem fd doesn't work
> > because the whole point is to get flags _before_ creating the gmem instance).  But
> > adding e.g. KVM_CAP_GUEST_MEMFD_MEMORY_ATTRIBUTES is easy enough.
> >
> > But for specifying PRIVATE vs. SHARED, I don't see any reason to define new uAPI.
> > I also don't want an entirely new set of terms in KVM to describe the same things.
> > PRIVATE and SHARED are far from perfect, but they're better than https://xkcd.com/927.
> > And if we ever want to let userspace restrict RWX protections in gmem, we'll have
> > a ready-made way to do so.
> >
> 
> I don't understand why we need to reuse KVM_SET_MEMORY_ATTRIBUTES. It
> anyways is a new ABI as it's on a guest_memfd FD instead of KVM FD.

Yes, it's new functionality, but the semantics are the same (modulo s/address/offset),
which makes life easier for KVM and its developers.  Specifically I want to avoid
ending up with two entirely different ways for describing private vs. shared memory.
E.g. I don't want to have to translate between SHAREABILITY_GUEST and PRIVATE,
in code or in conversation.

> RWX protections seem to be pagetable configuration rather than
> guest_memfd properties. Can mmap flags + kvm userfaultfd help enforce
> RWX protections?

No, because mmap() is optional.  Potential use cases are for (seletively)
restricting _guest_ access as well as host access.  mmap() isn't a good fit
regardless, as that's much more about describing what the process wants, not
the properties of the underlying memory.

E.g. read-only and noexec file systems exist for a reason.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ