ARM: fix set_tls for !CONFIG_KUSER_HELPERS
PATCH 1/1 ARM: fix set_tls for !CONFIG_KUSER_HELPERS
Joachim Eastwood reports that commit fbfb872f5f41 "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 #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 #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.
--- arch/arm/include/asm/tls.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/include/asm/tls.h +2 -0
@@ -81,6 +81,7 @@ static inline void set_tls(unsigned long val) asm("mcr p15, 0, %0, c13, c0, 3" : :"r" (val)); }else { +#ifdef CONFIG_KUSER_HELPERS /* * User space must never try to access this * directly. Expect your app to break
@@ -89,6 +90,7 @@ static inline void set_tls(unsigned long val)* entry-armv.S for details) */ *((unsigned int *)0xffff0ff0 ) = val; +#endif } }
Signature · 1 line
1.9.3
PATCH 1/1 ARM: fix set_tls for !CONFIG_KUSER_HELPERS
Quoted 23 lines · Nathan Lynch
Joachim Eastwood reports that commit
fbfb872f5f41"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 =fffffff1CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #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: 4100000bsp :
29833d60ip : 00000000 fp : 00000001
r10:00003cf8r9 :29b1f000r8 : 00000000
r7 :29b0bc00r6 : 29834000 r5 : 29832000 r4 : 29832000 r3 :ffff0ff0r2 : 29832000 r1 : 00000000 r0 :282121f0
xPSR:4100000bCPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #191 [<2800afa5>] (unwind_backtrace) from [<2800a327>] (show_stack+0xb/0xc) [<2800a327>] (show_stack) from [<2800a963>] (__invalid_entry+0x4b/0x4c)The problem is that
set_tlsis attempting to clear the TLS location in the kernel-user helper page, which isn't set up on V7M.
Quoted 8 lines
Fix this by guarding the write to the kuser helper page with a
CONFIG_KUSER_HELPERSifdef.Reported-by Joachim Eastwood <[email protected]>Fixes fbfb872f5f41 ARM: 8148/1: flush TLS and thumbee register state during execCc stable at vger.kernel.orgSigned-off-by Nathan Lynch <[email protected]>---
Works for me.
Thanks!
regards,
Joachim Eastwood
PATCH 1/1 ARM: fix set_tls for !CONFIG_KUSER_HELPERS
Quoted 33 lines · Joachim Eastwood
Quoted 23 lines · Nathan Lynch
Joachim Eastwood reports that commit
fbfb872f5f41"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 =fffffff1CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #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: 4100000bsp :
29833d60ip : 00000000 fp : 00000001
r10:00003cf8r9 :29b1f000r8 : 00000000
r7 :29b0bc00r6 : 29834000 r5 : 29832000 r4 : 29832000 r3 :ffff0ff0r2 : 29832000 r1 : 00000000 r0 :282121f0
xPSR:4100000bCPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #191 [<2800afa5>] (unwind_backtrace) from [<2800a327>] (show_stack+0xb/0xc) [<2800a327>] (show_stack) from [<2800a963>] (__invalid_entry+0x4b/0x4c)The problem is that
set_tlsis attempting to clear the TLS location in the kernel-user helper page, which isn't set up on V7M.Quoted 8 lines
Fix this by guarding the write to the kuser helper page with a
CONFIG_KUSER_HELPERSifdef.Reported-by Joachim Eastwood <[email protected]>Fixes fbfb872f5f41 ARM: 8148/1: flush TLS and thumbee register state during execCc stable at vger.kernel.orgSigned-off-by Nathan Lynch <[email protected]>---
Quoted 3 lines
Works for me.
Tested-by Joachim Eastwood <[email protected]>
Out of interest, which M4 board are you using to run Linux? Are they generally available?
Will
PATCH 1/1 ARM: fix set_tls for !CONFIG_KUSER_HELPERS
Quoted 34 lines · Will Deacon
Quoted 33 lines · Joachim Eastwood
Quoted 31 lines · Nathan Lynch
Joachim Eastwood reports that commit
fbfb872f5f41"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 =fffffff1CPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #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: 4100000bsp :
29833d60ip : 00000000 fp : 00000001
r10:00003cf8r9 :29b1f000r8 : 00000000
r7 :29b0bc00r6 : 29834000 r5 : 29832000 r4 : 29832000 r3 :ffff0ff0r2 : 29832000 r1 : 00000000 r0 :282121f0
xPSR:4100000bCPU: 0 PID: 1 Comm: swapper Not tainted 3.17.0-rc6-00313-gd2205fa30aa7 #191 [<2800afa5>] (unwind_backtrace) from [<2800a327>] (show_stack+0xb/0xc) [<2800a327>] (show_stack) from [<2800a963>] (__invalid_entry+0x4b/0x4c)The problem is that
set_tlsis 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_HELPERSifdef.Reported-by Joachim Eastwood <[email protected]>Fixes fbfb872f5f41 ARM: 8148/1: flush TLS and thumbee register state during execCc stable at vger.kernel.orgSigned-off-by Nathan Lynch <[email protected]>---
Quoted 5 lines
Quoted 3 lines
Works for me.
Tested-by Joachim Eastwood <[email protected]>Out of interest, which M4 board are you using to run Linux?
I am using Embedded Artists' LPC4357 Developer's Kit.
http://www.embeddedartists.com/products/kits/lpc4357_kit.php
Quoted 1 line
Are they generally available?
They have a webshop so you should be able to buy one. Seems to be out of stock now, though.
I have a github repo with all my code for LPC4357 here:
https://github.com/manabian/linux-lpc
regards
Joachim Eastwood