aboutsummaryrefslogtreecommitdiff
path: root/tools/include/uapi/linux/kvm.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <[email protected]>2024-08-19 06:24:50 +0200
committerGreg Kroah-Hartman <[email protected]>2024-08-19 06:24:50 +0200
commitebbe30f4bba127505c5664dd67f519e5e06d16be (patch)
tree7285f44ba6e74a25876982cb50f9a430169cc42e /tools/include/uapi/linux/kvm.h
parent1241b384efa53f4b7a95fe2b34d69359bb3ae1b5 (diff)
parent47ac09b91befbb6a235ab620c32af719f8208399 (diff)
Merge 6.11-rc4 into tty-next
We need the tty/serial fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/include/uapi/linux/kvm.h')
-rw-r--r--tools/include/uapi/linux/kvm.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h
index e5af8c692dc0..637efc055145 100644
--- a/tools/include/uapi/linux/kvm.h
+++ b/tools/include/uapi/linux/kvm.h
@@ -192,11 +192,24 @@ struct kvm_xen_exit {
/* Flags that describe what fields in emulation_failure hold valid data. */
#define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES (1ULL << 0)
+/*
+ * struct kvm_run can be modified by userspace at any time, so KVM must be
+ * careful to avoid TOCTOU bugs. In order to protect KVM, HINT_UNSAFE_IN_KVM()
+ * renames fields in struct kvm_run from <symbol> to <symbol>__unsafe when
+ * compiled into the kernel, ensuring that any use within KVM is obvious and
+ * gets extra scrutiny.
+ */
+#ifdef __KERNEL__
+#define HINT_UNSAFE_IN_KVM(_symbol) _symbol##__unsafe
+#else
+#define HINT_UNSAFE_IN_KVM(_symbol) _symbol
+#endif
+
/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
struct kvm_run {
/* in */
__u8 request_interrupt_window;
- __u8 immediate_exit;
+ __u8 HINT_UNSAFE_IN_KVM(immediate_exit);
__u8 padding1[6];
/* out */
@@ -918,6 +931,8 @@ struct kvm_enable_cap {
#define KVM_CAP_GUEST_MEMFD 234
#define KVM_CAP_VM_TYPES 235
#define KVM_CAP_PRE_FAULT_MEMORY 236
+#define KVM_CAP_X86_APIC_BUS_CYCLES_NS 237
+#define KVM_CAP_X86_GUEST_MODE 238
struct kvm_irq_routing_irqchip {
__u32 irqchip;