]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: debug: don't check the call date on tasklets
authorWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 12:14:35 +0000 (14:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 15:16:20 +0000 (17:16 +0200)
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.

src/debug.c

index a7c3b3a75b973fba0673b4f61ae280a00037bcec..282985183591d6296e6661806a32b73c787c5fe3 100644 (file)
@@ -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",