|
@@ -394,7 +394,10 @@ pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -
|
|
params.pci_sub_system_id = (orig_sub_system_id & 0xffff) | (spoofed_subsysid << 16);
|
|
params.pci_sub_system_id = (orig_sub_system_id & 0xffff) | (spoofed_subsysid << 16);
|
|
}
|
|
}
|
|
NV0080_CTRL_CMD_GPU_GET_VIRTUALIZATION_MODE
|
|
NV0080_CTRL_CMD_GPU_GET_VIRTUALIZATION_MODE
|
|
- if check_size!(
|
|
|
|
|
|
+ // 18.0 driver sends larger struct with size 8 bytes. Only extra members added at the end,
|
|
|
|
+ // nothing in between or changed, so accessing the larger struct is "safe"
|
|
|
|
+ if io_data.params_size == 8
|
|
|
|
+ || check_size!(
|
|
NV0080_CTRL_CMD_GPU_GET_VIRTUALIZATION_MODE,
|
|
NV0080_CTRL_CMD_GPU_GET_VIRTUALIZATION_MODE,
|
|
Nv0080CtrlGpuGetVirtualizationModeParams
|
|
Nv0080CtrlGpuGetVirtualizationModeParams
|
|
) && CONFIG.unlock =>
|
|
) && CONFIG.unlock =>
|
|
@@ -432,10 +435,13 @@ pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -
|
|
*LAST_MDEV_UUID.lock() = Some(config.mdev_uuid);
|
|
*LAST_MDEV_UUID.lock() = Some(config.mdev_uuid);
|
|
}
|
|
}
|
|
NV0000_CTRL_CMD_VGPU_CREATE_DEVICE
|
|
NV0000_CTRL_CMD_VGPU_CREATE_DEVICE
|
|
- if check_size!(
|
|
|
|
- NV0000_CTRL_CMD_VGPU_CREATE_DEVICE,
|
|
|
|
- Nv0000CtrlVgpuCreateDeviceParams
|
|
|
|
- ) =>
|
|
|
|
|
|
+ // 18.0 driver sends larger struct with size 40 bytes. Only extra members added at the end,
|
|
|
|
+ // nothing in between or changed, so accessing the larger struct is "safe"
|
|
|
|
+ if io_data.params_size == 40
|
|
|
|
+ || check_size!(
|
|
|
|
+ NV0000_CTRL_CMD_VGPU_CREATE_DEVICE,
|
|
|
|
+ Nv0000CtrlVgpuCreateDeviceParams
|
|
|
|
+ ) =>
|
|
{
|
|
{
|
|
// 17.0 driver provides mdev uuid as vgpu_name in this command
|
|
// 17.0 driver provides mdev uuid as vgpu_name in this command
|
|
let params: &mut Nv0000CtrlVgpuCreateDeviceParams = &mut *io_data.params.cast();
|
|
let params: &mut Nv0000CtrlVgpuCreateDeviceParams = &mut *io_data.params.cast();
|