From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>, Shuah Khan <shuah@kernel.org>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, Bibo Mao <maobibo@loongson.cn>,
Sean Christopherson <seanjc@google.com>,
Fuad Tabba <tabba@google.com>,
Ackerley Tng <ackerleytng@google.com>
Subject: [PATCH 0/2] KVM: selftests: guest_memfd close() fix and hardening
Date: Fri, 22 May 2026 10:15:33 -0700 [thread overview]
Message-ID: <20260522171535.3525890-1-seanjc@google.com> (raw)
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
next reply other threads:[~2026-05-22 17:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 17:15 Sean Christopherson [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260522171535.3525890-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=ackerleytng@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=tabba@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox