Skip to content

Commit 89fa0be

Browse files
committed
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
2 parents 3f55f17 + c7c386f commit 89fa0be

File tree

11 files changed

+33
-18
lines changed

11 files changed

+33
-18
lines changed

arch/arm/mm/kasan_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pmd_t tmp_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
3232
static __init void *kasan_alloc_block(size_t size)
3333
{
3434
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);
3636
}
3737

3838
static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,

arch/arm64/include/asm/pgtable.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
6767
* page table entry, taking care of 52-bit addresses.
6868
*/
6969
#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+
}
7379
#else
7480
#define __pte_to_phys(pte) (pte_val(pte) & PTE_ADDR_MASK)
7581
#define __phys_to_pte_val(phys) (phys)

arch/arm64/kernel/cpufeature.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,19 @@ static const struct arm64_ftr_bits ftr_raz[] = {
573573
ARM64_FTR_END,
574574
};
575575

576-
#define ARM64_FTR_REG_OVERRIDE(id, table, ovr) { \
576+
#define __ARM64_FTR_REG_OVERRIDE(id_str, id, table, ovr) { \
577577
.sys_id = id, \
578578
.reg = &(struct arm64_ftr_reg){ \
579-
.name = #id, \
579+
.name = id_str, \
580580
.override = (ovr), \
581581
.ftr_bits = &((table)[0]), \
582582
}}
583583

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)
585589

586590
struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;
587591
struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;

arch/arm64/kernel/vdso/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
2323
# potential future proofing if we end up with internal calls to the exported
2424
# routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
2525
# 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 \
2727
-Bsymbolic --build-id=sha1 -n $(btildflags-y) -T
2828

2929
ccflags-y := -fno-common -fno-builtin -fno-stack-protector -ffixed-x18

arch/arm64/kernel/vdso32/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
102102
# From arm vDSO Makefile
103103
VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
104104
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
106106

107107

108108
# Borrow vdsomunge.c from the arm vDSO

arch/arm64/mm/kasan_init.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static phys_addr_t __init kasan_alloc_zeroed_page(int node)
3636
{
3737
void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,
3838
__pa(MAX_DMA_ADDRESS),
39-
MEMBLOCK_ALLOC_KASAN, node);
39+
MEMBLOCK_ALLOC_NOLEAKTRACE, node);
4040
if (!p)
4141
panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
4242
__func__, PAGE_SIZE, PAGE_SIZE, node,
@@ -49,7 +49,8 @@ static phys_addr_t __init kasan_alloc_raw_page(int node)
4949
{
5050
void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE,
5151
__pa(MAX_DMA_ADDRESS),
52-
MEMBLOCK_ALLOC_KASAN, node);
52+
MEMBLOCK_ALLOC_NOLEAKTRACE,
53+
node);
5354
if (!p)
5455
panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
5556
__func__, PAGE_SIZE, PAGE_SIZE, node,

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ static phys_addr_t __init early_pgtable_alloc(int shift)
9696
phys_addr_t phys;
9797
void *ptr;
9898

99-
phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
99+
phys = memblock_phys_alloc_range(PAGE_SIZE, PAGE_SIZE, 0,
100+
MEMBLOCK_ALLOC_NOLEAKTRACE);
100101
if (!phys)
101102
panic("Failed to allocate page table page\n");
102103

include/linux/memblock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
389389
/* Flags for memblock allocation APIs */
390390
#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
391391
#define MEMBLOCK_ALLOC_ACCESSIBLE 0
392-
#define MEMBLOCK_ALLOC_KASAN 1
392+
#define MEMBLOCK_ALLOC_NOLEAKTRACE 1
393393

394394
/* We are using top down, so it is safe to use 0 here */
395395
#define MEMBLOCK_LOW_LIMIT 0

include/uapi/linux/prctl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ struct prctl_mm_map {
235235
#define PR_GET_TAGGED_ADDR_CTRL 56
236236
# define PR_TAGGED_ADDR_ENABLE (1UL << 0)
237237
/* MTE tag check fault modes */
238-
# define PR_MTE_TCF_NONE 0
238+
# define PR_MTE_TCF_NONE 0UL
239239
# define PR_MTE_TCF_SYNC (1UL << 1)
240240
# define PR_MTE_TCF_ASYNC (1UL << 2)
241241
# define PR_MTE_TCF_MASK (PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC)

mm/memblock.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size,
287287
{
288288
/* pump up @end */
289289
if (end == MEMBLOCK_ALLOC_ACCESSIBLE ||
290-
end == MEMBLOCK_ALLOC_KASAN)
290+
end == MEMBLOCK_ALLOC_NOLEAKTRACE)
291291
end = memblock.current_limit;
292292

293293
/* avoid allocating the first page */
@@ -1387,8 +1387,11 @@ phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
13871387
return 0;
13881388

13891389
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)
13921395
/*
13931396
* The min_count is set to 0 so that memblock allocated
13941397
* blocks are never reported as leaks. This is because many

0 commit comments

Comments
 (0)