• M
    arm64: fix dump_instr when PAN and UAO are in use · c5cea06b
    Mark Rutland 提交于
    If the kernel is set to show unhandled signals, and a user task does not
    handle a SIGILL as a result of an instruction abort, we will attempt to
    log the offending instruction with dump_instr before killing the task.
    
    We use dump_instr to log the encoding of the offending userspace
    instruction. However, dump_instr is also used to dump instructions from
    kernel space, and internally always switches to KERNEL_DS before dumping
    the instruction with get_user. When both PAN and UAO are in use, reading
    a user instruction via get_user while in KERNEL_DS will result in a
    permission fault, which leads to an Oops.
    
    As we have regs corresponding to the context of the original instruction
    abort, we can inspect this and only flip to KERNEL_DS if the original
    abort was taken from the kernel, avoiding this issue. At the same time,
    remove the redundant (and incorrect) comments regarding the order
    dump_mem and dump_instr are called in.
    
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: James Morse <james.morse@arm.com>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Cc: <stable@vger.kernel.org> #4.6+
    Signed-off-by: NMark Rutland <mark.rutland@arm.com>
    Reported-by: NVladimir Murzin <vladimir.murzin@arm.com>
    Tested-by: NVladimir Murzin <vladimir.murzin@arm.com>
    Fixes: 57f4959b ("arm64: kernel: Add support for User Access Override")
    Signed-off-by: NWill Deacon <will.deacon@arm.com>
    c5cea06b
traps.c 14.1 KB