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
F150927352: D49887.id153867.diff
Sun, Apr 5, 12:19 AM
Unknown Object (File)
Sat, Apr 4, 12:49 AM
Unknown Object (File)
Wed, Apr 1, 4:16 PM
Unknown Object (File)
Mon, Mar 30, 3:08 PM
Unknown Object (File)
Mon, Mar 30, 6:25 AM
Unknown Object (File)
Mon, Mar 30, 5:08 AM
Unknown Object (File)
Sun, Mar 29, 8:18 PM
Unknown Object (File)
Sat, Mar 28, 11:28 AM
Subscribers

Diff Detail

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

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