check ToPA allocation success
Check size returned for ToA allocation instead of blind mmap + assert. Requires KVM-Nyx change to return error on allocation fail.
This commit is contained in:
parent
5701e26966
commit
b1fd5f1039
5
nyx/pt.c
5
nyx/pt.c
@ -322,6 +322,11 @@ void pt_pre_kvm_run(CPUState *cpu)
|
||||
assert(cpu->pt_fd != -1);
|
||||
ret = ioctl(cpu->pt_fd, KVM_VMX_PT_GET_TOPA_SIZE, (unsigned long)0x0);
|
||||
|
||||
if (ret == -1) {
|
||||
nyx_abort("ToPA allocation failure. Check kernel logs.\n");
|
||||
}
|
||||
|
||||
assert(ret % PAGE_SIZE == 0);
|
||||
cpu->pt_mmap = mmap((void *)PT_BUFFER_MMAP_ADDR, ret,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, cpu->pt_fd, 0);
|
||||
assert(cpu->pt_mmap != (void *)0xFFFFFFFFFFFFFFFF);
|
||||
|
Loading…
x
Reference in New Issue
Block a user