Skip to content

Commit 3a4e1d1

Browse files
nlynch-mentorgregkh
authored andcommitted
ARM: 8178/1: fix set_tls for !CONFIG_KUSER_HELPERS
commit 9cc6d9e upstream. Joachim Eastwood reports that commit fbfb872 "ARM: 8148/1: flush TLS and thumbee register state during exec" causes a boot-time crash on a Cortex-M4 nommu system: Freeing unused kernel memory: 68K (281e5000 - 281f6000) Unhandled exception: IPSR = 00000005 LR = fffffff1 CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 torvalds#191 task: 29834000 ti: 29832000 task.ti: 29832000 PC is at flush_thread+0x2e/0x40 LR is at flush_thread+0x21/0x40 pc : [<2800954a>] lr : [<2800953d>] psr: 4100000b sp : 29833d60 ip : 00000000 fp : 00000001 r10: 00003cf8 r9 : 29b1f000 r8 : 00000000 r7 : 29b0bc00 r6 : 29834000 r5 : 29832000 r4 : 29832000 r3 : ffff0ff0 r2 : 29832000 r1 : 00000000 r0 : 282121f0 xPSR: 4100000b CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 torvalds#191 [<2800afa5>] (unwind_backtrace) from [<2800a327>] (show_stack+0xb/0xc) [<2800a327>] (show_stack) from [<2800a963>] (__invalid_entry+0x4b/0x4c) The problem is that set_tls is attempting to clear the TLS location in the kernel-user helper page, which isn't set up on V7M. Fix this by guarding the write to the kuser helper page with a CONFIG_KUSER_HELPERS ifdef. Fixes: fbfb872 ARM: 8148/1: flush TLS and thumbee register state during exec Reported-by: Joachim Eastwood <[email protected]> Tested-by: Joachim Eastwood <[email protected]> Signed-off-by: Nathan Lynch <[email protected]> Signed-off-by: Russell King <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e5b83a0 commit 3a4e1d1

File tree

1 file changed

+2
-0
lines changed
  • arch/arm/include/asm

1 file changed

+2
-0
lines changed

arch/arm/include/asm/tls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static inline void set_tls(unsigned long val)
8181
asm("mcr p15, 0, %0, c13, c0, 3"
8282
: : "r" (val));
8383
} else {
84+
#ifdef CONFIG_KUSER_HELPERS
8485
/*
8586
* User space must never try to access this
8687
* directly. Expect your app to break
@@ -89,6 +90,7 @@ static inline void set_tls(unsigned long val)
8990
* entry-armv.S for details)
9091
*/
9192
*((unsigned int *)0xffff0ff0) = val;
93+
#endif
9294
}
9395

9496
}

0 commit comments

Comments
 (0)