History

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

Pull KVM fixes from Paolo Bonzini: "KVM/ARM fixes: - Fix per-vcpu vgic bitmap allocation - Do not give copy random memory on MMIO read - Fix GICv3 APR register restore order KVM/x86 fixes: - Fix ubsan warning - Fix hardware breakpoints in a guest vs. preempt notifiers - Fix Hurd Generic: - use __GFP_NOWARN together with GFP_NOWAIT" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: x86: MMU: fix ubsan index-out-of-range warning arm64: KVM: vgic-v3: Restore ICH_APR0Rn_EL2 before ICH_APR1Rn_EL2 KVM: async_pf: do not warn on page allocation failures KVM: x86: fix conversion of addresses to linear in 32-bit protected mode KVM: x86: fix missed hardware breakpoints arm/arm64: KVM: Feed initialized memory to MMIO accesses KVM: arm/arm64: vgic: Ensure bitmaps are long enough

Linus Torvalds committed 10 years ago

Commit 73056bb2 parents 5882c16 0fb00d37 files · +19 −17Browse files

Unified · Split

7 files
  1. arch/arm/kvm/mmio.c +2 −1
  2. arch/arm64/kvm/hyp/vgic-v3-sr.c +10 −10
  3. arch/x86/kvm/emulate.c +2 −2
  4. arch/x86/kvm/paging_tmpl.h +1 −1
  5. arch/x86/kvm/x86.c +1 −0
  6. virt/kvm/arm/vgic.c +2 −2
  7. virt/kvm/async_pf.c +1 −1
arch/arm/kvm/mmio.c+2−1
@@ -206,7 +206,8 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, · 205 unmodified lines
206206 run->mmio.is_write = is_write;
207207 run->mmio.phys_addr = fault_ipa;
208208 run->mmio.len = len;
209− memcpy(run->mmio.data, data_buf, len);
209+ if (is_write)
210+ memcpy(run->mmio.data, data_buf, len);
210211
211212 if (!ret) {
212213 /* We handled the access successfully in the kernel. */
arch/arm64/kvm/hyp/vgic-v3-sr.c+10−10
@@ -147,16 +147,6 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) · 146 unmodified lines
147147 max_lr_idx = vtr_to_max_lr_idx(val);
148148 nr_pri_bits = vtr_to_nr_pri_bits(val);
149149
150− switch (nr_pri_bits) {
151− case 7:
152− write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2);
153− write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2);
154− case 6:
155− write_gicreg(cpu_if->vgic_ap1r[1], ICH_AP1R1_EL2);
156− default:
157− write_gicreg(cpu_if->vgic_ap1r[0], ICH_AP1R0_EL2);
158− }
159−
160150 switch (nr_pri_bits) {
161151 case 7:
162152 write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2);
@@ -167,6 +157,16 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu) · 4 unmodified lines
167157 write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2);
168158 }
169159
160+ switch (nr_pri_bits) {
161+ case 7:
162+ write_gicreg(cpu_if->vgic_ap1r[3], ICH_AP1R3_EL2);
163+ write_gicreg(cpu_if->vgic_ap1r[2], ICH_AP1R2_EL2);
164+ case 6:
165+ write_gicreg(cpu_if->vgic_ap1r[1], ICH_AP1R1_EL2);
166+ default:
167+ write_gicreg(cpu_if->vgic_ap1r[0], ICH_AP1R0_EL2);
168+ }
169+
170170 switch (max_lr_idx) {
171171 case 15:
172172 write_gicreg(cpu_if->vgic_lr[VGIC_V3_LR_INDEX(15)], ICH_LR15_EL2);
arch/x86/kvm/emulate.c+2−2
@@ -650,10 +650,10 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, · 649 unmodified lines
650650 u16 sel;
651651
652652 la = seg_base(ctxt, addr.seg) + addr.ea;
653− *linear = la;
654653 *max_size = 0;
655654 switch (mode) {
656655 case X86EMUL_MODE_PROT64:
656+ *linear = la;
657657 if (is_noncanonical_address(la))
658658 goto bad;
659659
@@ -662,6 +662,7 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, · 2 unmodified lines
662662 goto bad;
663663 break;
664664 default:
665+ *linear = la = (u32)la;
665666 usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL,
666667 addr.seg);
667668 if (!usable)
@@ -689,7 +690,6 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, · 21 unmodified lines
689690 if (size > *max_size)
690691 goto bad;
691692 }
692− la &= (u32)-1;
693693 break;
694694 }
695695 if (insn_aligned(ctxt, size) && ((la & (size - 1)) != 0))
arch/x86/kvm/paging_tmpl.h+1−1
@@ -249,7 +249,7 @@ static int FNAME(update_accessed_dirty_bits)(struct kvm_vcpu *vcpu, · 248 unmodified lines
249249 return ret;
250250
251251 kvm_vcpu_mark_page_dirty(vcpu, table_gfn);
252− walker->ptes[level] = pte;
252+ walker->ptes[level - 1] = pte;
253253 }
254254 return 0;
255255 }
arch/x86/kvm/x86.c+1−0
@@ -2752,6 +2752,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 2751 unmodified lines
27522752 }
27532753
27542754 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
2755+ vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD;
27552756 }
27562757
27572758 void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
virt/kvm/arm/vgic.c+2−2
@@ -1875,8 +1875,8 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu) · 1874 unmodified lines
18751875 static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs)
18761876 {
18771877 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1878−
1879− int sz = (nr_irqs - VGIC_NR_PRIVATE_IRQS) / 8;
1878+ int nr_longs = BITS_TO_LONGS(nr_irqs - VGIC_NR_PRIVATE_IRQS);
1879+ int sz = nr_longs * sizeof(unsigned long);
18801880 vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL);
18811881 vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL);
18821882 vgic_cpu->pend_act_shared = kzalloc(sz, GFP_KERNEL);
virt/kvm/async_pf.c+1−1
@@ -172,7 +172,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva, · 171 unmodified lines
172172 * do alloc nowait since if we are going to sleep anyway we
173173 * may as well sleep faulting in page
174174 */
175− work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT);
175+ work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT | __GFP_NOWARN);
176176 if (!work)
177177 return 0;
178178