svn commit: r303685 - head/usr.bin/truss
Baptiste Daroussin
bapt at FreeBSD.org
Tue Aug 2 22:47:08 UTC 2016
Author: bapt
Date: Tue Aug 2 22:47:06 2016
New Revision: 303685
URL: https://svnweb.freebsd.org/changeset/base/303685
Log:
truss: fix uninitialized trussinfo->curthread in add_threads()/enter_syscall
trussinfo->curthread must be initialized before calling enter_syscall(),
it is used by t->proc->abi->fetch_args().
Without that truss is segfaulting and the attached program also crash.
Submitted by: Nikita Kozlov (nikita at gandi.net)
Reviewed by: jhb
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D7399
Modified:
head/usr.bin/truss/setup.c
Modified: head/usr.bin/truss/setup.c
==============================================================================
--- head/usr.bin/truss/setup.c Tue Aug 2 22:33:29 2016 (r303684)
+++ head/usr.bin/truss/setup.c Tue Aug 2 22:47:06 2016 (r303685)
@@ -223,8 +223,10 @@ add_threads(struct trussinfo *info, stru
t = new_thread(p, lwps[i]);
if (ptrace(PT_LWPINFO, lwps[i], (caddr_t)&pl, sizeof(pl)) == -1)
err(1, "ptrace(PT_LWPINFO)");
- if (pl.pl_flags & PL_FLAG_SCE)
+ if (pl.pl_flags & PL_FLAG_SCE) {
+ info->curthread = t;
enter_syscall(info, t, &pl);
+ }
}
free(lwps);
}
More information about the svn-src-head
mailing list