ARM: 9390/2: lib: Annotate loop delay instructions for CFI
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Apr 2024 07:50:38 +0000 (08:50 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 29 Apr 2024 13:14:21 +0000 (14:14 +0100)
commit7339fb11aea8387d1ceb260323a2c87faa48fdcd
treea8c7c58084ce572998e3ac2036a405c13ef1724e
parent393999fa96273bab8d6efb2f4724030916afd61b
ARM: 9390/2: lib: Annotate loop delay instructions for CFI

When we annotate the loop delay code with SYM_TYPED_FUNC_START()
a function prototype signature will be emitted into the object
file above each site called from C, and the delay loop code is
using "fallthroughs" from the different assembly callbacks. This
will not work as the execution flow will run into the prototype
signatures.

Rewrite the code to use explicit branches to the other code
segments and annotate the code using SYM_TYPED_FUNC_START().

Tested on the ARM Versatile which uses the calibrated loop delay.

Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/lib/delay-loop.S