Skip to content

KVM: guest_memfd: Fix signed offset+size goof

Sean Christopherson kvm lkml 2 versions – Applied

Status from this message: Applied to kvm-x86 gmem, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied
  2. v33 patches 7 repliesSuperseded

Changes in v4 from the cover letter

- Collect tags. [Mike, Ackerley]
- Use "INT64_MAX - page_size" instead of hardcoded literal. [Sashiko, Ackerley]

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3KVM: guest_memfd: Treat memslot binding offset+size as unsigned valuesvirt/kvm/guest_memfd.c virt/kvm/kvm_mm.h+9 -60 replies
2/3KVM: selftests: Expand the guest_memfd test macros to allow passing the VMtools/testing/selftests/kvm/guest_memfd_test.c+11 -20 replies
3/3KVM: selftests: Add guest_memfd regression test signed offset+size bugtools/testing/selftests/kvm/guest_memfd_test.c+11 -00 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMichael RothAckerley Tng
1/3R-b R-b
2/3R-b T-b
3/3R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] KVM: guest_memfd: Fix signed offset+size goof

Fix a bug where KVM fails to reject a comically large offset into guest_memfd if offset+size results in a signed, negative value. Add a testcase to prove the bug, and to serve as a regression test.

Note, v1 and v2 was part of larger series.

v4:
- Collect tags. [Mike, Ackerley]
- Use "INT64_MAX - page_size" instead of hardcoded literal. [Sashiko, Ackerley]

v3:
- Use uoff_t, not u64. [the combined might of Sean and Ackerley]
- Explaining exactly what is broken. [Ackerley]
- Add a regression test.

v2: https://lore.kernel.org/all/[email protected]
v1: https://lore.kernel.org/r/[email protected]

Sean Christopherson (3):
KVM: guest_memfd: Treat memslot binding offset+size as unsigned values
KVM: selftests: Expand the guest_memfd test macros to allow passing
the VM
KVM: selftests: Add guest_memfd regression test signed offset+size bug

 .../testing/selftests/kvm/guest_memfd_test.c  | 24 +++++++++++++++++--
 virt/kvm/guest_memfd.c                        |  8 +++----
 virt/kvm/kvm_mm.h                             |  7 ++++--
 3 files changed, 31 insertions(+), 8 deletions(-)

base-commit: d1568b1332b6b3b36b222c2868fc102727c12a34

Signature · 1 line
2.54.0.929.g9b7fa37559-goog