[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/x86: irq: Avoid a TOCTOU race in pirq_spin_lock_irq_desc()


  • To: Julien Grall <julien@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 18 Aug 2020 10:36:29 +0200
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>
  • Delivery-date: Tue, 18 Aug 2020 08:36:41 +0000
  • Ironport-sdr: SNAk1/gmMEVLxcqnLwNTWkAQjAu2086RryKL1HcF/zko64L1O8UD5k7KrBeGgfAr0iDGjyoYfq ZUgORpOtqgDT7DctkLE3K+kjzAhbbgSpPwZ3bu/xTWtI6PtImwcgooNd3zZJ6o4u4ePlpj4DE+ unAcs/aYJfLRFmkBqkGXQojGXodjeNzp3lMIQPZxXhGg9lKqJvXu4ya87xdG4mJ8UKSC47S3sd Lz/LSkTtIqKtLJxCHaQCQJiCwHuspclyIHUuMMEm0KW6aIE9xXDdL2+FnFLlk+0l7gEsudQgCr XuI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Jul 22, 2020 at 05:53:00PM +0100, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Even if we assigned pirq->arch.irq to a variable, a compile is still
> allowed to read pirq->arch.irq multiple time. This means that the value
> checked may be different from the value used to get the desc.
> 
> Force the compiler to only do one read access by using read_atomic().
> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

The whole discussion about renaming {write/read}_atomic is orthogonal
to this patch IMO.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.