Page MenuHomeFreeBSD

Add tests for pipe(2) and POSIX standardized IPC syscalls

Authored by aniketp on Jun 22 2018, 4:51 AM.



This revision introduces test cases for following set of syscalls within inter-process
communication audit class.

  • shm_open(2)
  • shm_unlink(2)
  • posix_openpt(2)
  • pipe(2)
Test Plan

Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

aniketp created this revision.Jun 22 2018, 4:51 AM

Do these complete the IPC set?

1416 ↗(On Diff #44292)

New code should use strlcat instead of strncat.

1422 ↗(On Diff #44292)

shared memory segments are actually persistent. So the unlink steps needs to go in the cleanup function. However, if you create the object with SHM_ANON for path, then it will be automatically destroyed.

1510 ↗(On Diff #44292)

The file descriptors are outputs from pipe(2), not inputs to it. Don't initialize them with open.

1542 ↗(On Diff #44292)

I'm surprised this doesn't segfault. Better to use NULL. Or, just use pipe2 with invalid flags. pipe(2) is actually a wrapper around pipe2(2). If you really want to test the pipe(2) syscall, you'll have to do it the same way you tested open(2), but using syscall(2). However, pipe and pipe2 both have the same audit event, AUE_PIPE.

aniketp updated this revision to Diff 44315.Jun 22 2018, 5:11 PM
aniketp marked 4 inline comments as done.

Changes as suggested in the inline comments

asomers requested changes to this revision.Jun 22 2018, 10:29 PM
asomers added inline comments.
1459 ↗(On Diff #44315)

No need for the -1.

This revision now requires changes to proceed.Jun 22 2018, 10:29 PM
aniketp updated this revision to Diff 44332.Jun 23 2018, 1:52 AM

Remove -1 from strlcat() in shm_inlink_success test case

asomers accepted this revision.Jun 23 2018, 6:38 PM
This revision is now accepted and ready to land.Jun 23 2018, 6:38 PM
This revision was automatically updated to reflect the committed changes.