xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] xen/arm: fix rank/vgic lock inversion bug
@ 2016-12-22  2:14 Stefano Stabellini
  2016-12-22  2:15 ` [PATCH v2 1/4] xen/arm: fix GIC_INVALID_LR Stefano Stabellini
  0 siblings, 1 reply; 16+ messages in thread
From: Stefano Stabellini @ 2016-12-22  2:14 UTC (permalink / raw)
  To: julien.grall; +Cc: xen-devel, sstabellini

Hi all,

this patch series fixes a lock inversion bug in Xen on ARM. The locking
order is: first rank lock, then vgic lock. The order is respected
everywhere, except for gic_update_one_lr.

gic_update_one_lr is called with the vgic lock held, but it calls
vgic_get_target_vcpu, which tries to obtain the rank lock. This can
cause deadlocks.

The series fixes the issue by avoiding the rank lock in
gic_update_one_lr. It makes it safe by ensuring that the right vgic lock
is always taken by vgic_migrate_irq.

The first patch is just a fix to a bug I discovered while testing this
series.


Stefano Stabellini (4):
      xen/arm: fix GIC_INVALID_LR
      arm: store vcpu id in struct irq_pending
      arm,vgic_migrate_irq: take the right vgic lock
      The locking order is: first rank lock, then vgic lock. The order is     respected everywhere, except for gic_update_one_lr.

 xen/arch/arm/gic.c         | 14 ++++++++++--
 xen/arch/arm/vgic-v2.c     | 12 +++-------
 xen/arch/arm/vgic-v3.c     |  6 +----
 xen/arch/arm/vgic.c        | 56 +++++++++++++++++++++++++++++++++++++---------
 xen/include/asm-arm/vgic.h |  8 +++++--
 5 files changed, 68 insertions(+), 28 deletions(-)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-01-19 12:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-22  2:14 [PATCH v2 0/4] xen/arm: fix rank/vgic lock inversion bug Stefano Stabellini
2016-12-22  2:15 ` [PATCH v2 1/4] xen/arm: fix GIC_INVALID_LR Stefano Stabellini
2016-12-22  2:15   ` [PATCH v2 2/4] arm: store vcpu id in struct irq_pending Stefano Stabellini
2016-12-22 11:52     ` Andrew Cooper
2016-12-22  2:15   ` [PATCH v2 3/4] arm, vgic_migrate_irq: take the right vgic lock Stefano Stabellini
2016-12-28 16:42     ` Julien Grall
2017-01-03 23:30       ` Stefano Stabellini
2017-01-16 16:31         ` Julien Grall
2016-12-22  2:15   ` [PATCH v2 4/4] The locking order is: first rank lock, then vgic lock. The order is respected everywhere, except for gic_update_one_lr Stefano Stabellini
2016-12-28 16:55     ` Julien Grall
2017-01-03 22:51       ` Stefano Stabellini
2017-01-16 16:55         ` Julien Grall
2017-01-16 19:10           ` Stefano Stabellini
2017-01-19 12:51             ` Julien Grall
2016-12-28 17:30   ` [PATCH v2 1/4] xen/arm: fix GIC_INVALID_LR Julien Grall
2017-01-03 22:52     ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).