xen/arm: bitops: Implement a new set of helpers that can timeout
authorJulien Grall <julien.grall@arm.com>
Mon, 29 Apr 2019 14:05:23 +0000 (15:05 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 14 Jun 2019 13:27:32 +0000 (14:27 +0100)
commit62d10134fb0611bf9d09c6a09877db013e500ea9
tree3c7c64131924fa9cd5d19b384e2997a3c8beb5a7
parent2d2ccf4355a182232b2c60a3bca4c15210e8b4b6
xen/arm: bitops: Implement a new set of helpers that can timeout

Exclusive load-store atomics should only be used between trusted
threads. As not all the guests are trusted, it may be possible to DoS
Xen when updating shared memory with guest atomically.

To prevent the infinite loop, we introduce a new set of helpers that can
timeout. The timeout is based on the maximum number of iterations.

They will be used in follow-up patch to make atomic operations
on shared memory safe.

This is part of XSA-295.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/arm32/lib/bitops.c
xen/arch/arm/arm64/lib/bitops.c
xen/include/asm-arm/bitops.h