Skip to content

Commit 39ce439

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: - In copy_highpage(), only reset the tag of the destination pointer if KASAN_HW_TAGS is enabled so that user-space MTE does not interfere with KASAN_SW_TAGS (which relies on top-byte-ignore). - Remove warning if SME is detected without SVE, the kernel can cope with such configuration (though none in the field currently). - In cfi_handler(), pass the ESR_EL1 value to die() for consistency with other die() callers. - Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP on arm64 since the pte manipulation from the generic vmemmap_remap_pte() does not follow the required ARM break-before-make sequence (clear the pte, flush the TLBs, set the new pte). It may be re-enabled once this sequence is sorted. - Fix possible memory leak in the arm64 ACPI code if the SMCCC version and conduit checks fail. - Forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE since gcc ignores -falign-functions=N with -Os. - Don't pretend KASLR is enabled if offset < MIN_KIMG_ALIGN as no randomisation would actually take place. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: kaslr: don't pretend KASLR is enabled if offset < MIN_KIMG_ALIGN arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE arm64: acpi: Fix possible memory leak of ffh_ctxt arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP arm64: pass ESR_ELx to die() of cfi_handler arm64/fpsimd: Remove warning for SME without SVE arm64: Reset KASAN tag in copy_highpage with HW tags only
2 parents a9a01e1 + 010338d commit 39ce439

File tree

8 files changed

+22
-13
lines changed

8 files changed

+22
-13
lines changed

arch/arm64/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ config ARM64
100100
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
101101
select ARCH_WANT_FRAME_POINTERS
102102
select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
103-
select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
104103
select ARCH_WANT_LD_ORPHAN_WARN
105104
select ARCH_WANTS_NO_INSTR
106105
select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
@@ -187,7 +186,8 @@ config ARM64
187186
select HAVE_DMA_CONTIGUOUS
188187
select HAVE_DYNAMIC_FTRACE
189188
select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \
190-
if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
189+
if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \
190+
!CC_OPTIMIZE_FOR_SIZE)
191191
select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
192192
if DYNAMIC_FTRACE_WITH_ARGS
193193
select HAVE_EFFICIENT_UNALIGNED_ACCESS

arch/arm64/include/asm/memory.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
#include <linux/compiler.h>
181181
#include <linux/mmdebug.h>
182182
#include <linux/types.h>
183+
#include <asm/boot.h>
183184
#include <asm/bug.h>
184185

185186
#if VA_BITS > 48
@@ -203,6 +204,16 @@ static inline unsigned long kaslr_offset(void)
203204
return kimage_vaddr - KIMAGE_VADDR;
204205
}
205206

207+
static inline bool kaslr_enabled(void)
208+
{
209+
/*
210+
* The KASLR offset modulo MIN_KIMG_ALIGN is taken from the physical
211+
* placement of the image rather than from the seed, so a displacement
212+
* of less than MIN_KIMG_ALIGN means that no seed was provided.
213+
*/
214+
return kaslr_offset() >= MIN_KIMG_ALIGN;
215+
}
216+
206217
/*
207218
* Allow all memory at the discovery stage. We will clip it later.
208219
*/

arch/arm64/kernel/acpi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,6 @@ int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
435435
enum arm_smccc_conduit conduit;
436436
struct acpi_ffh_data *ffh_ctxt;
437437

438-
ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
439-
if (!ffh_ctxt)
440-
return -ENOMEM;
441-
442438
if (arm_smccc_get_version() < ARM_SMCCC_VERSION_1_2)
443439
return -EOPNOTSUPP;
444440

@@ -448,6 +444,10 @@ int acpi_ffh_address_space_arch_setup(void *handler_ctxt, void **region_ctxt)
448444
return -EOPNOTSUPP;
449445
}
450446

447+
ffh_ctxt = kzalloc(sizeof(*ffh_ctxt), GFP_KERNEL);
448+
if (!ffh_ctxt)
449+
return -ENOMEM;
450+
451451
if (conduit == SMCCC_CONDUIT_SMC) {
452452
ffh_ctxt->invoke_ffh_fn = __arm_smccc_smc;
453453
ffh_ctxt->invoke_ffh64_fn = arm_smccc_1_2_smc;

arch/arm64/kernel/cpufeature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ bool kaslr_requires_kpti(void)
16331633
return false;
16341634
}
16351635

1636-
return kaslr_offset() > 0;
1636+
return kaslr_enabled();
16371637
}
16381638

16391639
static bool __meltdown_safe = true;

arch/arm64/kernel/fpsimd.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,9 +2122,6 @@ static int __init fpsimd_init(void)
21222122
pr_notice("Advanced SIMD is not implemented\n");
21232123

21242124

2125-
if (cpu_have_named_feature(SME) && !cpu_have_named_feature(SVE))
2126-
pr_notice("SME is implemented but not SVE\n");
2127-
21282125
sve_sysctl_init();
21292126
sme_sysctl_init();
21302127

arch/arm64/kernel/kaslr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int __init kaslr_init(void)
4141
return 0;
4242
}
4343

44-
if (!kaslr_offset()) {
44+
if (!kaslr_enabled()) {
4545
pr_warn("KASLR disabled due to lack of seed\n");
4646
return 0;
4747
}

arch/arm64/kernel/traps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ static int cfi_handler(struct pt_regs *regs, unsigned long esr)
997997

998998
switch (report_cfi_failure(regs, regs->pc, &target, type)) {
999999
case BUG_TRAP_TYPE_BUG:
1000-
die("Oops - CFI", regs, 0);
1000+
die("Oops - CFI", regs, esr);
10011001
break;
10021002

10031003
case BUG_TRAP_TYPE_WARN:

arch/arm64/mm/copypage.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ void copy_highpage(struct page *to, struct page *from)
2222
copy_page(kto, kfrom);
2323

2424
if (system_supports_mte() && page_mte_tagged(from)) {
25-
page_kasan_tag_reset(to);
25+
if (kasan_hw_tags_enabled())
26+
page_kasan_tag_reset(to);
2627
/* It's a new page, shouldn't have been tagged yet */
2728
WARN_ON_ONCE(!try_page_mte_tagging(to));
2829
mte_copy_page_tags(kto, kfrom);

0 commit comments

Comments
 (0)