teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0026-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch

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