Skip to content

kvm: reject unknown flags in device and dirty-log ioctls

Iván Ezequiel Rodriguez kvm 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1kvm: reject unknown flags in device and dirty-log ioctlstools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/ioctl_flag_validation_test.c virt/kvm/kvm_main.c+114 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] kvm: reject unknown flags in device and dirty-log ioctls

Three generic KVM paths silently ignored flag bits that uapi or Documentation/virt/kvm/api.rst treat as reserved or zero-only:

- KVM_CREATE_DEVICE (only KVM_CREATE_DEVICE_TEST is defined)
- KVM_{SET,GET,HAS}_DEVICE_ATTR (kvm_device_attr.flags)
- KVM_ENABLE_CAP for KVM_CAP_DIRTY_LOG_RING{,_ACQ_REL} (cap->flags)

Reject with -EINVAL, matching dma-heap and other strict KVM ioctls. Adds ioctl_flag_validation_test to tools/testing/selftests/kvm.

Tested: ioctl_flag_validation_test fails on the host kernel without this patch (KVM_CREATE_DEVICE accepts flags=0x2); requires reloading the patched kvm module to pass.

Iván Ezequiel Rodriguez (1):
kvm: reject unknown flags in device and dirty-log ioctls

 tools/testing/selftests/kvm/Makefile.kvm           |   1 +
 .../selftests/kvm/ioctl_flag_validation_test.c     | 104 +++++++++++++++++++++
 virt/kvm/kvm_main.c                                |   9 ++
 3 files changed, 114 insertions(+)
Signature · 1 line
2.43.0