Page MenuHomeFreeBSD

dtrace: prevent forked child from running after an error condition
ClosedPublic

Authored by vangyzen on Jul 11 2023, 6:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 16, 2:14 PM
Unknown Object (File)
Thu, May 9, 11:31 PM
Unknown Object (File)
Thu, May 2, 4:08 PM
Unknown Object (File)
Thu, May 2, 4:08 PM
Unknown Object (File)
Thu, May 2, 3:53 PM
Unknown Object (File)
Thu, May 2, 3:51 PM
Unknown Object (File)
Thu, May 2, 12:53 PM
Unknown Object (File)
Apr 20 2024, 6:55 PM

Details

Summary

The pid/killonerror test uses an invalid probe specifier to verify that
the child process is killed. It occasionally fails because the "date"
command is allowed to run long enough to print the date. This is harmless
in this case, but is clearly not ideal.

When the dt_proc_control thread is about to exit, and the dtrace command
forked the child, do not make the child runnable.

Test Plan

I ran the test in a tight loop until failure, then repeated for a few
dozen loops. Before the change, every loop failed, and the iterations were
almost always less than 10, with a maximum of around 50. After the change,
the first-and-only loop passed over 5,000 iterations.

I'll also run the entire DTrace test suite.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Seems reasonable.

cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
693

Maybe "an initialization error"? I'd have a hard time understanding what's meant by a command-line error if I were just reading the code.

This revision is now accepted and ready to land.Jul 11 2023, 6:32 PM
cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
693

Yes, that sounds much better.

This revision now requires review to proceed.Jul 11 2023, 6:42 PM
vangyzen marked an inline comment as done.

The DTrace test suite had fewer failures with this change. They were not fixed by this change; they're just unreliable.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 12 2023, 3:36 PM
This revision was automatically updated to reflect the committed changes.