Currently, there are no x86 test cases to verify that read and execute on RO-memslot succeeds, and write is blocked as MMIO fault. This behavior might break if changes are made to the MMIO path, because x86's RO-memslot relies on the fault propagation mechanism for MMIO.
The first patch adds a function vm_userspace_mem_region_add_map(), which is essentially the memslot setup code extracted from spawn_vm(). The second patch adds an x86 test case for read/write/exec on RO-memslot. This series is developed based on kvm/master, although this series adds a test case for x86. This is because the first patch changes the spawn_vm() function, which is used in the tests for other architectures. base-commit: 0de4a0eec25b9171f2a2abb1a820e125e6797770 Yohei Kojima (2): KVM: selftests: Extract memslot setup code from spawn_vm() KVM: selftests: Add test case for readonly memslots on x86 .../selftests/kvm/set_memory_region_test.c | 147 +++++++++++++++--- 1 file changed, 129 insertions(+), 18 deletions(-) -- 2.43.0

