[patch] Fix crash on userland fbt tracing
Jihyun Yu
yjh0502 at gmail.com
Mon Apr 11 10:05:03 UTC 2016
How to reproduce crash (tested on 10.3)
- Run `top` on a shell
- List dtrace probes with following command:
dtrace -p `pgrep top` -ln 'pid$target::clear:entry {}
pid$target::clear:return {}'
- Try to attach probes without specifing pid provider
# dtrace -p `pgrep top` -n '::clear:entry {} ::clear:return {}'
Assertion failed: (err == 0), file
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c,
line 1131.
The crash is caused by a deadlock, and here's a fix.
--- dt_module.c 2016-04-11 18:53:05.812651961 +0900
+++ dt_module.fix.c 2016-04-11 18:52:01.068701543 +0900
@@ -693,6 +693,7 @@
arg.dpa_count = 0;
if (Pobject_iter_resolved(p, dt_module_load_proc_count, &arg) != 0) {
dt_dprintf("failed to iterate objects\n");
+ dt_proc_unlock(dtp, p);
dt_proc_release(dtp, p);
return (dt_set_errno(dtp, EDT_CANTLOAD));
}
More information about the freebsd-dtrace
mailing list