Skip to content

Commit eebadaf

Browse files
geertuRussell King (Oracle)
authored andcommitted
ARM: 9398/1: Fix userspace enter on LPAE with CC_OPTIMIZE_FOR_SIZE=y
Booting an LPAE-enabled kernel built with CONFIG_CC_OPTIMIZE_FOR_SIZE=y fails when starting userspace: Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 CPU: 1 PID: 1 Comm: init Tainted: G W N 6.9.0-rc1-koelsch-00004-g7af5b901e847 #1930 Hardware name: Generic R-Car Gen2 (Flattened Device Tree) Call trace: unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x78/0xa8 dump_stack_lvl from panic+0x118/0x398 panic from do_exit+0x1ec/0x938 do_exit from sys_exit_group+0x0/0x10 ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004 ]--- Add the missing memory clobber to cpu_set_ttbcr(), as suggested by Russell King. Force inlining of uaccess_save_and_enable(), as suggested by Ard Biesheuvel. The latter fixes booting on Koelsch. Closes: https://lore.kernel.org/r/CAMuHMdWTAJcZ9BReWNhpmsgkOzQxLNb5OhNYxzxv6D5TSh2fwQ@mail.gmail.com/ Fixes: 7af5b90 ("ARM: 9358/2: Implement PAN for LPAE by TTBR0 page table walks disablement") Acked-by: Ard Biesheuvel <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Tested-by: Florian Fainelli <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent a9a0580 commit eebadaf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/arm/include/asm/proc-fns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static inline unsigned int cpu_get_ttbcr(void)
187187

188188
static inline void cpu_set_ttbcr(unsigned int ttbcr)
189189
{
190-
asm("mcr p15, 0, %0, c2, c0, 2" : : "r" (ttbcr));
190+
asm volatile("mcr p15, 0, %0, c2, c0, 2" : : "r" (ttbcr) : "memory");
191191
}
192192

193193
#else /*!CONFIG_MMU */

arch/arm/include/asm/uaccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static __always_inline void uaccess_restore(unsigned int flags)
4747

4848
#elif defined(CONFIG_CPU_TTBR0_PAN)
4949

50-
static inline unsigned int uaccess_save_and_enable(void)
50+
static __always_inline unsigned int uaccess_save_and_enable(void)
5151
{
5252
unsigned int old_ttbcr = cpu_get_ttbcr();
5353

0 commit comments

Comments
 (0)