Re: [PATCH 5/5] KVM: selftests: Test protection of the ucall MMIO region
From: Tharit Tangkijwanichakul
Date: Sat Oct 17 2026 - 11:25:35 EST
> +#define CLOBBERED_SLOT TEST_MEM_SLOT_BASE
Upon self-review, this should have been hardcoded to 1 (to clobber the
reserved ucal mmio).
> + ret = __vm_set_user_memory_region2(vm, CLOBBERED_SLOT, 0,
> + vm->ucall_mmio_addr, slot_size, slot_mem, 0, 0);
> + TEST_ASSERT(ret == -1 && errno == EEXIST,
> + "Expected the ucall GPA overlap to be rejected: ret=%d errno=%d",
> + ret, errno);
This should have been errno == EINVAL check to catch writing to the
exiting read-only slot.
The earlier test accidentally passed because it used a different slot
ID (=2, not reserved) and received EEXIST for overlapping the reserved
ucall GPA. It therefore tested GPA overlap rejection, not the intended
rejection of overwriting slot 1.
I will fix it in v2