gcc/libgcc/config/arm
Richard Earnshaw ebdb6f2377 PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs
The AArch32 instruction sets prior to Armv7 do not define the ISB and
DSB instructions that are needed to form a speculation barrier.  While
I do not know of any instances of cores based on those instruction
sets being vulnerable to speculative side channel attacks it is
possible to run code built for those ISAs on more recent hardware
where they would become vulnerable.

This patch works around this by using a library call added to libgcc.
That code can then take any platform-specific actions necessary to
ensure safety.

For the moment I've only handled two cases: the library code being
built for armv7 or later anyway and running on Linux.

On Linux we can handle this by calling the kernel function that will
flush a small amount of cache.  Such a sequence ends with a ISB+DSB
sequence if running on an Armv7 or later CPU.

gcc:

	PR target/86951
	* config/arm/arm-protos.h (arm_emit_speculation_barrier): New
	prototype.
	* config/arm/arm.c (speculation_barrier_libfunc): New static
	variable.
	(arm_init_libfuncs): Initialize it.
	(arm_emit_speculation_barrier): New function.
	* config/arm/arm.md (speculation_barrier): Call
	arm_emit_speculation_barrier for architectures that do not have 
	DSB or ISB.
	(speculation_barrier_insn): Only match on Armv7 or later.

libgcc:

	PR target/86951
	* config/arm/lib1funcs.asm (speculation_barrier): New function.
	* config/arm/t-arm (LIB1ASMFUNCS): Add it to list of functions
	to build.

From-SVN: r263806
2018-08-23 09:47:34 +00:00
..
bpabi-lib.h Update copyright years. 2018-01-03 11:03:58 +01:00
bpabi-v6m.S Update copyright years. 2018-01-03 11:03:58 +01:00
bpabi.c Update copyright years. 2018-01-03 11:03:58 +01:00
bpabi.S Update copyright years. 2018-01-03 11:03:58 +01:00
cmse_nonsecure_call.S Update copyright years. 2018-01-03 11:03:58 +01:00
cmse.c arm_cmse.h (cmse_nsfptr_create, [...]): Remove #include <stdint.h>. 2018-05-17 16:36:36 +00:00
crtfastmath.c Update copyright years. 2018-01-03 11:03:58 +01:00
crti.S Update copyright years. 2018-01-03 11:03:58 +01:00
crtn.S Update copyright years. 2018-01-03 11:03:58 +01:00
fp16.c Update copyright years. 2018-01-03 11:03:58 +01:00
freebsd-atomic.c re PR libgcc/84292 (__sync_add_and_fetch returns the old value instead of the new value) 2018-04-27 21:14:05 +02:00
ieee754-df.S arm - correctly handle denormal results during softfp subtraction 2018-08-02 16:50:07 +00:00
ieee754-sf.S arm - correctly handle denormal results during softfp subtraction 2018-08-02 16:50:07 +00:00
lib1funcs.S PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs 2018-08-23 09:47:34 +00:00
libgcc-bpabi.ver Update copyright years. 2018-01-03 11:03:58 +01:00
libunwind.S [ARM] Use __ARM_ARCH and __ARM_FEATURE_LDREX instead of __ARM_ARCH__ 2018-06-21 13:05:36 +02:00
linux-atomic-64bit.c Update copyright years. 2018-01-03 11:03:58 +01:00
linux-atomic.c Update copyright years. 2018-01-03 11:03:58 +01:00
pr-support.c Update copyright years. 2018-01-03 11:03:58 +01:00
sfp-machine.h
symbian-lib.h Update copyright years. 2018-01-03 11:03:58 +01:00
t-arm PR target/86951 arm - Handle speculation barriers on pre-armv7 CPUs 2018-08-23 09:47:34 +00:00
t-bpabi
t-elf
t-freebsd
t-linux
t-linux-eabi
t-netbsd
t-softfp
t-strongarm-elf
t-symbian
t-vxworks7
t-wince-pe
unaligned-funcs.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-arm-vxworks.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-arm.c Update copyright years. 2018-01-03 11:03:58 +01:00
unwind-arm.h Update copyright years. 2018-01-03 11:03:58 +01:00