Skip to content

Commit

Permalink
arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives
Browse files Browse the repository at this point in the history
The identity map is mapped as both writeable and executable by the
SWAPPER_MM_MMUFLAGS and this is relied upon by the kpti code to manage
a synchronisation flag. Update the .pushsection flags to reflect the
actual mapping attributes.

Reported-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Will Deacon authored and Catalin Marinas committed Feb 6, 2018
1 parent 79ddab3 commit 439e70e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/cpu-reset.S
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <asm/virt.h>

.text
.pushsection .idmap.text, "ax"
.pushsection .idmap.text, "awx"

/*
* __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ ENDPROC(__primary_switched)
* end early head section, begin head code that is also used for
* hotplug and needs to have the same protections as the text region
*/
.section ".idmap.text","ax"
.section ".idmap.text","awx"

ENTRY(kimage_vaddr)
.quad _text - TEXT_OFFSET
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/sleep.S
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ENTRY(__cpu_suspend_enter)
ret
ENDPROC(__cpu_suspend_enter)

.pushsection ".idmap.text", "ax"
.pushsection ".idmap.text", "awx"
ENTRY(cpu_resume)
bl el2_setup // if in EL2 drop to EL1 cleanly
bl __cpu_setup
Expand Down
8 changes: 4 additions & 4 deletions arch/arm64/mm/proc.S
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ENDPROC(cpu_do_suspend)
*
* x0: Address of context pointer
*/
.pushsection ".idmap.text", "ax"
.pushsection ".idmap.text", "awx"
ENTRY(cpu_do_resume)
ldp x2, x3, [x0]
ldp x4, x5, [x0, #16]
Expand Down Expand Up @@ -165,7 +165,7 @@ ENTRY(cpu_do_switch_mm)
b post_ttbr_update_workaround // Back to C code...
ENDPROC(cpu_do_switch_mm)

.pushsection ".idmap.text", "ax"
.pushsection ".idmap.text", "awx"

.macro __idmap_cpu_set_reserved_ttbr1, tmp1, tmp2
adrp \tmp1, empty_zero_page
Expand Down Expand Up @@ -199,7 +199,7 @@ ENDPROC(idmap_cpu_replace_ttbr1)
.popsection

#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
.pushsection ".idmap.text", "ax"
.pushsection ".idmap.text", "awx"

.macro __idmap_kpti_get_pgtable_ent, type
dc cvac, cur_\()\type\()p // Ensure any existing dirty
Expand Down Expand Up @@ -388,7 +388,7 @@ ENDPROC(idmap_kpti_install_ng_mappings)
* Initialise the processor for turning the MMU on. Return in x0 the
* value of the SCTLR_EL1 register.
*/
.pushsection ".idmap.text", "ax"
.pushsection ".idmap.text", "awx"
ENTRY(__cpu_setup)
tlbi vmalle1 // Invalidate local TLB
dsb nsh
Expand Down

0 comments on commit 439e70e

Please sign in to comment.