diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-11-03 05:12:13 -0500 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-11-03 05:12:13 -0500 |
| commit | 06e944b8e5fc4bec83f102f98c1ee4f972f5f072 (patch) | |
| tree | d53b1c3ca270f49f1cae63bbe117cc8587e51510 | |
| parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) | |
| parent | 80d6b0c2eed2a504f6740cd1f5ea76dc50abfc4d (diff) | |
Merge tag 'ronx-next' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into devel-stable
generic fixmaps
ARM support for CONFIG_DEBUG_RODATA
| -rw-r--r-- | Documentation/arm/memory.txt | 2 | ||||
| -rw-r--r-- | arch/arm/include/asm/cacheflush.h | 10 | ||||
| -rw-r--r-- | arch/arm/include/asm/fixmap.h | 31 | ||||
| -rw-r--r-- | arch/arm/kernel/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/kernel/ftrace.c | 19 | ||||
| -rw-r--r-- | arch/arm/kernel/jump_label.c | 2 | ||||
| -rw-r--r-- | arch/arm/kernel/kgdb.c | 29 | ||||
| -rw-r--r-- | arch/arm/kernel/machine_kexec.c | 9 | ||||
| -rw-r--r-- | arch/arm/kernel/patch.c | 92 | ||||
| -rw-r--r-- | arch/arm/kernel/patch.h | 12 | ||||
| -rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 19 | ||||
| -rw-r--r-- | arch/arm/mm/Kconfig | 21 | ||||
| -rw-r--r-- | arch/arm/mm/highmem.c | 15 | ||||
| -rw-r--r-- | arch/arm/mm/init.c | 149 | ||||
| -rw-r--r-- | arch/arm/mm/mmu.c | 39 |
15 files changed, 394 insertions, 57 deletions
diff --git a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt index 38dc06d0a791..4178ebda6e66 100644 --- a/Documentation/arm/memory.txt +++ b/Documentation/arm/memory.txt | |||
| @@ -41,7 +41,7 @@ fffe8000 fffeffff DTCM mapping area for platforms with | |||
| 41 | fffe0000 fffe7fff ITCM mapping area for platforms with | 41 | fffe0000 fffe7fff ITCM mapping area for platforms with |
| 42 | ITCM mounted inside the CPU. | 42 | ITCM mounted inside the CPU. |
| 43 | 43 | ||
| 44 | ffc00000 ffdfffff Fixmap mapping region. Addresses provided | 44 | ffc00000 ffefffff Fixmap mapping region. Addresses provided |
| 45 | by fix_to_virt() will be located here. | 45 | by fix_to_virt() will be located here. |
| 46 | 46 | ||
| 47 | fee00000 feffffff Mapping of PCI I/O space. This is a static | 47 | fee00000 feffffff Mapping of PCI I/O space. This is a static |
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index 10e78d00a0bb..2d46862e7bef 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
| @@ -487,6 +487,16 @@ int set_memory_rw(unsigned long addr, int numpages); | |||
| 487 | int set_memory_x(unsigned long addr, int numpages); | 487 | int set_memory_x(unsigned long addr, int numpages); |
| 488 | int set_memory_nx(unsigned long addr, int numpages); | 488 | int set_memory_nx(unsigned long addr, int numpages); |
| 489 | 489 | ||
| 490 | #ifdef CONFIG_DEBUG_RODATA | ||
| 491 | void mark_rodata_ro(void); | ||
| 492 | void set_kernel_text_rw(void); | ||
| 493 | void set_kernel_text_ro(void); | ||
| 494 | #else | ||
| 495 | static inline void set_kernel_text_rw(void) { } | ||
| 496 | static inline void set_kernel_text_ro(void) { } | ||
| 497 | #endif | ||
| 498 | |||
| 490 | void flush_uprobe_xol_access(struct page *page, unsigned long uaddr, | 499 | void flush_uprobe_xol_access(struct page *page, unsigned long uaddr, |
| 491 | void *kaddr, unsigned long len); | 500 | void *kaddr, unsigned long len); |
| 501 | |||
| 492 | #endif | 502 | #endif |
diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h index 74124b0d0d79..0415eae1df27 100644 --- a/arch/arm/include/asm/fixmap.h +++ b/arch/arm/include/asm/fixmap.h | |||
| @@ -2,27 +2,24 @@ | |||
| 2 | #define _ASM_FIXMAP_H | 2 | #define _ASM_FIXMAP_H |
| 3 | 3 | ||
| 4 | #define FIXADDR_START 0xffc00000UL | 4 | #define FIXADDR_START 0xffc00000UL |
| 5 | #define FIXADDR_TOP 0xffe00000UL | 5 | #define FIXADDR_END 0xfff00000UL |
| 6 | #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) | 6 | #define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE) |
| 7 | 7 | ||
| 8 | #define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT) | 8 | #include <asm/kmap_types.h> |
| 9 | 9 | ||
| 10 | #define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT)) | 10 | enum fixed_addresses { |
| 11 | #define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT) | 11 | FIX_KMAP_BEGIN, |
| 12 | FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1, | ||
| 12 | 13 | ||
| 13 | extern void __this_fixmap_does_not_exist(void); | 14 | /* Support writing RO kernel text via kprobes, jump labels, etc. */ |
| 15 | FIX_TEXT_POKE0, | ||
| 16 | FIX_TEXT_POKE1, | ||
| 14 | 17 | ||
| 15 | static inline unsigned long fix_to_virt(const unsigned int idx) | 18 | __end_of_fixed_addresses |
| 16 | { | 19 | }; |
| 17 | if (idx >= FIX_KMAP_NR_PTES) | ||
| 18 | __this_fixmap_does_not_exist(); | ||
| 19 | return __fix_to_virt(idx); | ||
| 20 | } | ||
| 21 | 20 | ||
| 22 | static inline unsigned int virt_to_fix(const unsigned long vaddr) | 21 | void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); |
| 23 | { | 22 | |
| 24 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | 23 | #include <asm-generic/fixmap.h> |
| 25 | return __virt_to_fix(vaddr); | ||
| 26 | } | ||
| 27 | 24 | ||
| 28 | #endif | 25 | #endif |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 38ddd9f83d0e..70b730766330 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
| @@ -67,7 +67,7 @@ test-kprobes-objs += kprobes-test-arm.o | |||
| 67 | endif | 67 | endif |
| 68 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o | 68 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o |
| 69 | obj-$(CONFIG_ARM_THUMBEE) += thumbee.o | 69 | obj-$(CONFIG_ARM_THUMBEE) += thumbee.o |
| 70 | obj-$(CONFIG_KGDB) += kgdb.o | 70 | obj-$(CONFIG_KGDB) += kgdb.o patch.o |
| 71 | obj-$(CONFIG_ARM_UNWIND) += unwind.o | 71 | obj-$(CONFIG_ARM_UNWIND) += unwind.o |
| 72 | obj-$(CONFIG_HAVE_TCM) += tcm.o | 72 | obj-$(CONFIG_HAVE_TCM) += tcm.o |
| 73 | obj-$(CONFIG_OF) += devtree.o | 73 | obj-$(CONFIG_OF) += devtree.o |
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index af9a8a927a4e..b8c75e45a950 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/ftrace.h> | 15 | #include <linux/ftrace.h> |
| 16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/stop_machine.h> | ||
| 18 | 19 | ||
| 19 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
| 20 | #include <asm/opcodes.h> | 21 | #include <asm/opcodes.h> |
| @@ -35,6 +36,22 @@ | |||
| 35 | 36 | ||
| 36 | #define OLD_NOP 0xe1a00000 /* mov r0, r0 */ | 37 | #define OLD_NOP 0xe1a00000 /* mov r0, r0 */ |
| 37 | 38 | ||
| 39 | static int __ftrace_modify_code(void *data) | ||
| 40 | { | ||
| 41 | int *command = data; | ||
| 42 | |||
| 43 | set_kernel_text_rw(); | ||
| 44 | ftrace_modify_all_code(*command); | ||
| 45 | set_kernel_text_ro(); | ||
| 46 | |||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | void arch_ftrace_update_code(int command) | ||
| 51 | { | ||
| 52 | stop_machine(__ftrace_modify_code, &command, NULL); | ||
| 53 | } | ||
| 54 | |||
| 38 | static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec) | 55 | static unsigned long ftrace_nop_replace(struct dyn_ftrace *rec) |
| 39 | { | 56 | { |
| 40 | return rec->arch.old_mcount ? OLD_NOP : NOP; | 57 | return rec->arch.old_mcount ? OLD_NOP : NOP; |
| @@ -73,6 +90,8 @@ int ftrace_arch_code_modify_prepare(void) | |||
| 73 | int ftrace_arch_code_modify_post_process(void) | 90 | int ftrace_arch_code_modify_post_process(void) |
| 74 | { | 91 | { |
| 75 | set_all_modules_text_ro(); | 92 | set_all_modules_text_ro(); |
| 93 | /* Make sure any TLB misses during machine stop are cleared. */ | ||
| 94 | flush_tlb_all(); | ||
| 76 | return 0; | 95 | return 0; |
| 77 | } | 96 | } |
| 78 | 97 | ||
diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c index 4ce4f789446d..afeeb9ea6f43 100644 --- a/arch/arm/kernel/jump_label.c +++ b/arch/arm/kernel/jump_label.c | |||
| @@ -19,7 +19,7 @@ static void __arch_jump_label_transform(struct jump_entry *entry, | |||
| 19 | insn = arm_gen_nop(); | 19 | insn = arm_gen_nop(); |
| 20 | 20 | ||
| 21 | if (is_static) | 21 | if (is_static) |
| 22 | __patch_text(addr, insn); | 22 | __patch_text_early(addr, insn); |
| 23 | else | 23 | else |
| 24 | patch_text(addr, insn); | 24 | patch_text(addr, insn); |
| 25 | } | 25 | } |
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index a74b53c1b7df..07db2f8a1b45 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c | |||
| @@ -12,8 +12,12 @@ | |||
| 12 | #include <linux/irq.h> | 12 | #include <linux/irq.h> |
| 13 | #include <linux/kdebug.h> | 13 | #include <linux/kdebug.h> |
| 14 | #include <linux/kgdb.h> | 14 | #include <linux/kgdb.h> |
| 15 | #include <linux/uaccess.h> | ||
| 16 | |||
| 15 | #include <asm/traps.h> | 17 | #include <asm/traps.h> |
| 16 | 18 | ||
| 19 | #include "patch.h" | ||
| 20 | |||
| 17 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = | 21 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = |
| 18 | { | 22 | { |
| 19 | { "r0", 4, offsetof(struct pt_regs, ARM_r0)}, | ||
