]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: selftests: Add basic selftest for guest_memfd()
authorChao Peng <chao.p.peng@linux.intel.com>
Fri, 27 Oct 2023 18:22:16 +0000 (11:22 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Nov 2023 13:01:08 +0000 (08:01 -0500)
commit8a89efd43423cb3005c5e641e846184e292c1465
treea531a83a6999c4d981c43d33d61c539f523b07b9
parent2feabb855df8f0889146c2e951307ba477d1f37b
KVM: selftests: Add basic selftest for guest_memfd()

Add a selftest to verify the basic functionality of guest_memfd():

+ file descriptor created with the guest_memfd() ioctl does not allow
  read/write/mmap operations
+ file size and block size as returned from fstat are as expected
+ fallocate on the fd checks that offset/length on
  fallocate(FALLOC_FL_PUNCH_HOLE) should be page aligned
+ invalid inputs (misaligned size, invalid flags) are rejected
+ file size and inode are unique (the innocuous-sounding
  anon_inode_getfile() backs all files with a single inode...)

Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
Co-developed-by: Ackerley Tng <ackerleytng@google.com>
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
Co-developed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20231027182217.3615211-35-seanjc@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/guest_memfd_test.c [new file with mode: 0644]