aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/entry-armv.S
diff options
context:
space:
mode:
authorAndré Hentschel <nerv@dawncrow.de>2013-06-18 18:23:26 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-06-24 10:21:59 -0400
commita4780adeefd042482f624f5e0d577bf9cdcbb760 (patch)
treeead0e79b4f797a26cc30fc1596ada6fd6da5daf6 /arch/arm/kernel/entry-armv.S
parent4a1b573346ee0d64d95beb78d49a5bbb574e6c6a (diff)
ARM: 7735/2: Preserve the user r/w register TPIDRURW on context switch and fork
Since commit 6a1c53124aa1 the user writeable TLS register was zeroed to prevent it from being used as a covert channel between two tasks. There are more and more applications coming to Windows RT, Wine could support them, but mostly they expect to have the thread environment block (TEB) in TPIDRURW. This patch preserves that register per thread instead of clearing it. Unlike the TPIDRURO, which is already switched, the TPIDRURW can be updated from userspace so needs careful treatment in the case that we modify TPIDRURW and call fork(). To avoid this we must always read TPIDRURW in copy_thread. Signed-off-by: André Hentschel <nerv@dawncrow.de> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Jonathan Austin <jonathan.austin@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/entry-armv.S')
-rw-r--r--arch/arm/kernel/entry-armv.S5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 582b405befc5..a39cfc2a1f90 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -685,15 +685,16 @@ ENTRY(__switch_to)
685 UNWIND(.fnstart ) 685 UNWIND(.fnstart )
686 UNWIND(.cantunwind ) 686 UNWIND(.cantunwind )
687 add ip, r1, #TI_CPU_SAVE 687 add ip, r1, #TI_CPU_SAVE
688 ldr r3, [r2, #TI_TP_VALUE]
689 ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack 688 ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
690 THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack 689 THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
691 THUMB( str sp, [ip], #4 ) 690 THUMB( str sp, [ip], #4 )
692 THUMB( str lr, [ip], #4 ) 691 THUMB( str lr, [ip], #4 )
692 ldr r4, [r2, #TI_TP_VALUE]
693 ldr r5, [r2, #TI_TP_VALUE + 4]
693#ifdef CONFIG_CPU_USE_DOMAINS 694#ifdef CONFIG_CPU_USE_DOMAINS
694 ldr r6, [r2, #TI_CPU_DOMAIN] 695 ldr r6, [r2, #TI_CPU_DOMAIN]
695#endif 696#endif
696 set_tls r3, r4, r5 697 switch_tls r1, r4, r5, r3, r7
697#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 698#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
698 ldr r7, [r2, #TI_TASK] 699 ldr r7, [r2, #TI_TASK]
699 ldr r8, =__stack_chk_guard 700 ldr r8, =__stack_chk_guard