summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2016-08-14 22:43:48 +0000
committerbapt <bapt@FreeBSD.org>2016-08-14 22:43:48 +0000
commit1f0cc39531278e781936d5261f2c59959b7951d1 (patch)
tree0f0b27d815001d0adaa2ac65b2eb496579291a74 /usr.bin
parentddd610a8d454bf59eef203cb59d0c34ac95a8758 (diff)
downloadFreeBSD-src-1f0cc39531278e781936d5261f2c59959b7951d1.zip
FreeBSD-src-1f0cc39531278e781936d5261f2c59959b7951d1.tar.gz
MFC: r303685
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@gandi.net) Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D7399
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/setup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index c134405..a14c016 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -223,8 +223,10 @@ add_threads(struct trussinfo *info, struct procinfo *p)
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);
}
OpenPOWER on IntegriCloud