Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:
"s390:
- vsie: Fix races with partial gmap invalidations

x86:
- Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: s390: vsie: Fix races with partial gmap invalidations
KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs

+21 -15
+5 -4
arch/s390/kvm/gaccess.c
··· 1449 1449 pgste_set_unlock(ptep_h, pgste); 1450 1450 if (rc) 1451 1451 return rc; 1452 - if (!sg->parent) 1452 + if (sg->invalidated) 1453 1453 return -EAGAIN; 1454 1454 1455 1455 newpte = _pte(f->pfn, 0, !p, 0); ··· 1479 1479 1480 1480 do { 1481 1481 /* _gmap_crstep_xchg_atomic() could have unshadowed this shadow gmap */ 1482 - if (!sg->parent) 1482 + if (sg->invalidated) 1483 1483 return -EAGAIN; 1484 1484 oldcrste = READ_ONCE(*host); 1485 1485 newcrste = _crste_fc1(f->pfn, oldcrste.h.tt, f->writable, !p); ··· 1492 1492 if (!newcrste.h.p && !f->writable) 1493 1493 return -EOPNOTSUPP; 1494 1494 } while (!_gmap_crstep_xchg_atomic(sg->parent, host, oldcrste, newcrste, f->gfn, false)); 1495 - if (!sg->parent) 1495 + if (sg->invalidated) 1496 1496 return -EAGAIN; 1497 1497 1498 1498 newcrste = _crste_fc1(f->pfn, oldcrste.h.tt, 0, !p); ··· 1545 1545 entries[i].pfn, i + 1, entries[i].writable); 1546 1546 if (rc) 1547 1547 return rc; 1548 - if (!sg->parent) 1548 + if (sg->invalidated) 1549 1549 return -EAGAIN; 1550 1550 } 1551 1551 ··· 1601 1601 scoped_guard(spinlock, &parent->children_lock) { 1602 1602 if (READ_ONCE(sg->parent) != parent) 1603 1603 return -EAGAIN; 1604 + sg->invalidated = false; 1604 1605 rc = _gaccess_do_shadow(vcpu->arch.mc, sg, saddr, walk); 1605 1606 } 1606 1607 if (rc == -ENOMEM)
+3
arch/s390/kvm/gmap.c
··· 181 181 182 182 list_del(&child->list); 183 183 child->parent = NULL; 184 + child->invalidated = true; 184 185 } 185 186 186 187 /** ··· 1070 1069 if (level > TABLE_TYPE_PAGE_TABLE) 1071 1070 align = 1UL << (11 * level + _SEGMENT_SHIFT); 1072 1071 kvm_s390_vsie_gmap_notifier(sg, ALIGN_DOWN(gaddr, align), ALIGN(gaddr + 1, align)); 1072 + sg->invalidated = true; 1073 1073 if (dat_entry_walk(NULL, r_gfn, sg->asce, 0, level, &crstep, &ptep)) 1074 1074 return; 1075 1075 if (ptep) { ··· 1176 1174 scoped_guard(spinlock, &parent->children_lock) { 1177 1175 if (READ_ONCE(sg->parent) != parent) 1178 1176 return -EAGAIN; 1177 + sg->invalidated = false; 1179 1178 for (i = 0; i < CRST_TABLE_PAGES; i++) { 1180 1179 if (!context->f[i].valid) 1181 1180 continue;
+1
arch/s390/kvm/gmap.h
··· 60 60 struct gmap { 61 61 unsigned long flags; 62 62 unsigned char edat_level; 63 + bool invalidated; 63 64 struct kvm *kvm; 64 65 union asce asce; 65 66 struct list_head list;
+6 -6
arch/x86/include/uapi/asm/kvm.h
··· 197 197 __u32 nmsrs; /* number of msrs in entries */ 198 198 __u32 pad; 199 199 200 - struct kvm_msr_entry entries[]; 200 + __DECLARE_FLEX_ARRAY(struct kvm_msr_entry, entries); 201 201 }; 202 202 203 203 /* for KVM_GET_MSR_INDEX_LIST */ 204 204 struct kvm_msr_list { 205 205 __u32 nmsrs; /* number of msrs in entries */ 206 - __u32 indices[]; 206 + __DECLARE_FLEX_ARRAY(__u32, indices); 207 207 }; 208 208 209 209 /* Maximum size of any access bitmap in bytes */ ··· 245 245 struct kvm_cpuid { 246 246 __u32 nent; 247 247 __u32 padding; 248 - struct kvm_cpuid_entry entries[]; 248 + __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry, entries); 249 249 }; 250 250 251 251 struct kvm_cpuid_entry2 { ··· 267 267 struct kvm_cpuid2 { 268 268 __u32 nent; 269 269 __u32 padding; 270 - struct kvm_cpuid_entry2 entries[]; 270 + __DECLARE_FLEX_ARRAY(struct kvm_cpuid_entry2, entries); 271 271 }; 272 272 273 273 /* for KVM_GET_PIT and KVM_SET_PIT */ ··· 398 398 * the contents of CPUID leaf 0xD on the host. 399 399 */ 400 400 __u32 region[1024]; 401 - __u32 extra[]; 401 + __DECLARE_FLEX_ARRAY(__u32, extra); 402 402 }; 403 403 404 404 #define KVM_MAX_XCRS 16 ··· 566 566 __u32 fixed_counter_bitmap; 567 567 __u32 flags; 568 568 __u32 pad[4]; 569 - __u64 events[]; 569 + __DECLARE_FLEX_ARRAY(__u64, events); 570 570 }; 571 571 572 572 #define KVM_PMU_EVENT_ALLOW 0
+6 -5
include/uapi/linux/kvm.h
··· 11 11 #include <linux/const.h> 12 12 #include <linux/types.h> 13 13 #include <linux/compiler.h> 14 + #include <linux/stddef.h> 14 15 #include <linux/ioctl.h> 15 16 #include <asm/kvm.h> 16 17 ··· 543 542 544 543 struct kvm_coalesced_mmio_ring { 545 544 __u32 first, last; 546 - struct kvm_coalesced_mmio coalesced_mmio[]; 545 + __DECLARE_FLEX_ARRAY(struct kvm_coalesced_mmio, coalesced_mmio); 547 546 }; 548 547 549 548 #define KVM_COALESCED_MMIO_MAX \ ··· 593 592 /* for KVM_SET_SIGNAL_MASK */ 594 593 struct kvm_signal_mask { 595 594 __u32 len; 596 - __u8 sigset[]; 595 + __DECLARE_FLEX_ARRAY(__u8, sigset); 597 596 }; 598 597 599 598 /* for KVM_TPR_ACCESS_REPORTING */ ··· 1052 1051 struct kvm_irq_routing { 1053 1052 __u32 nr; 1054 1053 __u32 flags; 1055 - struct kvm_irq_routing_entry entries[]; 1054 + __DECLARE_FLEX_ARRAY(struct kvm_irq_routing_entry, entries); 1056 1055 }; 1057 1056 1058 1057 #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) ··· 1143 1142 1144 1143 struct kvm_reg_list { 1145 1144 __u64 n; /* number of regs */ 1146 - __u64 reg[]; 1145 + __DECLARE_FLEX_ARRAY(__u64, reg); 1147 1146 }; 1148 1147 1149 1148 struct kvm_one_reg { ··· 1609 1608 #ifdef __KERNEL__ 1610 1609 char name[KVM_STATS_NAME_SIZE]; 1611 1610 #else 1612 - char name[]; 1611 + __DECLARE_FLEX_ARRAY(char, name); 1613 1612 #endif 1614 1613 }; 1615 1614