diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2010-09-13 11:03:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-11-04 11:44:31 -0400 |
commit | 247055aa21ffef1c49dd64710d5e94c2aee19b58 (patch) | |
tree | e9e026b96597d080de4c16bb88c17b0495c61904 /arch/arm/lib/putuser.S | |
parent | ff8b16d7e15a8ba2a6086645614a483e048e3fbf (diff) |
ARM: 6384/1: Remove the domain switching on ARMv6k/v7 CPUs
This patch removes the domain switching functionality via the set_fs and
__switch_to functions on cores that have a TLS register.
Currently, the ioremap and vmalloc areas share the same level 1 page
tables and therefore have the same domain (DOMAIN_KERNEL). When the
kernel domain is modified from Client to Manager (via the __set_fs or in
the __switch_to function), the XN (eXecute Never) bit is overridden and
newer CPUs can speculatively prefetch the ioremap'ed memory.
Linux performs the kernel domain switching to allow user-specific
functions (copy_to/from_user, get/put_user etc.) to access kernel
memory. In order for these functions to work with the kernel domain set
to Client, the patch modifies the LDRT/STRT and related instructions to
the LDR/STR ones.
The user pages access rights are also modified for kernel read-only
access rather than read/write so that the copy-on-write mechanism still
works. CPU_USE_DOMAINS gets disabled only if the hardware has a TLS register
(CPU_32v6K is defined) since writing the TLS value to the high vectors page
isn't possible.
The user addresses passed to the kernel are checked by the access_ok()
function so that they do not point to the kernel space.
Tested-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib/putuser.S')
-rw-r--r-- | arch/arm/lib/putuser.S | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/arm/lib/putuser.S b/arch/arm/lib/putuser.S index 5a01a23c6c06..c023fc11e86c 100644 --- a/arch/arm/lib/putuser.S +++ b/arch/arm/lib/putuser.S | |||
@@ -28,9 +28,10 @@ | |||
28 | */ | 28 | */ |
29 | #include <linux/linkage.h> | 29 | #include <linux/linkage.h> |
30 | #include <asm/errno.h> | 30 | #include <asm/errno.h> |
31 | #include <asm/domain.h> | ||
31 | 32 | ||
32 | ENTRY(__put_user_1) | 33 | ENTRY(__put_user_1) |
33 | 1: strbt r2, [r0] | 34 | 1: T(strb) r2, [r0] |
34 | mov r0, #0 | 35 | mov r0, #0 |
35 | mov pc, lr | 36 | mov pc, lr |
36 | ENDPROC(__put_user_1) | 37 | ENDPROC(__put_user_1) |
@@ -39,19 +40,19 @@ ENTRY(__put_user_2) | |||
39 | mov ip, r2, lsr #8 | 40 | mov ip, r2, lsr #8 |
40 | #ifdef CONFIG_THUMB2_KERNEL | 41 | #ifdef CONFIG_THUMB2_KERNEL |
41 | #ifndef __ARMEB__ | 42 | #ifndef __ARMEB__ |
42 | 2: strbt r2, [r0] | 43 | 2: T(strb) r2, [r0] |
43 | 3: strbt ip, [r0, #1] | 44 | 3: T(strb) ip, [r0, #1] |
44 | #else | 45 | #else |
45 | 2: strbt ip, [r0] | 46 | 2: T(strb) ip, [r0] |
46 | 3: strbt r2, [r0, #1] | 47 | 3: T(strb) r2, [r0, #1] |
47 | #endif | 48 | #endif |
48 | #else /* !CONFIG_THUMB2_KERNEL */ | 49 | #else /* !CONFIG_THUMB2_KERNEL */ |
49 | #ifndef __ARMEB__ | 50 | #ifndef __ARMEB__ |
50 | 2: strbt r2, [r0], #1 | 51 | 2: T(strb) r2, [r0], #1 |
51 | 3: strbt ip, [r0] | 52 | 3: T(strb) ip, [r0] |
52 | #else | 53 | #else |
53 | 2: strbt ip, [r0], #1 | 54 | 2: T(strb) ip, [r0], #1 |
54 | 3: strbt r2, [r0] | 55 | 3: T(strb) r2, [r0] |
55 | #endif | 56 | #endif |
56 | #endif /* CONFIG_THUMB2_KERNEL */ | 57 | #endif /* CONFIG_THUMB2_KERNEL */ |
57 | mov r0, #0 | 58 | mov r0, #0 |
@@ -59,18 +60,18 @@ ENTRY(__put_user_2) | |||
59 | ENDPROC(__put_user_2) | 60 | ENDPROC(__put_user_2) |
60 | 61 | ||
61 | ENTRY(__put_user_4) | 62 | ENTRY(__put_user_4) |
62 | 4: strt r2, [r0] | 63 | 4: T(str) r2, [r0] |
63 | mov r0, #0 | 64 | mov r0, #0 |
64 | mov pc, lr | 65 | mov pc, lr |
65 | ENDPROC(__put_user_4) | 66 | ENDPROC(__put_user_4) |
66 | 67 | ||
67 | ENTRY(__put_user_8) | 68 | ENTRY(__put_user_8) |
68 | #ifdef CONFIG_THUMB2_KERNEL | 69 | #ifdef CONFIG_THUMB2_KERNEL |
69 | 5: strt r2, [r0] | 70 | 5: T(str) r2, [r0] |
70 | 6: strt r3, [r0, #4] | 71 | 6: T(str) r3, [r0, #4] |
71 | #else | 72 | #else |
72 | 5: strt r2, [r0], #4 | 73 | 5: T(str) r2, [r0], #4 |
73 | 6: strt r3, [r0] | 74 | 6: T(str) r3, [r0] |
74 | #endif | 75 | #endif |
75 | mov r0, #0 | 76 | mov r0, #0 |
76 | mov pc, lr | 77 | mov pc, lr |