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
Unified · Split
| @@ -32,7 +32,7 @@ pmd_t tmp_pmd_table[PTRS_PER_PMD] __page_aligned_bss; · 31 unmodified lines | ||
| 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, |
| @@ -67,9 +67,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; · 66 unmodified lines | ||
| 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) |
| @@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = { · 572 unmodified lines | ||
| 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; |
| @@ -23,7 +23,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti · 22 unmodified lines | ||
| 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 |
| @@ -102,7 +102,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__ · 101 unmodified lines | ||
| 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 |
| @@ -36,7 +36,7 @@ static phys_addr_t __init kasan_alloc_zeroed_page(int node) · 35 unmodified lines | ||
| 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,7 +49,8 @@ static phys_addr_t __init kasan_alloc_raw_page(int node) · 6 unmodified lines | ||
| 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, |
| @@ -96,7 +96,8 @@ static phys_addr_t __init early_pgtable_alloc(int shift) · 95 unmodified lines | ||
| 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 | |
| @@ -389,7 +389,7 @@ static inline int memblock_get_region_node(const struct memblock_region *r) · 388 unmodified lines | ||
| 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 |
| @@ -235,7 +235,7 @@ struct prctl_mm_map { · 234 unmodified lines | ||
| 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) |
| @@ -287,7 +287,7 @@ static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, · 286 unmodified lines | ||
| 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,8 +1387,11 @@ again: · 1093 unmodified lines | ||
| 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 |
| @@ -235,7 +235,7 @@ struct prctl_mm_map { · 234 unmodified lines | ||
| 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) |