• Amit Daniel Kachhap's avatar
    arm64: kprobe: add checks for ARMv8.3-PAuth combined instructions · 93396936
    Amit Daniel Kachhap authored
    Currently the ARMv8.3-PAuth combined branch instructions (braa, retaa
    etc.) are not simulated for out-of-line execution with a handler. Hence the
    uprobe of such instructions leads to kernel warnings in a loop as they are
    not explicitly checked and fall into INSN_GOOD categories. Other combined
    instructions like LDRAA and LDRBB can be probed.
    
    The issue of the combined branch instructions is fixed by adding
    group definitions of all such instructions and rejecting their probes.
    The instruction groups added are br_auth(braa, brab, braaz and brabz),
    blr_auth(blraa, blrab, blraaz and blrabz), ret_auth(retaa and retab) and
    eret_auth(eretaa and eretab).
    
    Warning log:
     WARNING: CPU: 0 PID: 156 at arch/arm64/kernel/probes/uprobes.c:182 uprobe_single_step_handler+0x34/0x50
     Modules linked in:
     CPU: 0 PID: 156 Comm: func Not tainted 5.9.0-rc3 #188
     Hardware name: Foundation-v8A (DT)
     pstate: 804003c9 (Nzcv DAIF +PAN -UAO BTYPE=--)
     pc : uprobe_single_step_handler+0x34/0x50
     lr : single_step_handler+0x70/0xf8
     sp : ffff800012af3e30
     x29: ffff800012af3e30 x28: ffff000878723b00
     x27: 0000000000000000 x26: 0000000000000000
     x25: 0000000000000000 x24: 0000000000000000
     x23: 0000000060001000 x22: 00000000cb000022
     x21: ffff800012065ce8 x20: ffff800012af3ec0
     x19: ffff800012068d50 x18: 0000000000000000
     x17: 0000000000000000 x16: 0000000000000000
     x15: 0000000000000000 x14: 0000000000000000
     x13: 0000000000000000 x12: 0000000000000000
     x11: 0000000000000000 x10: 0000000000000000
     x9 : ffff800010085c90 x8 : 0000000000000000
     x7 : 0000000000000000 x6 : ffff80001205a9c8
     x5 : ffff80001205a000 x4 : ffff80001233db80
     x3 : ffff8000100a7a60 x2 : 0020000000000003
     x1 : 0000fffffffff008 x0 : ffff800012af3ec0
     Call trace:
      uprobe_single_step_handler+0x34/0x50
      single_step_handler+0x70/0xf8
      do_debug_exception+0xb8/0x130
      el0_sync_handler+0x138/0x1b8
      el0_sync+0x158/0x180
    
    Fixes: 74afda40 ("arm64: compile the kernel with ptrauth return address signing")
    Fixes: 04ca3204 ("arm64: enable pointer authentication")
    Signed-off-by: default avatarAmit Daniel Kachhap <amit.kachhap@arm.com>
    Reviewed-by: default avatarDave Martin <Dave.Martin@arm.com>
    Link: https://lore.kernel.org/r/20200914083656.21428-2-amit.kachhap@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
    93396936
insn.h 17.7 KB