daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
572a44
From 63d689541fd7e70e83de425986182ee488e14a0f Mon Sep 17 00:00:00 2001
a4b143
From: Igor Zhbanov <i.zhbanov@samsung.com>
a4b143
Date: Tue, 15 Oct 2013 14:35:13 +0400
a4b143
Subject: [PATCH] Fix for SIGSEGV in systemd-bootchart on short-living
a4b143
 processes
a4b143
a4b143
The function svg_ps_bars() dereferencess NULL pointer in the line
a4b143
	endtime = ps->last->sampledata->sampletime;
a4b143
because of partially initialized ps_struct (ps->last == NULL).
a4b143
a4b143
If some process terminates between scaning /proc directory in the log_sample()
a4b143
function and reading additional information from /proc/PID/... files,
a4b143
the files couldn't be read, the loop will be continued and partially
a4b143
initialized structure returned.
a4b143
---
a4b143
 src/bootchart/store.c | 2 +-
a4b143
 1 file changed, 1 insertion(+), 1 deletion(-)
a4b143
a4b143
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
a4b143
index f8c97c2..7f86cfe 100644
a4b143
--- a/src/bootchart/store.c
a4b143
+++ b/src/bootchart/store.c
a4b143
@@ -275,7 +275,7 @@ schedstat_next:
a4b143
                         pscount++;
a4b143
 
a4b143
                         /* mark our first sample */
a4b143
-                        ps->first = ps->sample;
a4b143
+                        ps->first = ps->last = ps->sample;
a4b143
                         ps->sample->runtime = atoll(rt);
a4b143
                         ps->sample->waittime = atoll(wt);
a4b143