OSDN Git Service

arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y
authorWill Deacon <will@kernel.org>
Tue, 30 Jun 2020 13:02:48 +0000 (14:02 +0100)
committerWill Deacon <will@kernel.org>
Mon, 9 Nov 2020 21:49:34 +0000 (21:49 +0000)
commite35123d83ee35c31f64ecfbdfabbe5142d3025b8
tree42cd6bf50f912bbeb4ba2cf8bbe32d98d89ba2c5
parent5af76fb4228701bd5377880b09b0216a5fd800ef
arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y

When building with LTO, there is an increased risk of the compiler
converting an address dependency headed by a READ_ONCE() invocation
into a control dependency and consequently allowing for harmful
reordering by the CPU.

Ensure that such transformations are harmless by overriding the generic
READ_ONCE() definition with one that provides acquire semantics when
building with LTO.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/rwonce.h [new file with mode: 0644]
arch/arm64/kernel/vdso/Makefile
arch/arm64/kernel/vdso32/Makefile
arch/arm64/kernel/vmlinux.lds.S