Page MenuHomeFreeBSD

unix(4): support abstract socket names, isolated per jail
Needs ReviewPublic

Authored by bapt on Tue, Sep 15, 4:52 AM.
Tags
None
Referenced Files
F172458684: D59694.id186760.diff
Fri, Sep 18, 3:07 PM
F172366763: D59694.diff
Fri, Sep 18, 12:08 AM
Unknown Object (File)
Thu, Sep 17, 12:55 PM
Unknown Object (File)
Thu, Sep 17, 4:54 AM
Unknown Object (File)
Thu, Sep 17, 1:14 AM
Unknown Object (File)
Wed, Sep 16, 9:00 PM
Unknown Object (File)
Tue, Sep 15, 6:03 AM
Unknown Object (File)
Tue, Sep 15, 6:02 AM
Subscribers

Details

Reviewers
glebius
markj
Summary

Add support for AF_UNIX abstract socket names: an address whose
sun_path begins with a NUL byte names a socket that lives only in a
table, never in the file system.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76919
Build 73802: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Tue, Sep 15, 4:52 AM

this is what we discussed about at eurobsdcon, my find this version very simple, given other implementation I found are more coplicated, probably I am missing some point, but it seems anyway pretty complete from my testing. (if we have an issue with performance the linked list may be converted to hash table.

You are quick! I'm still not home, thus didn't yet produce anything. Sorry! May I ask you to hold on with pushing it? May I use your implementation as a base and do more work on top? The best would be if you share your branch on github and I will make pull requests to you. At the end we can squash.

Things I want to do:

  1. tree(3) instead of queue(3) for the lookup
  2. Add a flag to tell abstract from regular one. I didn't test, but seems you can do weird things if you first bind to abstract address and then to filesystem address. Flag will allow to rule out easier that.
  3. Don't create new structure but unionize everything in existing unpcb.
  4. Userland reporting, so that netstat -u shows something meaningful.
  5. More tests that would test incorrect scenarios, as current test only correct use.
sys/kern/uipc_usrreq.c
118–125

I think this all can be unionized into struct unpcb and you won't need extra allocation.

don't worry, as I explained, there is a github with an alternative which I found complicated, and I wondered if I was missing something.

about netstat -u I haven't thought about it, for sockstat I have a patch which I will put in review later where I show the abstract unix socket as '@path' @ instead of \0 we can probably do the same for netstat -u (this is what linux does in the ss command

I actually meant sockstat when said netstat. But both need to be covered.

Do you have a place you share your branch?

right now no, but I can do that once I have converted it do tree(3), but it will take some time ;)

Just share what you have and work on rcd! I will do this part.