Skip to content

Commit 59b33f1

Browse files
committed
parisc: fix interruption handler to respect pagefault_disable()
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 <[email protected]> Cc: <[email protected]> # v3.0+ Signed-off-by: John David Anglin <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent a60ac4b commit 59b33f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/parisc/kernel/traps.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,14 +800,14 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
800800
else {
801801

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

806-
if (fault_space == 0)
807+
if (fault_space == 0 && !in_atomic())
807808
{
808809
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC);
809810
parisc_terminate("Kernel Fault", regs, code, fault_address);
810-
811811
}
812812
}
813813

0 commit comments

Comments
 (0)