[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131001203520.GA8248@p100.box>
Date: Tue, 1 Oct 2013 22:35:20 +0200
From: Helge Deller <deller@....de>
To: Tejun Heo <tj@...nel.org>, Libin <huawei.libin@...wei.com>,
linux-kernel@...r.kernel.org, linux-parisc@...r.kernel.org,
James Bottomley <James.Bottomley@...senPartnership.com>
Subject: [PATCH] [workqueue] check values of pwq and wq in
print_worker_info() before use
print_worker_info() includes no validity check on the pwq and wq
pointers before handing them over to the probe_kernel_read() functions.
It seems that most architectures don't care about that, but at least on
the parisc architecture this leads to a kernel crash since accesses to
page zero are protected by the kernel for security reasons.
Fix this problem by verifying the contents of pwq and wq before usage.
Even if probe_kernel_read() usually prevents such crashes by disabling
page faults, clean code should always include such checks.
Without this fix issuing "echo t > /proc/sysrq-trigger" will immediately
crash the Linux kernel on the parisc architecture.
CC: Tejun Heo <tj@...nel.org>
CC: Libin <huawei.libin@...wei.com>
CC: linux-parisc@...r.kernel.org
CC: James.Bottomley@...senPartnership.com
Signed-off-by: Helge Deller <deller@....de>
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 987293d..c03b47f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4512,8 +4512,10 @@ void print_worker_info(const char *log_lvl, struct task_struct *task)
*/
probe_kernel_read(&fn, &worker->current_func, sizeof(fn));
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);
+ if (pwq)
+ probe_kernel_read(&wq, &pwq->wq, sizeof(wq));
+ if (wq)
+ probe_kernel_read(name, wq->name, sizeof(name) - 1);
/* copy worker description */
probe_kernel_read(&desc_valid, &worker->desc_valid, sizeof(desc_valid));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists