diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-13 14:44:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-13 14:44:12 -0400 |
commit | e6ef760731ada512d7258c5ed48423144f831eab (patch) | |
tree | b4f5abb16bace95751b5648c993559ef584e1ca6 | |
parent | 35a84f34cf41915a0b2d0a3688b20761580f8ce4 (diff) | |
parent | b4c7e2bd2eb4764afe3af9409ff3b1b87116fa30 (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
-rw-r--r-- | arch/arm/kernel/head-nommu.S | 2 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 9 |
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]) | |||
177 | bic r0, r0, #CR_I | 177 | bic r0, r0, #CR_I |
178 | #endif | 178 | #endif |
179 | mcr p15, 0, r0, c1, c0, 0 @ write control reg | 179 | mcr p15, 0, r0, c1, c0, 0 @ write control reg |
180 | isb | 180 | instr_sync |
181 | #elif defined (CONFIG_CPU_V7M) | 181 | #elif defined (CONFIG_CPU_V7M) |
182 | #ifdef CONFIG_ARM_MPU | 182 | #ifdef CONFIG_ARM_MPU |
183 | ldreq r3, [r12, MPU_CTRL] | 183 | 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) | |||
736 | return 0; | 736 | return 0; |
737 | } | 737 | } |
738 | 738 | ||
739 | static int kernel_set_to_readonly __read_mostly; | ||
740 | |||
739 | void mark_rodata_ro(void) | 741 | void mark_rodata_ro(void) |
740 | { | 742 | { |
743 | kernel_set_to_readonly = 1; | ||
741 | stop_machine(__mark_rodata_ro, NULL, NULL); | 744 | stop_machine(__mark_rodata_ro, NULL, NULL); |
742 | debug_checkwx(); | 745 | debug_checkwx(); |
743 | } | 746 | } |
744 | 747 | ||
745 | void set_kernel_text_rw(void) | 748 | void set_kernel_text_rw(void) |
746 | { | 749 | { |
750 | if (!kernel_set_to_readonly) | ||
751 | return; | ||
752 | |||
747 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false, | 753 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false, |
748 | current->active_mm); | 754 | current->active_mm); |
749 | } | 755 | } |
750 | 756 | ||
751 | void set_kernel_text_ro(void) | 757 | void set_kernel_text_ro(void) |
752 | { | 758 | { |
759 | if (!kernel_set_to_readonly) | ||
760 | return; | ||
761 | |||
753 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true, | 762 | set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true, |
754 | current->active_mm); | 763 | current->active_mm); |
755 | } | 764 | } |