summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-06-30 12:03:59 -0400
committerKees Cook <keescook@chromium.org>2017-06-30 15:00:50 -0400
commitffa47aa678cfaa9b88e8a26cfb115b4768325121 (patch)
tree0719bef951a1e28762868066d3bd73ac29f80c8b
parent1854c19cae0d108637c40f90ee0bb9b7c1adbc0a (diff)
ARM: Prepare for randomized task_struct
With the new task struct randomization, we can run into a build failure for certain random seeds, which will place fields beyond the allow immediate size in the assembly: arch/arm/kernel/entry-armv.S: Assembler messages: arch/arm/kernel/entry-armv.S:803: Error: bad immediate value for offset (4096) Only two constants in asm-offset.h are affected, and I'm changing both of them here to work correctly in all configurations. One more macro has the problem, but is currently unused, so this removes it instead of adding complexity. Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> [kees: Adjust commit log slightly] Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r--arch/arm/include/asm/assembler.h2
-rw-r--r--arch/arm/kernel/entry-armv.S5
-rw-r--r--arch/arm/mm/proc-macros.S10
3 files changed, 10 insertions, 7 deletions
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 68b06f9c65de..ad301f107dd2 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -87,6 +87,8 @@
87#define CALGN(code...) 87#define CALGN(code...)
88#endif 88#endif
89 89
90#define IMM12_MASK 0xfff
91
90/* 92/*
91 * Enable and disable interrupts 93 * Enable and disable interrupts
92 */ 94 */
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 9f157e7c51e7..c731f0d2b2af 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -797,7 +797,10 @@ ENTRY(__switch_to)
797#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 797#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
798 ldr r7, [r2, #TI_TASK] 798 ldr r7, [r2, #TI_TASK]
799 ldr r8, =__stack_chk_guard 799 ldr r8, =__stack_chk_guard
800 ldr r7, [r7, #TSK_STACK_CANARY] 800 .if (TSK_STACK_CANARY > IMM12_MASK)
801 add r7, r7, #TSK_STACK_CANARY & ~IMM12_MASK
802 .endif
803 ldr r7, [r7, #TSK_STACK_CANARY & IMM12_MASK]
801#endif 804#endif
802#ifdef CONFIG_CPU_USE_DOMAINS 805#ifdef CONFIG_CPU_USE_DOMAINS
803 mcr p15, 0, r6, c3, c0, 0 @ Set domain register 806 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 0d40c285bd86..f944836da8a2 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -25,11 +25,6 @@
25 ldr \rd, [\rn, #VMA_VM_FLAGS] 25 ldr \rd, [\rn, #VMA_VM_FLAGS]
26 .endm 26 .endm
27 27
28 .macro tsk_mm, rd, rn
29 ldr \rd, [\rn, #TI_TASK]
30 ldr \rd, [\rd, #TSK_ACTIVE_MM]
31 .endm
32
33/* 28/*
34 * act_mm - get current->active_mm 29 * act_mm - get current->active_mm
35 */ 30 */
@@ -37,7 +32,10 @@
37 bic \rd, sp, #8128 32 bic \rd, sp, #8128
38 bic \rd, \rd, #63 33 bic \rd, \rd, #63
39 ldr \rd, [\rd, #TI_TASK] 34 ldr \rd, [\rd, #TI_TASK]
40 ldr \rd, [\rd, #TSK_ACTIVE_MM] 35 .if (TSK_ACTIVE_MM > IMM12_MASK)
36 add \rd, \rd, #TSK_ACTIVE_MM & ~IMM12_MASK
37 .endif
38 ldr \rd, [\rd, #TSK_ACTIVE_MM & IMM12_MASK]
41 .endm 39 .endm
42 40
43/* 41/*