Details
Details
- Reviewers
kib - Commits
- rG0083a4d6224f: tests/procdesc: Add some test cases for pdopenpid()
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Do we want some test to ensure that pdopenpid() has no effect on the target? I mean, ptrace(PT_ATTACH) might cause spurious wakeups (partially mitigated now).
| tests/sys/kern/procdesc.c | ||
|---|---|---|
| 228 | I intended that pause() is covered by loop in all tests. | |
| 350 | You are using sleep() there to eventually exit the child, am I correct? | |
| tests/sys/kern/procdesc.c | ||
|---|---|---|
| 350 | diff --git a/tests/sys/kern/procdesc.c b/tests/sys/kern/procdesc.c index 6258ecd6e8d8..2f54f138f12e 100644 --- a/tests/sys/kern/procdesc.c +++ b/tests/sys/kern/procdesc.c @@ -342,12 +342,14 @@ ATF_TC_BODY(pdopenpid_esrch, tc) ATF_TC_WITHOUT_HEAD(pdopenpid_capmode); ATF_TC_BODY(pdopenpid_capmode, tc) { - pid_t child; + pid_t child, parent; + parent = getpid(); child = fork(); ATF_REQUIRE_MSG(child >= 0, "fork: %s", strerror(errno)); if (child == 0) { - sleep(1); + while (getppid() == parent) + sleep(1); _exit(0); } worked for me | |
Comment Actions
Like, we should check that pdopenpid() does not result in a spurious wakeup of the target? That's a good idea.
| tests/sys/kern/procdesc.c | ||
|---|---|---|
| 350 | Right, since the parent is in capability mode here it can't use kill(). | |