[PATCH 2/4] ldv/unwind: handle invalid pid

Masatake YAMATO yamato at redhat.com
Wed Apr 9 16:52:09 UTC 2014


In unwind part of tcb finalization, tcp->s_ent
was accessed to decide whether pending stacktrace in tcp->queue
should be printed or not.

However, s_ent can be NULL if invalid pid is given to strace
as an trace target. Here invalid pid means that the pid is
not associated with any process.

This patch handles such case.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 unwind.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unwind.c b/unwind.c
index ed2d141..a7e985e 100644
--- a/unwind.c
+++ b/unwind.c
@@ -572,7 +572,7 @@ unwind_tcb_init(struct tcb *tcp)
 void
 unwind_tcb_fin(struct tcb *tcp)
 {
-	if (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_IN_ENTERING)
+	if ((tcp->s_ent != NULL) && (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_IN_ENTERING))
 		queue_print_and_free(tcp);
 	else
 		queue_free(tcp->queue, NULL);
-- 
1.8.5.3





More information about the Strace-devel mailing list