Skip to content

Commit 1f2bb4a

Browse files
committed
arm/arm64: KVM: Fix unaligned access bug on gicv2 access
We were using an atomic bitop on the vgic_v2.vgic_elrsr field which was not aligned to the natural size on 64-bit platforms. This bug showed up after QEMU correctly identifies the pl011 line as being level-triggered, and not edge-triggered. These data structures are protected by a spinlock so simply use a non-atomic version of the accessor instead. Tested-by: Joel Schopp <joel.schopp@amd.com> Reported-by: Riku Voipio <riku.voipio@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
1 parent 05e0127 commit 1f2bb4a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎virt/kvm/arm/vgic-v2.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void vgic_v2_sync_lr_elrsr(struct kvm_vcpu *vcpu, int lr,
7171
struct vgic_lr lr_desc)
7272
{
7373
if (!(lr_desc.state & LR_STATE_MASK))
74-
set_bit(lr, (unsigned long *)vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr);
74+
__set_bit(lr, (unsigned long *)vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr);
7575
}
7676

7777
static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)