lkml.org 
[lkml]   [2013]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.2 65/87] parisc: fix interruption handler to respect pagefault_disable()
    3.2.53-rc1 review patch.  If anyone has any objections, please let me know.

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

    From: Helge Deller <deller@gmx.de>

    commit 59b33f148cc08fb33cbe823fca1e34f7f023765e upstream.

    Running an "echo t > /proc/sysrq-trigger" crashes the parisc kernel. The
    problem is, that in print_worker_info() we try to read the workqueue info via
    the probe_kernel_read() functions which use pagefault_disable() to avoid
    crashes like this:
    probe_kernel_read(&pwq, &worker->current_pwq, sizeof(pwq));
    probe_kernel_read(&wq, &pwq->wq, sizeof(wq));
    probe_kernel_read(name, wq->name, sizeof(name) - 1);

    The problem here is, that the first probe_kernel_read(&pwq) might return zero
    in pwq and as such the following probe_kernel_reads() try to access contents of
    the page zero which is read protected and generate a kernel segfault.

    With this patch we fix the interruption handler to call parisc_terminate()
    directly only if pagefault_disable() was not called (in which case
    preempt_count()==0). Otherwise we hand over to the pagefault handler which
    will try to look up the faulting address in the fixup tables.

    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: John David Anglin <dave.anglin@bell.net>
    Signed-off-by: Helge Deller <deller@gmx.de>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    arch/parisc/kernel/traps.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    --- a/arch/parisc/kernel/traps.c
    +++ b/arch/parisc/kernel/traps.c
    @@ -811,14 +811,14 @@ void notrace handle_interruption(int cod
    else {

    /*
    - * The kernel should never fault on its own address space.
    + * The kernel should never fault on its own address space,
    + * unless pagefault_disable() was called before.
    */

    - if (fault_space == 0)
    + if (fault_space == 0 && !in_atomic())
    {
    pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
    parisc_terminate("Kernel Fault", regs, code, fault_address);
    -
    }
    }



    \
     
     \ /
      Last update: 2013-11-25 15:41    [W:4.062 / U:0.512 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site