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/mm/proc-macros.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/mm/proc-macros.S')
-rw-r--r-- | arch/arm/mm/proc-macros.S | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 7d63beaf9745..337f10256cd6 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S | |||
@@ -99,6 +99,10 @@ | |||
99 | * 110x 0 1 0 r/w r/o | 99 | * 110x 0 1 0 r/w r/o |
100 | * 11x0 0 1 0 r/w r/o | 100 | * 11x0 0 1 0 r/w r/o |
101 | * 1111 0 1 1 r/w r/w | 101 | * 1111 0 1 1 r/w r/w |
102 | * | ||
103 | * If !CONFIG_CPU_USE_DOMAINS, the following permissions are changed: | ||
104 | * 110x 1 1 1 r/o r/o | ||
105 | * 11x0 1 1 1 r/o r/o | ||
102 | */ | 106 | */ |
103 | .macro armv6_mt_table pfx | 107 | .macro armv6_mt_table pfx |
104 | \pfx\()_mt_table: | 108 | \pfx\()_mt_table: |
@@ -138,8 +142,11 @@ | |||
138 | 142 | ||
139 | tst r1, #L_PTE_USER | 143 | tst r1, #L_PTE_USER |
140 | orrne r3, r3, #PTE_EXT_AP1 | 144 | orrne r3, r3, #PTE_EXT_AP1 |
145 | #ifdef CONFIG_CPU_USE_DOMAINS | ||
146 | @ allow kernel read/write access to read-only user pages | ||
141 | tstne r3, #PTE_EXT_APX | 147 | tstne r3, #PTE_EXT_APX |
142 | bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 | 148 | bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0 |
149 | #endif | ||
143 | 150 | ||
144 | tst r1, #L_PTE_EXEC | 151 | tst r1, #L_PTE_EXEC |
145 | orreq r3, r3, #PTE_EXT_XN | 152 | orreq r3, r3, #PTE_EXT_XN |