diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-05-14 11:26:37 +0100 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2021-06-30 08:48:28 -0400 |
commit | 188afa5647dd8d260af962df3c816f399688f59d (patch) | |
tree | 381c9089ad799eb2c2132fae50bf48c39004ce10 /Makefile | |
parent | 72b03fbba6d55d41be82d5717449961ff5903835 (diff) | |
download | linux-stable-188afa5647dd8d260af962df3c816f399688f59d.tar.gz linux-stable-188afa5647dd8d260af962df3c816f399688f59d.tar.bz2 linux-stable-188afa5647dd8d260af962df3c816f399688f59d.zip |
ARM: 9081/1: fix gcc-10 thumb2-kernel regression
commit dad7b9896a5dbac5da8275d5a6147c65c81fb5f2 upstream.
When building the kernel wtih gcc-10 or higher using the
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y flag, the compiler picks a slightly
different set of registers for the inline assembly in cpu_init() that
subsequently results in a corrupt kernel stack as well as remaining in
FIQ mode. If a banked register is used for the last argument, the wrong
version of that register gets loaded into CPSR_c. When building in Arm
mode, the arguments are passed as immediate values and the bug cannot
happen.
This got introduced when Daniel reworked the FIQ handling and was
technically always broken, but happened to work with both clang and gcc
before gcc-10 as long as they picked one of the lower registers.
This is probably an indication that still very few people build the
kernel in Thumb2 mode.
Marek pointed out the problem on IRC, Arnd narrowed it down to this
inline assembly and Russell pinpointed the exact bug.
Change the constraints to force the final mode switch to use a non-banked
register for the argument to ensure that the correct constant gets loaded.
Another alternative would be to always use registers for the constant
arguments to avoid the #ifdef that has now become more complex.
Cc: <stable@vger.kernel.org> # v3.18+
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Reported-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Fixes: c0e7f7ee717e ("ARM: 8150/3: fiq: Replace default FIQ handler")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions