Skip to content

Commit 9d4b7e1

Browse files
committed
wishlist: user xattrs on socket inodes
1 parent c93a2da commit 9d4b7e1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,3 +736,36 @@ point that out explicitly and clearly in the associated patches and Cc
736736
in case the process dies and its PID is quickly recycled. (This
737737
assumes systemd can acquire a pidfd of the foreign process without
738738
races, for example via `SCM_PIDFD` and `SO_PEERPIDFD` or similar.)
739+
740+
* Ability to put user xattrs on `S_IFSOCK` socket inodes
741+
742+
Currently, the kernel only allows extended attributes in the
743+
`user.*` namespace to be attached to directory and regular file
744+
inodes. It would be tremendously useful to allow them to be
745+
associated with socket inodes, too.
746+
747+
**Usecase:** There are two syslog RFCs in use today: RFC3164 and
748+
RFC5424. `glibc`'s `syslog()` API generates events close to the
749+
former, but there are programs which would like to generate the
750+
latter instead (as it supports structured logging). The two formats
751+
are not backwards compatible: a client sending RFC5424 messages to a
752+
server only understanding RFC3164 will cause an ugly mess. On Linux
753+
there's only a single `/dev/log` AF_UNIX/SOCK_DGRAM socket backing
754+
`syslog()`, which is used in a one-way, fire-and-forget style. This
755+
means that feature negotation is not really possible within the
756+
protocol. Various tools bind mount the socket inode into `chroot()`
757+
and container environments, hence it would be fantastic to associate
758+
supported feature information directly with the inode (and thus
759+
outside of the protocol) to make it easy for clients to determine
760+
which features are spoken on a socket, in a way that survives bind
761+
mounts. Implementation idea would be that syslog daemons
762+
implementing RFC5425 could simply set an xattr `user.rfc5424` to `1`
763+
(or something like that) on the socket inode, and clearly inform
764+
clients in a natural and simple way that they'd be happy to parse
765+
the newer format. Also see:
766+
https://github.com/systemd/systemd/issues/19251 – This idea could
767+
also be extended to other sockets and other protocols: by setting
768+
some extended attribute on a socket inodes, services could advertise
769+
which protocols they support on them. For example D-Bus sockets
770+
could carry `user.dbus` set to `1`, and Varlink sockets
771+
`user.varlink` set to `1` and so on.

0 commit comments

Comments
 (0)