The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: selftests: guest_memfd close() fix and hardening
@ 2026-05-22 17:15 Sean Christopherson
  2026-05-22 17:15 ` [PATCH 1/2] KVM: selftests: Cast guest_memfd fd to a signed int when checking for >= 0 Sean Christopherson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sean Christopherson @ 2026-05-22 17:15 UTC (permalink / raw)
  To: Paolo Bonzini, Shuah Khan
  Cc: kvm, linux-kselftest, linux-kernel, Bibo Mao, Sean Christopherson,
	Fuad Tabba, Ackerley Tng

Fix a bug where freeing a VM attempts to close an invalid guest_memfd instance
due to checking if a u32 value is non-negative.  Then harden closing of fds in
kvm_util by invalidating fds after they are closed, e.g. so that freeing an fd
multiple times will fail instead of silently closing the wrong file.

Sean Christopherson (2):
  KVM: selftests: Cast guest_memfd fd to a signed int when checking for
    >= 0
  KVM: selftests: Add and use kvm_free_fd() to harden against fd goofs

 .../selftests/kvm/include/kvm_syscalls.h      |  6 +++++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 25 +++++++++----------
 2 files changed, 18 insertions(+), 13 deletions(-)


base-commit: 66939c1603bd5579e63278f9dc72cba5b79da9b5
-- 
2.54.0.794.g4f17f83d09-goog


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

end of thread, other threads:[~2026-05-27 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-22 17:15 [PATCH 0/2] KVM: selftests: guest_memfd close() fix and hardening Sean Christopherson
2026-05-22 17:15 ` [PATCH 1/2] KVM: selftests: Cast guest_memfd fd to a signed int when checking for >= 0 Sean Christopherson
2026-05-22 17:49   ` Ackerley Tng
2026-05-25  3:00   ` Bibo Mao
2026-05-22 17:15 ` [PATCH 2/2] KVM: selftests: Add and use kvm_free_fd() to harden against fd goofs Sean Christopherson
2026-05-22 17:50   ` Ackerley Tng
2026-05-27 18:10 ` [PATCH 0/2] KVM: selftests: guest_memfd close() fix and hardening Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox