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 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
"The main thing here is reviving hugetlb support using contiguous ptes,
which we ended up reverting at the last minute in 4.5 pending a fix
which went into the core mm/ code during the recent merge window.

- Revert a previous revert and get hugetlb going with contiguous hints
- Wire up missing compat syscalls
- Enable CONFIG_SET_MODULE_RONX by default
- Add missing line to our compat /proc/cpuinfo output
- Clarify levels in our page table dumps
- Fix booting with RANDOMIZE_TEXT_OFFSET enabled
- Misc fixes to the ARM CPU PMU driver (refcounting, probe failure)
- Remove some dead code and update a comment"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: fix alignment when RANDOMIZE_TEXT_OFFSET is enabled
arm64: move {PAGE,CONT}_SHIFT into Kconfig
arm64: mm: dump: log span level
arm64: update stale PAGE_OFFSET comment
drivers/perf: arm_pmu: Avoid leaking pmu->irq_affinity on error
drivers/perf: arm_pmu: Defer the setting of __oprofile_cpu_pmu
drivers/perf: arm_pmu: Fix reference count of a device_node in of_pmu_irq_cfg
arm64: report CPU number in bad_mode
arm64: unistd32.h: wire up missing syscalls for compat tasks
arm64: Provide "model name" in /proc/cpuinfo for PER_LINUX32 tasks
arm64: enable CONFIG_SET_MODULE_RONX by default
arm64: Remove orphaned __addr_ok() definition
Revert "arm64: hugetlb: partial revert of 66b3923a1a0f"

+79 -51
+12
arch/arm64/Kconfig
··· 113 113 config MMU 114 114 def_bool y 115 115 116 + config ARM64_PAGE_SHIFT 117 + int 118 + default 16 if ARM64_64K_PAGES 119 + default 14 if ARM64_16K_PAGES 120 + default 12 121 + 122 + config ARM64_CONT_SHIFT 123 + int 124 + default 5 if ARM64_64K_PAGES 125 + default 7 if ARM64_16K_PAGES 126 + default 4 127 + 116 128 config ARCH_MMAP_RND_BITS_MIN 117 129 default 14 if ARM64_64K_PAGES 118 130 default 16 if ARM64_16K_PAGES
+13 -12
arch/arm64/Kconfig.debug
··· 12 12 who are working in architecture specific areas of the kernel. 13 13 It is probably not a good idea to enable this feature in a production 14 14 kernel. 15 - If in doubt, say "N" 15 + 16 + If in doubt, say N. 16 17 17 18 config PID_IN_CONTEXTIDR 18 19 bool "Write the current PID to the CONTEXTIDR register" ··· 39 38 value. 40 39 41 40 config DEBUG_SET_MODULE_RONX 42 - bool "Set loadable kernel module data as NX and text as RO" 43 - depends on MODULES 44 - help 45 - This option helps catch unintended modifications to loadable 46 - kernel module's text and read-only data. It also prevents execution 47 - of module data. Such protection may interfere with run-time code 48 - patching and dynamic kernel tracing - and they might also protect 49 - against certain classes of kernel exploits. 50 - If in doubt, say "N". 41 + bool "Set loadable kernel module data as NX and text as RO" 42 + depends on MODULES 43 + default y 44 + help 45 + Is this is set, kernel module text and rodata will be made read-only. 46 + This is to help catch accidental or malicious attempts to change the 47 + kernel's executable code. 48 + 49 + If in doubt, say Y. 51 50 52 51 config DEBUG_RODATA 53 52 bool "Make kernel text and rodata read-only" ··· 57 56 is to help catch accidental or malicious attempts to change the 58 57 kernel's executable code. 59 58 60 - If in doubt, say Y 59 + If in doubt, say Y. 61 60 62 61 config DEBUG_ALIGN_RODATA 63 62 depends on DEBUG_RODATA ··· 70 69 alignment and potentially wasted space. Turn on this option if 71 70 performance is more important than memory pressure. 72 71 73 - If in doubt, say N 72 + If in doubt, say N. 74 73 75 74 source "drivers/hwtracing/coresight/Kconfig" 76 75
+3 -1
arch/arm64/Makefile
··· 60 60 61 61 # The byte offset of the kernel image in RAM from the start of RAM. 62 62 ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y) 63 - TEXT_OFFSET := $(shell awk 'BEGIN {srand(); printf "0x%03x000\n", int(512 * rand())}') 63 + TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \ 64 + int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \ 65 + rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}") 64 66 else 65 67 TEXT_OFFSET := 0x00080000 66 68 endif
+2 -2
arch/arm64/include/asm/elf.h
··· 160 160 #define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12)) 161 161 #endif 162 162 163 - #ifdef CONFIG_COMPAT 164 - 165 163 #ifdef __AARCH64EB__ 166 164 #define COMPAT_ELF_PLATFORM ("v8b") 167 165 #else 168 166 #define COMPAT_ELF_PLATFORM ("v8l") 169 167 #endif 168 + 169 + #ifdef CONFIG_COMPAT 170 170 171 171 #define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3) 172 172
+2 -1
arch/arm64/include/asm/memory.h
··· 55 55 #define VMEMMAP_SIZE (UL(1) << (VA_BITS - PAGE_SHIFT - 1 + STRUCT_PAGE_MAX_SHIFT)) 56 56 57 57 /* 58 - * PAGE_OFFSET - the virtual address of the start of the kernel image (top 58 + * PAGE_OFFSET - the virtual address of the start of the linear map (top 59 59 * (VA_BITS - 1)) 60 + * KIMAGE_VADDR - the virtual address of the start of the kernel image 60 61 * VA_BITS - the maximum number of bits for virtual addresses. 61 62 * VA_START - the first kernel virtual address. 62 63 * TASK_SIZE - the maximum size of a user space task.
+2 -10
arch/arm64/include/asm/page.h
··· 23 23 24 24 /* PAGE_SHIFT determines the page size */ 25 25 /* CONT_SHIFT determines the number of pages which can be tracked together */ 26 - #ifdef CONFIG_ARM64_64K_PAGES 27 - #define PAGE_SHIFT 16 28 - #define CONT_SHIFT 5 29 - #elif defined(CONFIG_ARM64_16K_PAGES) 30 - #define PAGE_SHIFT 14 31 - #define CONT_SHIFT 7 32 - #else 33 - #define PAGE_SHIFT 12 34 - #define CONT_SHIFT 4 35 - #endif 26 + #define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT 27 + #define CONT_SHIFT CONFIG_ARM64_CONT_SHIFT 36 28 #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 37 29 #define PAGE_MASK (~(PAGE_SIZE-1)) 38 30
-13
arch/arm64/include/asm/uaccess.h
··· 81 81 #define segment_eq(a, b) ((a) == (b)) 82 82 83 83 /* 84 - * Return 1 if addr < current->addr_limit, 0 otherwise. 85 - */ 86 - #define __addr_ok(addr) \ 87 - ({ \ 88 - unsigned long flag; \ 89 - asm("cmp %1, %0; cset %0, lo" \ 90 - : "=&r" (flag) \ 91 - : "r" (addr), "0" (current_thread_info()->addr_limit) \ 92 - : "cc"); \ 93 - flag; \ 94 - }) 95 - 96 - /* 97 84 * Test whether a block of memory is a valid user space address. 98 85 * Returns 1 if the range is valid, 0 otherwise. 99 86 *
+1 -1
arch/arm64/include/asm/unistd.h
··· 44 44 #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) 45 45 #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) 46 46 47 - #define __NR_compat_syscalls 390 47 + #define __NR_compat_syscalls 394 48 48 #endif 49 49 50 50 #define __ARCH_WANT_SYS_CLONE
+8
arch/arm64/include/asm/unistd32.h
··· 801 801 __SYSCALL(__NR_userfaultfd, sys_userfaultfd) 802 802 #define __NR_membarrier 389 803 803 __SYSCALL(__NR_membarrier, sys_membarrier) 804 + #define __NR_mlock2 390 805 + __SYSCALL(__NR_mlock2, sys_mlock2) 806 + #define __NR_copy_file_range 391 807 + __SYSCALL(__NR_copy_file_range, sys_copy_file_range) 808 + #define __NR_preadv2 392 809 + __SYSCALL(__NR_preadv2, compat_sys_preadv2) 810 + #define __NR_pwritev2 393 811 + __SYSCALL(__NR_pwritev2, compat_sys_pwritev2) 804 812 805 813 /* 806 814 * Please add new compat syscalls above this comment and update
+7 -1
arch/arm64/kernel/cpuinfo.c
··· 22 22 23 23 #include <linux/bitops.h> 24 24 #include <linux/bug.h> 25 + #include <linux/compat.h> 26 + #include <linux/elf.h> 25 27 #include <linux/init.h> 26 28 #include <linux/kernel.h> 27 29 #include <linux/personality.h> ··· 106 104 static int c_show(struct seq_file *m, void *v) 107 105 { 108 106 int i, j; 107 + bool compat = personality(current->personality) == PER_LINUX32; 109 108 110 109 for_each_online_cpu(i) { 111 110 struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); ··· 118 115 * "processor". Give glibc what it expects. 119 116 */ 120 117 seq_printf(m, "processor\t: %d\n", i); 118 + if (compat) 119 + seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", 120 + MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); 121 121 122 122 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 123 123 loops_per_jiffy / (500000UL/HZ), ··· 133 127 * software which does already (at least for 32-bit). 134 128 */ 135 129 seq_puts(m, "Features\t:"); 136 - if (personality(current->personality) == PER_LINUX32) { 130 + if (compat) { 137 131 #ifdef CONFIG_COMPAT 138 132 for (j = 0; compat_hwcap_str[j]; j++) 139 133 if (compat_elf_hwcap & (1 << j))
+3 -2
arch/arm64/kernel/traps.c
··· 477 477 void __user *pc = (void __user *)instruction_pointer(regs); 478 478 console_verbose(); 479 479 480 - pr_crit("Bad mode in %s handler detected, code 0x%08x -- %s\n", 481 - handler[reason], esr, esr_get_class_string(esr)); 480 + pr_crit("Bad mode in %s handler detected on CPU%d, code 0x%08x -- %s\n", 481 + handler[reason], smp_processor_id(), esr, 482 + esr_get_class_string(esr)); 482 483 __show_regs(regs); 483 484 484 485 info.si_signo = SIGILL;
+7 -1
arch/arm64/mm/dump.c
··· 150 150 151 151 struct pg_level { 152 152 const struct prot_bits *bits; 153 + const char *name; 153 154 size_t num; 154 155 u64 mask; 155 156 }; ··· 158 157 static struct pg_level pg_level[] = { 159 158 { 160 159 }, { /* pgd */ 160 + .name = "PGD", 161 161 .bits = pte_bits, 162 162 .num = ARRAY_SIZE(pte_bits), 163 163 }, { /* pud */ 164 + .name = (CONFIG_PGTABLE_LEVELS > 3) ? "PUD" : "PGD", 164 165 .bits = pte_bits, 165 166 .num = ARRAY_SIZE(pte_bits), 166 167 }, { /* pmd */ 168 + .name = (CONFIG_PGTABLE_LEVELS > 2) ? "PMD" : "PGD", 167 169 .bits = pte_bits, 168 170 .num = ARRAY_SIZE(pte_bits), 169 171 }, { /* pte */ 172 + .name = "PTE", 170 173 .bits = pte_bits, 171 174 .num = ARRAY_SIZE(pte_bits), 172 175 }, ··· 219 214 delta >>= 10; 220 215 unit++; 221 216 } 222 - seq_printf(st->seq, "%9lu%c", delta, *unit); 217 + seq_printf(st->seq, "%9lu%c %s", delta, *unit, 218 + pg_level[st->level].name); 223 219 if (pg_level[st->level].bits) 224 220 dump_prot(st, pg_level[st->level].bits, 225 221 pg_level[st->level].num);
+14
arch/arm64/mm/hugetlbpage.c
··· 306 306 hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT); 307 307 } else if (ps == PUD_SIZE) { 308 308 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); 309 + } else if (ps == (PAGE_SIZE * CONT_PTES)) { 310 + hugetlb_add_hstate(CONT_PTE_SHIFT); 311 + } else if (ps == (PMD_SIZE * CONT_PMDS)) { 312 + hugetlb_add_hstate((PMD_SHIFT + CONT_PMD_SHIFT) - PAGE_SHIFT); 309 313 } else { 310 314 hugetlb_bad_size(); 311 315 pr_err("hugepagesz: Unsupported page size %lu K\n", ps >> 10); ··· 318 314 return 1; 319 315 } 320 316 __setup("hugepagesz=", setup_hugepagesz); 317 + 318 + #ifdef CONFIG_ARM64_64K_PAGES 319 + static __init int add_default_hugepagesz(void) 320 + { 321 + if (size_to_hstate(CONT_PTES * PAGE_SIZE) == NULL) 322 + hugetlb_add_hstate(CONT_PMD_SHIFT); 323 + return 0; 324 + } 325 + arch_initcall(add_default_hugepagesz); 326 + #endif
+5 -7
drivers/perf/arm_pmu.c
··· 950 950 951 951 /* For SPIs, we need to track the affinity per IRQ */ 952 952 if (using_spi) { 953 - if (i >= pdev->num_resources) { 954 - of_node_put(dn); 953 + if (i >= pdev->num_resources) 955 954 break; 956 - } 957 955 958 956 irqs[i] = cpu; 959 957 } 960 958 961 959 /* Keep track of the CPUs containing this PMU type */ 962 960 cpumask_set_cpu(cpu, &pmu->supported_cpus); 963 - of_node_put(dn); 964 961 i++; 965 962 } while (1); 966 963 ··· 991 994 } 992 995 993 996 armpmu_init(pmu); 994 - 995 - if (!__oprofile_cpu_pmu) 996 - __oprofile_cpu_pmu = pmu; 997 997 998 998 pmu->plat_device = pdev; 999 999 ··· 1027 1033 if (ret) 1028 1034 goto out_destroy; 1029 1035 1036 + if (!__oprofile_cpu_pmu) 1037 + __oprofile_cpu_pmu = pmu; 1038 + 1030 1039 pr_info("enabled with %s PMU driver, %d counters available\n", 1031 1040 pmu->name, pmu->num_events); 1032 1041 ··· 1040 1043 out_free: 1041 1044 pr_info("%s: failed to register PMU devices!\n", 1042 1045 of_node_full_name(node)); 1046 + kfree(pmu->irq_affinity); 1043 1047 kfree(pmu); 1044 1048 return ret; 1045 1049 }