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
206 run->mmio.is_write = is_write;206 run->mmio.is_write = is_write;
207 run->mmio.phys_addr = fault_ipa;207 run->mmio.phys_addr = fault_ipa;
208 run->mmio.len = len;208 run->mmio.len = len;
209 memcpy(run->mmio.data, data_buf, len);209 if (is_write)
210 memcpy(run->mmio.data, data_buf, len);
210 211
211 if (!ret) {212 if (!ret) {
212 /* We handled the access successfully in the kernel. */213 /* 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
147 max_lr_idx = vtr_to_max_lr_idx(val);147 max_lr_idx = vtr_to_max_lr_idx(val);
148 nr_pri_bits = vtr_to_nr_pri_bits(val);148 nr_pri_bits = vtr_to_nr_pri_bits(val);
149 149
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
160 switch (nr_pri_bits) {150 switch (nr_pri_bits) {
161 case 7:151 case 7:
162 write_gicreg(cpu_if->vgic_ap0r[3], ICH_AP0R3_EL2);152 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
167 write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2);157 write_gicreg(cpu_if->vgic_ap0r[0], ICH_AP0R0_EL2);
168 }158 }
169 159
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
170 switch (max_lr_idx) {170 switch (max_lr_idx) {
171 case 15:171 case 15:
172 write_gicreg(cpu_if->vgic_lr[VGIC_V3_LR_INDEX(15)], ICH_LR15_EL2);172 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
650 u16 sel;650 u16 sel;
651 651
652 la = seg_base(ctxt, addr.seg) + addr.ea;652 la = seg_base(ctxt, addr.seg) + addr.ea;
653 *linear = la;
654 *max_size = 0;653 *max_size = 0;
655 switch (mode) {654 switch (mode) {
656 case X86EMUL_MODE_PROT64:655 case X86EMUL_MODE_PROT64:
656 *linear = la;
657 if (is_noncanonical_address(la))657 if (is_noncanonical_address(la))
658 goto bad;658 goto bad;
659 659
@@ -662,6 +662,7 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, · 2 unmodified lines
662 goto bad;662 goto bad;
663 break;663 break;
664 default:664 default:
665 *linear = la = (u32)la;
665 usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL,666 usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL,
666 addr.seg);667 addr.seg);
667 if (!usable)668 if (!usable)
@@ -689,7 +690,6 @@ static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, · 21 unmodified lines
689 if (size > *max_size)690 if (size > *max_size)
690 goto bad;691 goto bad;
691 }692 }
692 la &= (u32)-1;
693 break;693 break;
694 }694 }
695 if (insn_aligned(ctxt, size) && ((la & (size - 1)) != 0))695 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
249 return ret;249 return ret;
250 250
251 kvm_vcpu_mark_page_dirty(vcpu, table_gfn);251 kvm_vcpu_mark_page_dirty(vcpu, table_gfn);
252 walker->ptes[level] = pte;252 walker->ptes[level - 1] = pte;
253 }253 }
254 return 0;254 return 0;
255}255}
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
2752 }2752 }
2753 2753
2754 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);2754 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
2755 vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD;
2755}2756}
2756 2757
2757void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)2758void 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
1875static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs)1875static int vgic_vcpu_init_maps(struct kvm_vcpu *vcpu, int nr_irqs)
1876{1876{
1877 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;1877 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1878 1878 int nr_longs = BITS_TO_LONGS(nr_irqs - VGIC_NR_PRIVATE_IRQS);
1879 int sz = (nr_irqs - VGIC_NR_PRIVATE_IRQS) / 8;1879 int sz = nr_longs * sizeof(unsigned long);
1880 vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL);1880 vgic_cpu->pending_shared = kzalloc(sz, GFP_KERNEL);
1881 vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL);1881 vgic_cpu->active_shared = kzalloc(sz, GFP_KERNEL);
1882 vgic_cpu->pend_act_shared = kzalloc(sz, GFP_KERNEL);1882 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
172 * do alloc nowait since if we are going to sleep anyway we172 * do alloc nowait since if we are going to sleep anyway we
173 * may as well sleep faulting in page173 * may as well sleep faulting in page
174 */174 */
175 work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT);175 work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT | __GFP_NOWARN);
176 if (!work)176 if (!work)
177 return 0;177 return 0;
178 178