lkml.org 
[lkml]   [2014]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.16 031/125] arm64: dont call break hooks for BRK exceptions from EL0
    Date
    3.16-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Will Deacon <will.deacon@arm.com>

    commit c878e0cff5c5e56b216951cbe75f7a3dd500a736 upstream.

    Our break hooks are used to handle brk exceptions from kgdb (and potentially
    kprobes if that code ever resurfaces), so don't bother calling them if
    the BRK exception comes from userspace.

    This prevents userspace from trapping to a kdb shell on systems where
    kgdb is enabled and active.

    Reported-by: Omar Sandoval <osandov@osandov.com>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    arch/arm64/kernel/debug-monitors.c | 22 +++++++++++-----------
    1 file changed, 11 insertions(+), 11 deletions(-)

    --- a/arch/arm64/kernel/debug-monitors.c
    +++ b/arch/arm64/kernel/debug-monitors.c
    @@ -315,20 +315,20 @@ static int brk_handler(unsigned long add
    {
    siginfo_t info;

    - if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
    - return 0;
    + if (user_mode(regs)) {
    + info = (siginfo_t) {
    + .si_signo = SIGTRAP,
    + .si_errno = 0,
    + .si_code = TRAP_BRKPT,
    + .si_addr = (void __user *)instruction_pointer(regs),
    + };

    - if (!user_mode(regs))
    + force_sig_info(SIGTRAP, &info, current);
    + } else if (call_break_hook(regs, esr) != DBG_HOOK_HANDLED) {
    + pr_warning("Unexpected kernel BRK exception at EL1\n");
    return -EFAULT;
    + }

    - info = (siginfo_t) {
    - .si_signo = SIGTRAP,
    - .si_errno = 0,
    - .si_code = TRAP_BRKPT,
    - .si_addr = (void __user *)instruction_pointer(regs),
    - };
    -
    - force_sig_info(SIGTRAP, &info, current);
    return 0;
    }




    \
     
     \ /
      Last update: 2014-09-04 00:41    [W:4.041 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site