Page MenuHomeFreeBSD

tests: unix: add SCM_RIGHTS tests for SO_PASSRIGHTS
ClosedPublic

Authored by kevans on Jun 4 2026, 5:05 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 7, 8:49 PM
Unknown Object (File)
Tue, Jul 7, 8:23 PM
Unknown Object (File)
Mon, Jul 6, 2:38 PM
Unknown Object (File)
Sat, Jul 4, 11:41 AM
Unknown Object (File)
Fri, Jul 3, 8:31 AM
Unknown Object (File)
Thu, Jun 25, 11:26 PM
Unknown Object (File)
Thu, Jun 25, 11:05 AM
Unknown Object (File)
Thu, Jun 25, 1:57 AM
Subscribers

Details

Summary

We test both the standard case where we want to reject any SCM_RIGHTS
message, as well as the case where the kernel discards the unwanted file
upon receipt.

Diff Detail

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

Event Timeline

kevans requested review of this revision.Jun 4 2026, 5:05 AM
This revision is now accepted and ready to land.Jun 8 2026, 5:53 PM

You might add a test case which checks whether the option is inherited by accept().

tests/sys/kern/unix_passfd_test.c
605
kevans marked an inline comment as done.

Add a test that SO_PASSRIGHTS isn't inherited from a listening socket. The new
test does stop just short of actually sending an fd over the socket, assuming
we won't mess up and return a false-positive in getsockopt(2)

This revision now requires review to proceed.Fri, Jun 12, 3:48 AM
markj added inline comments.
tests/sys/kern/unix_passfd_test.c
717

I'm not sure that you actually need a separate process? AFAIR connect() does not block waiting for the server to accept().

This revision is now accepted and ready to land.Fri, Jun 12, 1:45 PM
kevans marked an inline comment as done.

Simplify noinherit case- I did the dumb, unix(4) sockets won't inherently block
on connect(2).

This revision now requires review to proceed.Fri, Jun 12, 3:17 PM
This revision is now accepted and ready to land.Sat, Jun 13, 1:05 PM