On 6/19/2026 8:31 AM, Ackerley Tng via B4 Relay wrote: > From: Ackerley Tng <[email protected]> > > Introduce base support for KVM_SET_MEMORY_ATTRIBUTES2 in guest_memfd, which > just updates attributes tracked by guest_memfd. > > Validate input fields in general. Guard usage of KVM_SET_MEMORY_ATTRIBUTES2 > by making sure requested attributes are supported for this instance of kvm. > > A new KVM_SET_MEMORY_ATTRIBUTES2 is defined to support writes (unlike > KVM_SET_MEMORY_ATTRIBUTES) in addition to reads so it can provide error > details to userspace. This will be used in a later patch. > > The two ioctls use their corresponding structs with no overlap, but > backward compatibility is baked in for future support of > KVM_SET_MEMORY_ATTRIBUTES2 and struct kvm_memory_attributes2 in the VM > ioctl. > > The process of setting memory attributes is set up such that the later half > will not fail due to allocation. Any necessary checks are performed before > the point of no return. > > Co-developed-by: Vishal Annapurve <[email protected]> > Signed-off-by: Vishal Annapurve <[email protected]> > Co-developed-by: Sean Christoperson <[email protected]> > Signed-off-by: Sean Christoperson <[email protected]>
s/Christoperson /Christopherson > Reviewed-by: Fuad Tabba <[email protected]> > Signed-off-by: Ackerley Tng <[email protected]> > --- > include/uapi/linux/kvm.h | 13 ++++++ > virt/kvm/Kconfig | 1 + > virt/kvm/guest_memfd.c | 116 > +++++++++++++++++++++++++++++++++++++++++++++++ > virt/kvm/kvm_main.c | 12 +++++ > 4 files changed, 142 insertions(+) > > [...] > diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig > index 297e4399fbd49..cfa2c78ba5fb9 100644 > --- a/virt/kvm/Kconfig > +++ b/virt/kvm/Kconfig > @@ -102,6 +102,7 @@ config KVM_MMU_LOCKLESS_AGING > > config KVM_GUEST_MEMFD > select XARRAY_MULTI > + select KVM_MEMORY_ATTRIBUTES What's this? This config is gone. > bool >
