Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM updates from Russell King:

- amba bus irq rework

- add kfence support

- support for Cortex M33 and M55 CPUs

- kbuild updates for decompressor

- let core code manage thread_info::cpu

- avoid unpredictable NOP encoding in decompressor

- reduce information printed in calltraces

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: reduce the information printed in call traces
ARM: 9168/1: Add support for Cortex-M55 processor
ARM: 9167/1: Add support for Cortex-M33 processor
ARM: 9166/1: Support KFENCE for ARM
ARM: 9165/1: mm: Provide is_write_fault()
ARM: 9164/1: mm: Provide set_memory_valid()
ARM: 9163/1: amba: Move of_amba_device_decode_irq() into amba_probe()
ARM: 9162/1: amba: Kill sysfs attribute file of irq
ARM: 9161/1: mm: mark private VM_FAULT_X defines as vm_fault_t
ARM: 9159/1: decompressor: Avoid UNPREDICTABLE NOP encoding
ARM: 9158/1: leave it to core code to manage thread_info::cpu
ARM: 9154/1: decompressor: do not copy source files while building

+200 -124
+1 -1
Documentation/features/core/thread-info-in-task/arch-support.txt
··· 8 8 ----------------------- 9 9 | alpha: | TODO | 10 10 | arc: | TODO | 11 - | arm: | TODO | 11 + | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 14 | h8300: | TODO |
+1
arch/arm/Kconfig
··· 69 69 select HAVE_ARCH_AUDITSYSCALL if AEABI && !OABI_COMPAT 70 70 select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 71 71 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU 72 + select HAVE_ARCH_KFENCE if MMU && !XIP_KERNEL 72 73 select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU 73 74 select HAVE_ARCH_KASAN if MMU && !XIP_KERNEL 74 75 select HAVE_ARCH_MMAP_RND_BITS if MMU
+11
arch/arm/Kconfig.debug
··· 81 81 config ARM_UNWIND 82 82 bool 83 83 84 + config BACKTRACE_VERBOSE 85 + bool "Verbose backtrace" 86 + depends on EXPERT 87 + help 88 + When the kernel produces a warning or oops, the kernel prints a 89 + trace of the call chain. This option controls whether we include 90 + the numeric addresses or only include the symbolic information. 91 + 92 + In most cases, say N here, unless you are intending to debug the 93 + kernel and have access to the kernel binary image. 94 + 84 95 config FRAME_POINTER 85 96 bool 86 97
-5
arch/arm/boot/compressed/.gitignore
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - ashldi3.S 3 - bswapsdi2.S 4 - font.c 5 - lib1funcs.S 6 - hyp-stub.S 7 2 piggy_data 8 3 vmlinux 9 4 vmlinux.lds
+3 -30
arch/arm/boot/compressed/Makefile
··· 13 13 OBJS += debug.o 14 14 AFLAGS_head.o += -DDEBUG 15 15 endif 16 - FONTC = $(srctree)/lib/fonts/font_acorn_8x8.c 17 16 18 17 # string library code (-Os is enforced to keep it much smaller) 19 18 OBJS += string.o ··· 98 99 $(eval CFLAGS_$(o) := -I $(srctree)/scripts/dtc/libfdt -fno-stack-protector)) 99 100 100 101 targets := vmlinux vmlinux.lds piggy_data piggy.o \ 101 - lib1funcs.o ashldi3.o bswapsdi2.o \ 102 102 head.o $(OBJS) 103 - 104 - clean-files += lib1funcs.S ashldi3.S bswapsdi2.S hyp-stub.S 105 103 106 104 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING 107 105 ··· 130 134 # Next argument is a linker script 131 135 LDFLAGS_vmlinux += -T 132 136 133 - # For __aeabi_uidivmod 134 - lib1funcs = $(obj)/lib1funcs.o 135 - 136 - $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S 137 - $(call cmd,shipped) 138 - 139 - # For __aeabi_llsl 140 - ashldi3 = $(obj)/ashldi3.o 141 - 142 - $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S 143 - $(call cmd,shipped) 144 - 145 - # For __bswapsi2, __bswapdi2 146 - bswapsdi2 = $(obj)/bswapsdi2.o 147 - 148 - $(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S 149 - $(call cmd,shipped) 137 + OBJS += lib1funcs.o ashldi3.o bswapsdi2.o 150 138 151 139 # We need to prevent any GOTOFF relocs being used with references 152 140 # to symbols in the .bss section since we cannot relocate them ··· 155 175 efi-obj-$(CONFIG_EFI_STUB) := $(objtree)/drivers/firmware/efi/libstub/lib.a 156 176 157 177 $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \ 158 - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \ 159 - $(bswapsdi2) $(efi-obj-y) FORCE 178 + $(addprefix $(obj)/, $(OBJS)) \ 179 + $(efi-obj-y) FORCE 160 180 @$(check_for_multiple_zreladdr) 161 181 $(call if_changed,ld) 162 182 @$(check_for_bad_syms) ··· 167 187 $(obj)/piggy.o: $(obj)/piggy_data 168 188 169 189 CFLAGS_font.o := -Dstatic= 170 - 171 - $(obj)/font.c: $(FONTC) 172 - $(call cmd,shipped) 173 - 174 190 AFLAGS_hyp-stub.o := -Wa,-march=armv7-a 175 - 176 - $(obj)/hyp-stub.S: $(srctree)/arch/$(SRCARCH)/kernel/hyp-stub.S 177 - $(call cmd,shipped)
+3
arch/arm/boot/compressed/ashldi3.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* For __aeabi_llsl */ 3 + #include "../../lib/ashldi3.S"
+3
arch/arm/boot/compressed/bswapsdi2.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* For __bswapsi2, __bswapdi2 */ 3 + #include "../../lib/bswapsdi2.S"
+14 -8
arch/arm/boot/compressed/efi-header.S
··· 9 9 #include <linux/sizes.h> 10 10 11 11 .macro __nop 12 - #ifdef CONFIG_EFI_STUB 13 - @ This is almost but not quite a NOP, since it does clobber the 14 - @ condition flags. But it is the best we can do for EFI, since 15 - @ PE/COFF expects the magic string "MZ" at offset 0, while the 16 - @ ARM/Linux boot protocol expects an executable instruction 17 - @ there. 18 - .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 19 - #else 20 12 AR_CLASS( mov r0, r0 ) 21 13 M_CLASS( nop.w ) 14 + .endm 15 + 16 + .macro __initial_nops 17 + #ifdef CONFIG_EFI_STUB 18 + @ This is a two-instruction NOP, which happens to bear the 19 + @ PE/COFF signature "MZ" in the first two bytes, so the kernel 20 + @ is accepted as an EFI binary. Booting via the UEFI stub 21 + @ will not execute those instructions, but the ARM/Linux 22 + @ boot protocol does, so we need some NOPs here. 23 + .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 24 + eor r5, r5, 0x4d000 @ undo previous insn 25 + #else 26 + __nop 27 + __nop 22 28 #endif 23 29 .endm 24 30
+2
arch/arm/boot/compressed/font.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include "../../../../lib/fonts/font_acorn_8x8.c"
+2 -1
arch/arm/boot/compressed/head.S
··· 203 203 * were patching the initial instructions of the kernel, i.e 204 204 * had started to exploit this "patch area". 205 205 */ 206 - .rept 7 206 + __initial_nops 207 + .rept 5 207 208 __nop 208 209 .endr 209 210 #ifndef CONFIG_THUMB2_KERNEL
+2
arch/arm/boot/compressed/hyp-stub.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #include "../../kernel/hyp-stub.S"
+3
arch/arm/boot/compressed/lib1funcs.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* For __aeabi_uidivmod */ 3 + #include "../../lib/lib1funcs.S"
+53
arch/arm/include/asm/kfence.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #ifndef __ASM_ARM_KFENCE_H 4 + #define __ASM_ARM_KFENCE_H 5 + 6 + #include <linux/kfence.h> 7 + 8 + #include <asm/pgalloc.h> 9 + #include <asm/set_memory.h> 10 + 11 + static inline int split_pmd_page(pmd_t *pmd, unsigned long addr) 12 + { 13 + int i; 14 + unsigned long pfn = PFN_DOWN(__pa(addr)); 15 + pte_t *pte = pte_alloc_one_kernel(&init_mm); 16 + 17 + if (!pte) 18 + return -ENOMEM; 19 + 20 + for (i = 0; i < PTRS_PER_PTE; i++) 21 + set_pte_ext(pte + i, pfn_pte(pfn + i, PAGE_KERNEL), 0); 22 + pmd_populate_kernel(&init_mm, pmd, pte); 23 + 24 + flush_tlb_kernel_range(addr, addr + PMD_SIZE); 25 + return 0; 26 + } 27 + 28 + static inline bool arch_kfence_init_pool(void) 29 + { 30 + unsigned long addr; 31 + pmd_t *pmd; 32 + 33 + for (addr = (unsigned long)__kfence_pool; is_kfence_address((void *)addr); 34 + addr += PAGE_SIZE) { 35 + pmd = pmd_off_k(addr); 36 + 37 + if (pmd_leaf(*pmd)) { 38 + if (split_pmd_page(pmd, addr & PMD_MASK)) 39 + return false; 40 + } 41 + } 42 + 43 + return true; 44 + } 45 + 46 + static inline bool kfence_protect_page(unsigned long addr, bool protect) 47 + { 48 + set_memory_valid(addr, 1, !protect); 49 + 50 + return true; 51 + } 52 + 53 + #endif /* __ASM_ARM_KFENCE_H */
+1
arch/arm/include/asm/set_memory.h
··· 11 11 int set_memory_rw(unsigned long addr, int numpages); 12 12 int set_memory_x(unsigned long addr, int numpages); 13 13 int set_memory_nx(unsigned long addr, int numpages); 14 + int set_memory_valid(unsigned long addr, int numpages, int enable); 14 15 #else 15 16 static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; } 16 17 static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
-14
arch/arm/include/asm/switch_to.h
··· 23 23 */ 24 24 extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *); 25 25 26 - static inline void set_ti_cpu(struct task_struct *p) 27 - { 28 - #ifdef CONFIG_THREAD_INFO_IN_TASK 29 - /* 30 - * The core code no longer maintains the thread_info::cpu field once 31 - * CONFIG_THREAD_INFO_IN_TASK is in effect, but we rely on it for 32 - * raw_smp_processor_id(), which cannot access struct task_struct* 33 - * directly for reasons of circular #inclusion hell. 34 - */ 35 - task_thread_info(p)->cpu = task_cpu(p); 36 - #endif 37 - } 38 - 39 26 #define switch_to(prev,next,last) \ 40 27 do { \ 41 28 __complete_pending_tlbi(); \ 42 - set_ti_cpu(next); \ 43 29 if (IS_ENABLED(CONFIG_CURRENT_POINTER_IN_TPIDRURO)) \ 44 30 __this_cpu_write(__entry_task, next); \ 45 31 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
-3
arch/arm/kernel/smp.c
··· 154 154 secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir); 155 155 #endif 156 156 secondary_data.task = idle; 157 - if (IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK)) 158 - task_thread_info(idle)->cpu = cpu; 159 - 160 157 sync_cache_w(&secondary_data); 161 158 162 159 /*
+5 -3
arch/arm/kernel/traps.c
··· 67 67 { 68 68 unsigned long end = frame + 4 + sizeof(struct pt_regs); 69 69 70 - #ifdef CONFIG_KALLSYMS 70 + #ifndef CONFIG_KALLSYMS 71 + printk("%sFunction entered at [<%08lx>] from [<%08lx>]\n", 72 + loglvl, where, from); 73 + #elif defined CONFIG_BACKTRACE_VERBOSE 71 74 printk("%s[<%08lx>] (%ps) from [<%08lx>] (%pS)\n", 72 75 loglvl, where, (void *)where, from, (void *)from); 73 76 #else 74 - printk("%sFunction entered at [<%08lx>] from [<%08lx>]\n", 75 - loglvl, where, from); 77 + printk("%s %ps from %pS\n", loglvl, (void *)where, (void *)from); 76 78 #endif 77 79 78 80 if (in_entry_text(from) && end <= ALIGN(frame, THREAD_SIZE))
+15 -5
arch/arm/mm/fault.c
··· 17 17 #include <linux/sched/debug.h> 18 18 #include <linux/highmem.h> 19 19 #include <linux/perf_event.h> 20 + #include <linux/kfence.h> 20 21 21 22 #include <asm/system_misc.h> 22 23 #include <asm/system_info.h> ··· 100 99 { } 101 100 #endif /* CONFIG_MMU */ 102 101 102 + static inline bool is_write_fault(unsigned int fsr) 103 + { 104 + return (fsr & FSR_WRITE) && !(fsr & FSR_CM); 105 + } 106 + 103 107 static void die_kernel_fault(const char *msg, struct mm_struct *mm, 104 108 unsigned long addr, unsigned int fsr, 105 109 struct pt_regs *regs) ··· 137 131 /* 138 132 * No handler, we'll have to terminate things with extreme prejudice. 139 133 */ 140 - if (addr < PAGE_SIZE) 134 + if (addr < PAGE_SIZE) { 141 135 msg = "NULL pointer dereference"; 142 - else 136 + } else { 137 + if (kfence_handle_page_fault(addr, is_write_fault(fsr), regs)) 138 + return; 139 + 143 140 msg = "paging request"; 141 + } 144 142 145 143 die_kernel_fault(msg, mm, addr, fsr, regs); 146 144 } ··· 201 191 } 202 192 203 193 #ifdef CONFIG_MMU 204 - #define VM_FAULT_BADMAP 0x010000 205 - #define VM_FAULT_BADACCESS 0x020000 194 + #define VM_FAULT_BADMAP ((__force vm_fault_t)0x010000) 195 + #define VM_FAULT_BADACCESS ((__force vm_fault_t)0x020000) 206 196 207 197 static inline bool is_permission_fault(unsigned int fsr) 208 198 { ··· 271 261 if (user_mode(regs)) 272 262 flags |= FAULT_FLAG_USER; 273 263 274 - if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) { 264 + if (is_write_fault(fsr)) { 275 265 flags |= FAULT_FLAG_WRITE; 276 266 vm_flags = VM_WRITE; 277 267 }
+32 -10
arch/arm/mm/pageattr.c
··· 32 32 size <= range_end - start; 33 33 } 34 34 35 + /* 36 + * This function assumes that the range is mapped with PAGE_SIZE pages. 37 + */ 38 + static int __change_memory_common(unsigned long start, unsigned long size, 39 + pgprot_t set_mask, pgprot_t clear_mask) 40 + { 41 + struct page_change_data data; 42 + int ret; 43 + 44 + data.set_mask = set_mask; 45 + data.clear_mask = clear_mask; 46 + 47 + ret = apply_to_page_range(&init_mm, start, size, change_page_range, 48 + &data); 49 + 50 + flush_tlb_kernel_range(start, start + size); 51 + return ret; 52 + } 53 + 35 54 static int change_memory_common(unsigned long addr, int numpages, 36 55 pgprot_t set_mask, pgprot_t clear_mask) 37 56 { 38 57 unsigned long start = addr & PAGE_MASK; 39 58 unsigned long end = PAGE_ALIGN(addr) + numpages * PAGE_SIZE; 40 59 unsigned long size = end - start; 41 - int ret; 42 - struct page_change_data data; 43 60 44 61 WARN_ON_ONCE(start != addr); 45 62 ··· 67 50 !in_range(start, size, VMALLOC_START, VMALLOC_END)) 68 51 return -EINVAL; 69 52 70 - data.set_mask = set_mask; 71 - data.clear_mask = clear_mask; 72 - 73 - ret = apply_to_page_range(&init_mm, start, size, change_page_range, 74 - &data); 75 - 76 - flush_tlb_kernel_range(start, end); 77 - return ret; 53 + return __change_memory_common(start, size, set_mask, clear_mask); 78 54 } 79 55 80 56 int set_memory_ro(unsigned long addr, int numpages) ··· 96 86 return change_memory_common(addr, numpages, 97 87 __pgprot(0), 98 88 __pgprot(L_PTE_XN)); 89 + } 90 + 91 + int set_memory_valid(unsigned long addr, int numpages, int enable) 92 + { 93 + if (enable) 94 + return __change_memory_common(addr, PAGE_SIZE * numpages, 95 + __pgprot(L_PTE_VALID), 96 + __pgprot(0)); 97 + else 98 + return __change_memory_common(addr, PAGE_SIZE * numpages, 99 + __pgprot(0), 100 + __pgprot(L_PTE_VALID)); 99 101 }
+20
arch/arm/mm/proc-v7m.S
··· 194 194 .endm 195 195 196 196 /* 197 + * Match ARM Cortex-M55 processor. 198 + */ 199 + .type __v7m_cm55_proc_info, #object 200 + __v7m_cm55_proc_info: 201 + .long 0x410fd220 /* ARM Cortex-M55 0xD22 */ 202 + .long 0xff0ffff0 /* Mask off revision, patch release */ 203 + __v7m_proc __v7m_cm55_proc_info, __v7m_cm7_setup, hwcaps = HWCAP_EDSP, cache_fns = v7m_cache_fns, proc_fns = cm7_processor_functions 204 + .size __v7m_cm55_proc_info, . - __v7m_cm55_proc_info 205 + 206 + /* 207 + * Match ARM Cortex-M33 processor. 208 + */ 209 + .type __v7m_cm33_proc_info, #object 210 + __v7m_cm33_proc_info: 211 + .long 0x410fd210 /* ARM Cortex-M33 0xD21 */ 212 + .long 0xff0ffff0 /* Mask off revision, patch release */ 213 + __v7m_proc __v7m_cm33_proc_info, __v7m_setup, hwcaps = HWCAP_EDSP 214 + .size __v7m_cm33_proc_info, . - __v7m_cm33_proc_info 215 + 216 + /* 197 217 * Match ARM Cortex-M7 processor. 198 218 */ 199 219 .type __v7m_cm7_proc_info, #object
+28 -43
drivers/amba/bus.c
··· 21 21 #include <linux/reset.h> 22 22 #include <linux/of_irq.h> 23 23 24 - #include <asm/irq.h> 25 - 26 24 #define to_amba_driver(d) container_of(d, struct amba_driver, drv) 27 25 28 26 /* called on periphid match and class 0x9 coresight device. */ ··· 134 136 static DEVICE_ATTR_RO(name) 135 137 136 138 amba_attr_func(id, "%08x\n", dev->periphid); 137 - amba_attr_func(irq0, "%u\n", dev->irq[0]); 138 - amba_attr_func(irq1, "%u\n", dev->irq[1]); 139 139 amba_attr_func(resource, "\t%016llx\t%016llx\t%016lx\n", 140 140 (unsigned long long)dev->res.start, (unsigned long long)dev->res.end, 141 141 dev->res.flags); ··· 171 175 return retval; 172 176 } 173 177 178 + static int of_amba_device_decode_irq(struct amba_device *dev) 179 + { 180 + struct device_node *node = dev->dev.of_node; 181 + int i, irq = 0; 182 + 183 + if (IS_ENABLED(CONFIG_OF_IRQ) && node) { 184 + /* Decode the IRQs and address ranges */ 185 + for (i = 0; i < AMBA_NR_IRQS; i++) { 186 + irq = of_irq_get(node, i); 187 + if (irq < 0) { 188 + if (irq == -EPROBE_DEFER) 189 + return irq; 190 + irq = 0; 191 + } 192 + 193 + dev->irq[i] = irq; 194 + } 195 + } 196 + 197 + return 0; 198 + } 199 + 174 200 /* 175 201 * These are the device model conversion veneers; they convert the 176 202 * device model structures to our more specific structures. ··· 205 187 int ret; 206 188 207 189 do { 190 + ret = of_amba_device_decode_irq(pcdev); 191 + if (ret) 192 + break; 193 + 208 194 ret = of_clk_set_defaults(dev->of_node, false); 209 195 if (ret < 0) 210 196 break; ··· 394 372 kfree(d); 395 373 } 396 374 397 - static int of_amba_device_decode_irq(struct amba_device *dev) 398 - { 399 - struct device_node *node = dev->dev.of_node; 400 - int i, irq = 0; 401 - 402 - if (IS_ENABLED(CONFIG_OF_IRQ) && node) { 403 - /* Decode the IRQs and address ranges */ 404 - for (i = 0; i < AMBA_NR_IRQS; i++) { 405 - irq = of_irq_get(node, i); 406 - if (irq < 0) { 407 - if (irq == -EPROBE_DEFER) 408 - return irq; 409 - irq = 0; 410 - } 411 - 412 - dev->irq[i] = irq; 413 - } 414 - } 415 - 416 - return 0; 417 - } 418 - 419 375 static int amba_device_try_add(struct amba_device *dev, struct resource *parent) 420 376 { 421 377 u32 size; 422 378 void __iomem *tmp; 423 379 int i, ret; 424 - 425 - ret = of_amba_device_decode_irq(dev); 426 - if (ret) 427 - goto err_out; 428 380 429 381 ret = request_resource(parent, &dev->res); 430 382 if (ret) ··· 484 488 485 489 skip_probe: 486 490 ret = device_add(&dev->dev); 487 - if (ret) 488 - goto err_release; 489 - 490 - if (dev->irq[0]) 491 - ret = device_create_file(&dev->dev, &dev_attr_irq0); 492 - if (ret == 0 && dev->irq[1]) 493 - ret = device_create_file(&dev->dev, &dev_attr_irq1); 494 - if (ret == 0) 495 - return ret; 496 - 497 - device_unregister(&dev->dev); 498 - 499 491 err_release: 500 - release_resource(&dev->res); 492 + if (ret) 493 + release_resource(&dev->res); 501 494 err_out: 502 495 return ret; 503 496
+1 -1
scripts/remove-stale-files
··· 24 24 # with O=, make sure to remove the stale files in the output tree. Otherwise, 25 25 # the build system wrongly compiles the stale ones. 26 26 if [ -n "${building_out_of_srctree}" ]; then 27 - for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c 27 + for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c ashldi3.S bswapsdi2.S font.c lib1funcs.S hyp-stub.S 28 28 do 29 29 rm -f arch/arm/boot/compressed/${f} 30 30 done