Page MenuHomeFreeBSD

ptrace_test: add test for the PT_ATTACH behavior on sleeping thread
ClosedPublic

Authored by kib on Apr 18 2025, 12:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 19, 12:54 AM
Unknown Object (File)
Wed, Aug 6, 10:30 PM
Unknown Object (File)
Sun, Aug 3, 7:11 PM
Unknown Object (File)
Sun, Aug 3, 3:28 AM
Unknown Object (File)
Sat, Aug 2, 11:42 PM
Unknown Object (File)
Sat, Aug 2, 2:32 AM
Unknown Object (File)
Sat, Aug 2, 1:58 AM
Unknown Object (File)
Sat, Jul 26, 8:11 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Apr 18 2025, 12:22 PM
markj added inline comments.
tests/sys/kern/ptrace_test.c
4498

The error handling can just be ATF_REQUIRE(shm != MAP_FAILED);

This revision is now accepted and ready to land.Apr 18 2025, 1:50 PM
kib marked an inline comment as done.

Use proper way to check the mmap failure.
Check nanosleep return value and errno.

This revision now requires review to proceed.Apr 18 2025, 3:02 PM

Is there a way to skip the test depending on the sysctl value? Or should I do not bother?

In D49887#1137583, @kib wrote:

Is there a way to skip the test depending on the sysctl value? Or should I do not bother?

You can do something like

error = sysctlbyname(..., &val);
ATF_REQUIRE(error == 0);
if (val)
    atf_tc_skip(tc, "test doesn't work with sysctl foo set");

For a chicken switch under the debug MIB, I probably wouldn't bother.

tests/sys/kern/ptrace_test.c
4518

For completeness, also check that WEXITSTATUS(status) == 0?

kib marked an inline comment as done.

Check exit status of the child.

This revision is now accepted and ready to land.Apr 18 2025, 3:22 PM