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

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:

- Fix double-evaluation of 'pte' macro argument when using 52-bit PAs

- Fix signedness of some MTE prctl PR_* constants

- Fix kmemleak memory usage by skipping early pgtable allocations

- Fix printing of CPU feature register strings

- Remove redundant -nostdlib linker flag for vDSO binaries

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: pgtable: make __pte_to_phys/__phys_to_pte_val inline functions
arm64: Track no early_pgtable_alloc() for kmemleak
arm64: mte: change PR_MTE_TCF_NONE back into an unsigned long
arm64: vdso: remove -nostdlib compiler flag
arm64: arm64_ftr_reg->name may not be a human-readable string

+33 -18
+1 -1
arch/arm/mm/kasan_init.c
··· 32 32 static __init void *kasan_alloc_block(size_t size) 33 33 { 34 34 return memblock_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS), 35 - MEMBLOCK_ALLOC_KASAN, NUMA_NO_NODE); 35 + MEMBLOCK_ALLOC_NOLEAKTRACE, NUMA_NO_NODE); 36 36 } 37 37 38 38 static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
+9 -3
arch/arm64/include/asm/pgtable.h
··· 67 67 * page table entry, taking care of 52-bit addresses. 68 68 */ 69 69 #ifdef CONFIG_ARM64_PA_BITS_52 70 - #define __pte_to_phys(pte) \ 71 - ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36)) 72 - #define __phys_to_pte_val(phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK) 70 + static inline phys_addr_t __pte_to_phys(pte_t pte) 71 + { 72 + return (pte_val(pte) & PTE_ADDR_LOW) | 73 + ((pte_val(pte) & PTE_ADDR_HIGH) << 36); 74 + } 75 + static inline pteval_t __phys_to_pte_val(phys_addr_t phys) 76 + { 77 + return (phys | (phys >> 36)) & PTE_ADDR_MASK; 78 + } 73 79 #else 74 80 #define __pte_to_phys(pte) (pte_val(pte) & PTE_ADDR_MASK) 75 81 #define __phys_to_pte_val(phys) (phys)
+7 -3
arch/arm64/kernel/cpufeature.c
··· 573 573 ARM64_FTR_END, 574 574 }; 575 575 576 - #define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \ 576 + #define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \ 577 577 .sys_id = id, \ 578 578 .reg = &(struct arm64_ftr_reg){ \ 579 - .name = #id, \ 579 + .name = id_str, \ 580 580 .override = (ovr), \ 581 581 .ftr_bits = &((table)[0]), \ 582 582 }} 583 583 584 - #define ARM64_FTR_REG(id, table) ARM64_FTR_REG_OVERRIDE(id, table, &no_override) 584 + #define ARM64_FTR_REG_OVERRIDE(id, table, ovr) \ 585 + __ARM64_FTR_REG_OVERRIDE(#id, id, table, ovr) 586 + 587 + #define ARM64_FTR_REG(id, table) \ 588 + __ARM64_FTR_REG_OVERRIDE(#id, id, table, &no_override) 585 589 586 590 struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override; 587 591 struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;
+1 -1
arch/arm64/kernel/vdso/Makefile
··· 23 23 # potential future proofing if we end up with internal calls to the exported 24 24 # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so 25 25 # preparation in build-time C")). 26 - ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \ 26 + ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \ 27 27 -Bsymbolic --build-id=sha1 -n $(btildflags-y) -T 28 28 29 29 ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
+1 -1
arch/arm64/kernel/vdso32/Makefile
··· 102 102 # From arm vDSO Makefile 103 103 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1 104 104 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096 105 - VDSO_LDFLAGS += -nostdlib -shared --hash-style=sysv --build-id=sha1 105 + VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1 106 106 107 107 108 108 # Borrow vdsomunge.c from the arm vDSO
+3 -2
arch/arm64/mm/kasan_init.c
··· 36 36 { 37 37 void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE, 38 38 __pa(MAX_DMA_ADDRESS), 39 - MEMBLOCK_ALLOC_KASAN, node); 39 + MEMBLOCK_ALLOC_NOLEAKTRACE, node); 40 40 if (!p) 41 41 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n", 42 42 __func__, PAGE_SIZE, PAGE_SIZE, node, ··· 49 49 { 50 50 void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE, 51 51 __pa(MAX_DMA_ADDRESS), 52 - MEMBLOCK_ALLOC_KASAN, node); 52 + MEMBLOCK_ALLOC_NOLEAKTRACE, 53 + node); 53 54 if (!p) 54 55 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n", 55 56 __func__, PAGE_SIZE, PAGE_SIZE, node,
+2 -1
arch/arm64/mm/mmu.c
··· 96 96 phys_addr_t phys; 97 97 void *ptr; 98 98 99 - phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE); 99 + phys = memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE, 0, 100 + MEMBLOCK_ALLOC_NOLEAKTRACE); 100 101 if (!phys) 101 102 panic("Failed to allocate page table page\n"); 102 103
+1 -1
include/linux/memblock.h
··· 389 389 /* Flags for memblock allocation APIs */ 390 390 #define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 391 391 #define MEMBLOCK_ALLOC_ACCESSIBLE 0 392 - #define MEMBLOCK_ALLOC_KASAN 1 392 + #define MEMBLOCK_ALLOC_NOLEAKTRACE 1 393 393 394 394 /* We are using top down, so it is safe to use 0 here */ 395 395 #define MEMBLOCK_LOW_LIMIT 0
+1 -1
include/uapi/linux/prctl.h
··· 235 235 #define PR_GET_TAGGED_ADDR_CTRL 56 236 236 # define PR_TAGGED_ADDR_ENABLE (1UL << 0) 237 237 /* MTE tag check fault modes */ 238 - # define PR_MTE_TCF_NONE 0 238 + # define PR_MTE_TCF_NONE 0UL 239 239 # define PR_MTE_TCF_SYNC (1UL << 1) 240 240 # define PR_MTE_TCF_ASYNC (1UL << 2) 241 241 # define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)
+6 -3
mm/memblock.c
··· 287 287 { 288 288 /* pump up @end */ 289 289 if (end == MEMBLOCK_ALLOC_ACCESSIBLE || 290 - end == MEMBLOCK_ALLOC_KASAN) 290 + end == MEMBLOCK_ALLOC_NOLEAKTRACE) 291 291 end = memblock.current_limit; 292 292 293 293 /* avoid allocating the first page */ ··· 1387 1387 return 0; 1388 1388 1389 1389 done: 1390 - /* Skip kmemleak for kasan_init() due to high volume. */ 1391 - if (end != MEMBLOCK_ALLOC_KASAN) 1390 + /* 1391 + * Skip kmemleak for those places like kasan_init() and 1392 + * early_pgtable_alloc() due to high volume. 1393 + */ 1394 + if (end != MEMBLOCK_ALLOC_NOLEAKTRACE) 1392 1395 /* 1393 1396 * The min_count is set to 0 so that memblock allocated 1394 1397 * blocks are never reported as leaks. This is because many
+1 -1
tools/include/uapi/linux/prctl.h
··· 235 235 #define PR_GET_TAGGED_ADDR_CTRL 56 236 236 # define PR_TAGGED_ADDR_ENABLE (1UL << 0) 237 237 /* MTE tag check fault modes */ 238 - # define PR_MTE_TCF_NONE 0 238 + # define PR_MTE_TCF_NONE 0UL 239 239 # define PR_MTE_TCF_SYNC (1UL << 1) 240 240 # define PR_MTE_TCF_ASYNC (1UL << 2) 241 241 # define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)