This revision introduces atf-c(3) tests for 2 Capability mode syscalls and _exit(2).
- cap_enter(2)
- cap_getmode(2)
- _exit(2)
This revision introduces atf-c(3) tests for 2 Capability mode syscalls and _exit(2).
Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
For me cap_enter_success passes intermittently. On a case when it failed, the global audit trail showed the cap_enter call we were looking for (as well as the child's exit(2), which is also in class "pc"). But the auditpipe showed nothing after fork. I think we're looking at a buffering issue. When I run "./process_control cap_enter_success" the last thing I see is the fork record. Then the process pauses for 10 seconds. But while it's paused, if I run any command at all in another terminal, then the test immediately passes. So I think that the auditpipe(4) device is buffering up some amount of data before its read(2) returns.
using AUDITPIPE_FLUSH doesn't work. You should remove that part and fix the bug in utils.c instead.
There's nothing special about exit or cap_enter. You need to disable buffering everywhere, anytime you combine fread(3) with something like ppoll(2).
tests/sys/audit/utils.c | ||
---|---|---|
216 ↗ | (On Diff #45398) | Technically it's not possible, not since you use setvbuf. I would say something more like "disable stream buffering so fread(3) (called via au_read_rec(3)) doesn't buffer data unbeknownst to ppoll(2)" |