History

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

Linus Torvalds committed 5 years ago

Commit 89fa0be2 parents 3f55f17 c7c386f11 files · +33 −18Browse files

Unified · Split

11 files
  1. arch/arm/mm/kasan_init.c +1 −1
  2. arch/arm64/include/asm/pgtable.h +9 −3
  3. arch/arm64/kernel/cpufeature.c +7 −3
  4. arch/arm64/kernel/vdso/Makefile +1 −1
  5. arch/arm64/kernel/vdso32/Makefile +1 −1
  6. arch/arm64/mm/kasan_init.c +3 −2
  7. arch/arm64/mm/mmu.c +2 −1
  8. include/linux/memblock.h +1 −1
  9. include/uapi/linux/prctl.h +1 −1
  10. mm/memblock.c +6 −3
  11. tools/include/uapi/linux/prctl.h +1 −1
arch/arm/mm/kasan_init.c+1−1
@@ -32,7 +32,7 @@ pmd_t tmp_pmd_table[PTRS_PER_PMD] __page_aligned_bss; · 31 unmodified lines
32static __init void *kasan_alloc_block(size_t size)32static __init void *kasan_alloc_block(size_t size)
33{33{
34 return memblock_alloc_try_nid(size, size, __pa(MAX_DMA_ADDRESS),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
38static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,38static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
arch/arm64/include/asm/pgtable.h+9−3
@@ -67,9 +67,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; · 66 unmodified lines
67 * page table entry, taking care of 52-bit addresses.67 * page table entry, taking care of 52-bit addresses.
68 */68 */
69#ifdef CONFIG_ARM64_PA_BITS_5269#ifdef CONFIG_ARM64_PA_BITS_52
70#define __pte_to_phys(pte) \70static inline phys_addr_t __pte_to_phys(pte_t pte)
71 ((pte_val(pte) & PTE_ADDR_LOW) | ((pte_val(pte) & PTE_ADDR_HIGH) << 36))71{
72#define __phys_to_pte_val(phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK)72 return (pte_val(pte) & PTE_ADDR_LOW) |
73 ((pte_val(pte) & PTE_ADDR_HIGH) << 36);
74}
75static inline pteval_t __phys_to_pte_val(phys_addr_t phys)
76{
77 return (phys | (phys >> 36)) & PTE_ADDR_MASK;
78}
73#else79#else
74#define __pte_to_phys(pte) (pte_val(pte) & PTE_ADDR_MASK)80#define __pte_to_phys(pte) (pte_val(pte) & PTE_ADDR_MASK)
75#define __phys_to_pte_val(phys) (phys)81#define __phys_to_pte_val(phys) (phys)
arch/arm64/kernel/cpufeature.c+7−3
@@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = { · 572 unmodified lines
573 ARM64_FTR_END,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 .sys_id = id, \577 .sys_id = id, \
578 .reg = &(struct arm64_ftr_reg){ \578 .reg = &(struct arm64_ftr_reg){ \
579 .name = #id, \579 .name = id_str, \
580 .override = (ovr), \580 .override = (ovr), \
581 .ftr_bits = &((table)[0]), \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
586struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;590struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;
587struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;591struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;
arch/arm64/kernel/vdso/Makefile+1−1
@@ -23,7 +23,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti · 22 unmodified lines
23# potential future proofing if we end up with internal calls to the exported23# potential future proofing if we end up with internal calls to the exported
24# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so24# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
25# preparation in build-time C")).25# preparation in build-time C")).
26ldflags-y := -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv \26ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \
27 -Bsymbolic --build-id=sha1 -n $(btildflags-y) -T27 -Bsymbolic --build-id=sha1 -n $(btildflags-y) -T
28 28
29ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x1829ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18
arch/arm64/kernel/vdso32/Makefile+1−1
@@ -102,7 +102,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__ · 101 unmodified lines
102# From arm vDSO Makefile102# From arm vDSO Makefile
103VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1103VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
104VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096104VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
105VDSO_LDFLAGS += -nostdlib -shared --hash-style=sysv --build-id=sha1105VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
106 106
107 107
108# Borrow vdsomunge.c from the arm vDSO108# Borrow vdsomunge.c from the arm vDSO
arch/arm64/mm/kasan_init.c+3−2
@@ -36,7 +36,7 @@ static phys_addr_t __init kasan_alloc_zeroed_page(int node) · 35 unmodified lines
36{36{
37 void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,37 void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,
38 __pa(MAX_DMA_ADDRESS),38 __pa(MAX_DMA_ADDRESS),
39 MEMBLOCK_ALLOC_KASAN, node);39 MEMBLOCK_ALLOC_NOLEAKTRACE, node);
40 if (!p)40 if (!p)
41 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",41 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
42 __func__, PAGE_SIZE, PAGE_SIZE, node,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 void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE,50 void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE,
51 __pa(MAX_DMA_ADDRESS),51 __pa(MAX_DMA_ADDRESS),
52 MEMBLOCK_ALLOC_KASAN, node);52 MEMBLOCK_ALLOC_NOLEAKTRACE,
53 node);
53 if (!p)54 if (!p)
54 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",55 panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
55 __func__, PAGE_SIZE, PAGE_SIZE, node,56 __func__, PAGE_SIZE, PAGE_SIZE, node,
arch/arm64/mm/mmu.c+2−1
@@ -96,7 +96,8 @@ static phys_addr_t __init early_pgtable_alloc(int shift) · 95 unmodified lines
96 phys_addr_t phys;96 phys_addr_t phys;
97 void *ptr;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 if (!phys)101 if (!phys)
101 panic("Failed to allocate page table page\n");102 panic("Failed to allocate page table page\n");
102 103
include/linux/memblock.h+1−1
@@ -389,7 +389,7 @@ static inline int memblock_get_region_node(const struct memblock_region *r) · 388 unmodified lines
389/* Flags for memblock allocation APIs */389/* Flags for memblock allocation APIs */
390#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)390#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
391#define MEMBLOCK_ALLOC_ACCESSIBLE 0391#define MEMBLOCK_ALLOC_ACCESSIBLE 0
392#define MEMBLOCK_ALLOC_KASAN 1392#define MEMBLOCK_ALLOC_NOLEAKTRACE 1
393 393
394/* We are using top down, so it is safe to use 0 here */394/* We are using top down, so it is safe to use 0 here */
395#define MEMBLOCK_LOW_LIMIT 0395#define MEMBLOCK_LOW_LIMIT 0
include/uapi/linux/prctl.h+1−1
@@ -235,7 +235,7 @@ struct prctl_mm_map { · 234 unmodified lines
235#define PR_GET_TAGGED_ADDR_CTRL 56235#define PR_GET_TAGGED_ADDR_CTRL 56
236# define PR_TAGGED_ADDR_ENABLE (1UL << 0)236# define PR_TAGGED_ADDR_ENABLE (1UL << 0)
237/* MTE tag check fault modes */237/* MTE tag check fault modes */
238# define PR_MTE_TCF_NONE 0238# define PR_MTE_TCF_NONE 0UL
239# define PR_MTE_TCF_SYNC (1UL << 1)239# define PR_MTE_TCF_SYNC (1UL << 1)
240# define PR_MTE_TCF_ASYNC (1UL << 2)240# define PR_MTE_TCF_ASYNC (1UL << 2)
241# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)241# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)
mm/memblock.c+6−3
@@ -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 /* pump up @end */288 /* pump up @end */
289 if (end == MEMBLOCK_ALLOC_ACCESSIBLE ||289 if (end == MEMBLOCK_ALLOC_ACCESSIBLE ||
290 end == MEMBLOCK_ALLOC_KASAN)290 end == MEMBLOCK_ALLOC_NOLEAKTRACE)
291 end = memblock.current_limit;291 end = memblock.current_limit;
292 292
293 /* avoid allocating the first page */293 /* avoid allocating the first page */
@@ -1387,8 +1387,11 @@ again: · 1093 unmodified lines
1387 return 0;1387 return 0;
1388 1388
1389done:1389done:
1390 /* Skip kmemleak for kasan_init() due to high volume. */1390 /*
1391 if (end != MEMBLOCK_ALLOC_KASAN)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 * The min_count is set to 0 so that memblock allocated1396 * The min_count is set to 0 so that memblock allocated
1394 * blocks are never reported as leaks. This is because many1397 * blocks are never reported as leaks. This is because many
tools/include/uapi/linux/prctl.h+1−1
@@ -235,7 +235,7 @@ struct prctl_mm_map { · 234 unmodified lines
235#define PR_GET_TAGGED_ADDR_CTRL 56235#define PR_GET_TAGGED_ADDR_CTRL 56
236# define PR_TAGGED_ADDR_ENABLE (1UL << 0)236# define PR_TAGGED_ADDR_ENABLE (1UL << 0)
237/* MTE tag check fault modes */237/* MTE tag check fault modes */
238# define PR_MTE_TCF_NONE 0238# define PR_MTE_TCF_NONE 0UL
239# define PR_MTE_TCF_SYNC (1UL << 1)239# define PR_MTE_TCF_SYNC (1UL << 1)
240# define PR_MTE_TCF_ASYNC (1UL << 2)240# define PR_MTE_TCF_ASYNC (1UL << 2)
241# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)241# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)