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)
Sun, Nov 10, 8:48 PM
Unknown Object (File)
Oct 2 2024, 4:31 PM
Unknown Object (File)
Sep 22 2024, 10:45 PM
Unknown Object (File)
Sep 22 2024, 10:44 PM
Unknown Object (File)
Sep 22 2024, 10:44 PM
Unknown Object (File)
Sep 22 2024, 10:44 PM
Unknown Object (File)
Sep 22 2024, 10:34 PM
Unknown Object (File)
Sep 11 2024, 10:32 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.