Re: [PATCH v8 13/46] KVM: guest_memfd: Add base support for KVM_SET_MEMORY_ATTRIBUTES2
From: Ackerley Tng <hidden>
Date: 2026-06-24 21:10:38
Also in:
kvm, linux-coco, linux-doc, linux-kselftest, linux-mm, lkml
Binbin Wu [off-list ref] writes:
On 6/19/2026 8:31 AM, Ackerley Tng via B4 Relay wrote:quoted
From: Ackerley Tng <redacted> 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 <redacted> Signed-off-by: Vishal Annapurve <redacted> Co-developed-by: Sean Christoperson <seanjc@google.com> Signed-off-by: Sean Christoperson <seanjc@google.com>s/Christoperson /Christopherson
Thanks!
quoted
Reviewed-by: Fuad Tabba <tabba@google.com> Signed-off-by: Ackerley Tng <redacted> --- 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(+)[...]quoted
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_ATTRIBUTESWhat's this? This config is gone.
I'm surprised this compiles... I'll fix it, thanks!
quoted
bool