summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 11:44:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 11:44:12 -0700
commite6ef760731ada512d7258c5ed48423144f831eab (patch)
treeb4f5abb16bace95751b5648c993559ef584e1ca6 /arch
parent35a84f34cf41915a0b2d0a3688b20761580f8ce4 (diff)
parentb4c7e2bd2eb4764afe3af9409ff3b1b87116fa30 (diff)
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: "A couple of small fixes this time around from Steven for an interaction between ftrace and kernel read-only protection, and Vladimir for nommu" * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: 8780/1: ftrace: Only set kernel memory back to read-only after boot ARM: 8775/1: NOMMU: Use instr_sync instead of plain isb in common code
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/head-nommu.S2
-rw-r--r--arch/arm/mm/init.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index dd546d65a383..7a9b86978ee1 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -177,7 +177,7 @@ M_CLASS(streq r3, [r12, #PMSAv8_MAIR1])
bic r0, r0, #CR_I
#endif
mcr p15, 0, r0, c1, c0, 0 @ write control reg
- isb
+ instr_sync
#elif defined (CONFIG_CPU_V7M)
#ifdef CONFIG_ARM_MPU
ldreq r3, [r12, MPU_CTRL]
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c186474422f3..0cc8e04295a4 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -736,20 +736,29 @@ static int __mark_rodata_ro(void *unused)
return 0;
}
+static int kernel_set_to_readonly __read_mostly;
+
void mark_rodata_ro(void)
{
+ kernel_set_to_readonly = 1;
stop_machine(__mark_rodata_ro, NULL, NULL);
debug_checkwx();
}
void set_kernel_text_rw(void)
{
+ if (!kernel_set_to_readonly)
+ return;
+
set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false,
current->active_mm);
}
void set_kernel_text_ro(void)
{
+ if (!kernel_set_to_readonly)
+ return;
+
set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true,
current->active_mm);
}