Skip to content

Commit 1c304c7

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: - Correctly mask out bits 63:60 in a kernel tag check fault address (specified as unknown by the architecture). Previously they were just zeroed but for kernel pointers they need to be all ones. - Fix a panic (unexpected kernel BRK exception) caused by kprobes being reentered due to an interrupt. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: kprobes: Fix Uexpected kernel BRK exception at EL1 kasan, arm64: fix pointer tags in KASAN reports
2 parents a903430 + 75bd4bf commit 1c304c7

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

arch/arm64/kernel/probes/kprobes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ kprobe_breakpoint_ss_handler(struct pt_regs *regs, unsigned int esr)
352352
unsigned long addr = instruction_pointer(regs);
353353
struct kprobe *cur = kprobe_running();
354354

355-
if (cur && (kcb->kprobe_status == KPROBE_HIT_SS)
356-
&& ((unsigned long)&cur->ainsn.api.insn[1] == addr)) {
355+
if (cur && (kcb->kprobe_status & (KPROBE_HIT_SS | KPROBE_REENTER)) &&
356+
((unsigned long)&cur->ainsn.api.insn[1] == addr)) {
357357
kprobes_restore_local_irqflag(kcb, regs);
358358
post_kprobe_handler(cur, kcb, regs);
359359

arch/arm64/mm/fault.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,11 @@ static int do_tag_check_fault(unsigned long far, unsigned int esr,
709709
struct pt_regs *regs)
710710
{
711711
/*
712-
* The architecture specifies that bits 63:60 of FAR_EL1 are UNKNOWN for tag
713-
* check faults. Mask them out now so that userspace doesn't see them.
712+
* The architecture specifies that bits 63:60 of FAR_EL1 are UNKNOWN
713+
* for tag check faults. Set them to corresponding bits in the untagged
714+
* address.
714715
*/
715-
far &= (1UL << 60) - 1;
716+
far = (__untagged_addr(far) & ~MTE_TAG_MASK) | (far & MTE_TAG_MASK);
716717
do_bad_area(far, esr, regs);
717718
return 0;
718719
}

0 commit comments

Comments
 (0)