Skip to content

Commit c1954ca

Browse files
committed
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: - avoid invoking overflow handler for uaccess watchpoints - fix incorrect clock_gettime64 availability - fix EFI crash in create_mapping_late() * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: 8988/1: mmu: fix crash in EFI calls due to p4d typo in create_mapping_late() ARM: 8987/1: VDSO: Fix incorrect clock_gettime64 ARM: 8986/1: hw_breakpoint: Don't invoke overflow handler on uaccess watchpoints
2 parents ae2911d + 5c6360e commit c1954ca

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

arch/arm/kernel/hw_breakpoint.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,12 @@ static void disable_single_step(struct perf_event *bp)
683683
arch_install_hw_breakpoint(bp);
684684
}
685685

686+
static int watchpoint_fault_on_uaccess(struct pt_regs *regs,
687+
struct arch_hw_breakpoint *info)
688+
{
689+
return !user_mode(regs) && info->ctrl.privilege == ARM_BREAKPOINT_USER;
690+
}
691+
686692
static void watchpoint_handler(unsigned long addr, unsigned int fsr,
687693
struct pt_regs *regs)
688694
{
@@ -742,16 +748,27 @@ static void watchpoint_handler(unsigned long addr, unsigned int fsr,
742748
}
743749

744750
pr_debug("watchpoint fired: address = 0x%x\n", info->trigger);
751+
752+
/*
753+
* If we triggered a user watchpoint from a uaccess routine,
754+
* then handle the stepping ourselves since userspace really
755+
* can't help us with this.
756+
*/
757+
if (watchpoint_fault_on_uaccess(regs, info))
758+
goto step;
759+
745760
perf_bp_event(wp, regs);
746761

747762
/*
748-
* If no overflow handler is present, insert a temporary
749-
* mismatch breakpoint so we can single-step over the
750-
* watchpoint trigger.
763+
* Defer stepping to the overflow handler if one is installed.
764+
* Otherwise, insert a temporary mismatch breakpoint so that
765+
* we can single-step over the watchpoint trigger.
751766
*/
752-
if (is_default_overflow_handler(wp))
753-
enable_single_step(wp, instruction_pointer(regs));
767+
if (!is_default_overflow_handler(wp))
768+
goto unlock;
754769

770+
step:
771+
enable_single_step(wp, instruction_pointer(regs));
755772
unlock:
756773
rcu_read_unlock();
757774
}

arch/arm/kernel/vdso.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static void __init patch_vdso(void *ehdr)
184184
if (!cntvct_ok) {
185185
vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
186186
vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
187+
vdso_nullpatch_one(&einfo, "__vdso_clock_gettime64");
187188
}
188189
}
189190

arch/arm/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ void __init create_mapping_late(struct mm_struct *mm, struct map_desc *md,
966966
pud_t *pud;
967967

968968
p4d = p4d_alloc(mm, pgd_offset(mm, md->virtual), md->virtual);
969-
if (!WARN_ON(!p4d))
969+
if (WARN_ON(!p4d))
970970
return;
971971
pud = pud_alloc(mm, p4d, md->virtual);
972972
if (WARN_ON(!pud))

0 commit comments

Comments
 (0)