From: Willy Tarreau Date: Fri, 17 May 2019 12:14:35 +0000 (+0200) Subject: BUG/MINOR: debug: don't check the call date on tasklets X-Git-Tag: v2.0-dev4~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=20db9115dcdf07c00c59731f2e14275d67ebf747;p=thirdparty%2Fhaproxy.git BUG/MINOR: debug: don't check the call date on tasklets tasklets don't have a call date, so when a tasklet is cast into a task and is present at the end of a page we run a risk of dereferencing unmapped memory when dumping them in ha_task_dump(). This commit simplifies the test and uses to distinct calls for tasklets and tasks. No backport is needed. --- diff --git a/src/debug.c b/src/debug.c index a7c3b3a75b..2829851835 100644 --- a/src/debug.c +++ b/src/debug.c @@ -84,12 +84,18 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) return; } - chunk_appendf(buf, - "%p (%s) calls=%u last=%llu%s\n", - task, TASK_IS_TASKLET(task) ? "tasklet" : "task", - task->calls, - task->call_date ? (unsigned long long)(now_mono_time() - task->call_date) : 0, - task->call_date ? " ns ago" : ""); + if (TASK_IS_TASKLET(task)) + chunk_appendf(buf, + "%p (tasklet) calls=%u\n", + task, + task->calls); + else + chunk_appendf(buf, + "%p (task) calls=%u last=%llu%s\n", + task, + task->calls, + task->call_date ? (unsigned long long)(now_mono_time() - task->call_date) : 0, + task->call_date ? " ns ago" : ""); chunk_appendf(buf, "%s" " fct=%p (%s) ctx=%p\n",