Re-check the systrace probe ID before calling dtrace_probe().

Otherwise there exists a narrow window during which a syscall probe can be
disabled and cause a concurrently-running thread to call dtrace_probe()
with an invalid probe ID.

Reported by:	ngie
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Mark Johnston 2016-09-22 23:22:53 +00:00
parent c2625e6e38
commit 36f5d07745

View File

@ -193,7 +193,8 @@ systrace_probe(struct syscall_args *sa, enum systrace_probe_t type, int retval)
memset(uargs, 0, sizeof(uargs));
if (type == SYSTRACE_ENTRY) {
id = sa->callp->sy_entry;
if ((id = sa->callp->sy_entry) == DTRACE_IDNONE)
return;
if (sa->callp->sy_systrace_args_func != NULL)
/*
@ -215,7 +216,8 @@ systrace_probe(struct syscall_args *sa, enum systrace_probe_t type, int retval)
*/
curthread->t_dtrace_systrace_args = uargs;
} else {
id = sa->callp->sy_return;
if ((id = sa->callp->sy_return) == DTRACE_IDNONE)
return;
curthread->t_dtrace_systrace_args = NULL;
/* Set arg0 and arg1 as the return value of this syscall. */