Page MenuHomeFreeBSD

Test that getppid() does not return an unrelated debugger.
ClosedPublic

Authored by jhb on Sep 9 2015, 9:45 PM.
Tags
None
Referenced Files
F101316986: D3615.id8629.diff
Sun, Oct 27, 5:13 PM
F101316909: D3615.id8628.diff
Sun, Oct 27, 5:11 PM
F101312151: D3615.diff
Sun, Oct 27, 3:31 PM
Unknown Object (File)
Sat, Sep 28, 9:40 AM
Unknown Object (File)
Sep 26 2024, 5:06 AM
Unknown Object (File)
Sep 25 2024, 2:28 PM
Unknown Object (File)
Sep 10 2024, 3:02 PM
Unknown Object (File)
Sep 8 2024, 5:34 PM

Details

Summary

Add a test to verify that a traced process sees its original parent via
getppid() after a debugger process that is not the parent has attached.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Test that getppid() does not return an unrelated debugger..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: kib.
kib edited edge metadata.

I noted now that the test does not un-ignore and block SIGCHLD. Is it something guaranteed by the ATF execution environment ?

tests/sys/kern/ptrace_test.c
924 ↗(On Diff #8627)

It is better to use _exit() in the forked child.

This revision is now accepted and ready to land.Sep 9 2015, 10:01 PM
In D3615#74688, @kib wrote:

I noted now that the test does not un-ignore and block SIGCHLD. Is it something guaranteed by the ATF execution environment ?

Hmm, none of the tests do that. Isn't SIG_DFL sufficient for SIGCHLD however (discard signal, but still create zombies)? My guess is that ATF probably leaves SIGCHLD as the default action which should be SIG_DFL.

tests/sys/kern/ptrace_test.c
924 ↗(On Diff #8627)

Hmm, I should probably do that in all of the various forked children in this set of tests. I can do that in a followup.

jhb edited edge metadata.

Use _exit() instead of exit() in child processes of new test.

This revision now requires review to proceed.Sep 9 2015, 10:17 PM
jhb marked an inline comment as done.Sep 9 2015, 10:18 PM
jhb added inline comments.
tests/sys/kern/ptrace_test.c
924 ↗(On Diff #8627)

I actually decided to fix this test before commit so I can more easily MFC the fix to the others. We haven't MFC'd this new behavior (getppid() not returning the tracer) probably to avoid what is effectively an ABI breakage of sorts in a stable branch, so this change may not get MFC'd unless the associated getppid() changes do.

jhb added a subscriber: ngie.

Added ngie@. kib@ points out that these tests are assuming that ATF leaves SIGCHLD at its default disposition. Is that something that I should be able to safely assume or should I be explicitly setting SIGCHLD to SIG_DFL to be safe? (Related: would ATF consider it bad form to modify SIGCHLD's disposition?)

This revision was automatically updated to reflect the committed changes.

I think it leaves it in its "default disposition" based on a quick look around https://github.com/jmmv/kyua, but I'll add Julio just in case I'm missing something...