Merged earlier this year for Linux 7.1 was extended attributes on sockets support as a feature sought after by the likes of GNOME and systemd for helping with Varlink IPC usage and other purposes. A limitation though of the functionality has been no efficient means for a BPF program to read those user extended attribute labels back. But with Linux 7.3 that's being addressed with the new bpf_sock_read_xattr() kernel function...

Merged earlier this year for Linux 7.1 was extended attributes on sockets support as a feature sought after by the likes of GNOME and systemd for helping with Varlink IPC usage and other purposes. A limitation though of the functionality has been no efficient means for a BPF program to read those user extended attribute labels back. But with Linux 7.3 that's being addressed with the new bpf_sock_read_xattr() kernel function.
Christian Brauner worked out the support for bpf_sock_read_xattr() to allow BPF programs read user.* extended attributes from a socket's sockfs inode locklessly. He explained of the new functionality in the patch series:
"systemd uses user.* xattrs on sockets to implement socket rate limiting and to tag sockets for other purposes such as implementing a varlink registry. There is currently no efficient way for a BPF program to read those labels back. The new helper allows a listening socket marked with an extended attribute to be read back during bind/connect and then act on the connect()ing socket. Extended attributes make it possible to allow an unprivileged user manager such as systemd --user to mark sockets from userspace and then rediscover them or implement policies.The kfunc is registered KF_RCU and only for BPF LSM programs. A struct socket is only guaranteed to live in sockfs when an LSM socket hook hands it out, which is what keeps SOCK_INODE() valid. Sockets that embed struct socket outside sockfs (tun, tap) are only reachable from tracing programs and are excluded by the registration. (Btw, for consistency it would be nice to force allocation of struct socket from sockfs instead of simply embedding it in e.g., struct tun_file which makes the SOCKFS_I() pattern a hazard - at least outside of sockfs functions.)
The read never sleeps and takes no lock. For sockfs the value lives in the inode's in-memory xattr store and simple_xattr_get() resolves it with an RCU-protected rhashtable lookup, taking neither the inode lock nor any xattr lock. The kfunc is therefore usable from both sleepable and non-sleepable LSM hooks."
That bpf_sock_read_xattr support is now merged via this pull for the Linux 7.3 kernel.
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Linux 7.3 binfmt_misc To Allow BPF Programs To Dynamically Choose Execution Environments | 0 | 7.83 | 16-08-2026 |
| 2 | IOmap Improvement For Linux 7.3 Takes EXT4 & XFS Performance Further | 0 | 13.69 | 18-08-2026 |
| 3 | XFS Lands FALLOC_FL_WRITE_ZEROES For Efficiency Improvement In Linux 7.3 | 0 | 14.43 | 18-08-2026 |
| 4 | Linux 7.3 SMP Improvement To Help Reduce Latency, Improve Real-Time Performance | 0 | 10.19 | 17-08-2026 |
| 5 | EFS & FreeVxFS File-Systems Get Booted While FailFS Merged For Linux 7.3 | 0 | 17.12 | 18-08-2026 |
| 6 | Linux 7.3 On PowerPC Now Supports In-Kernel Rust, Initial Power12 Enablement Begins | 0 | 14.16 | 17-08-2026 |
| 7 | Linux 7.3 To Land Initial Code Improving vRAM Management, More Improvements Coming | 0 | 6.61 | 17-08-2026 |
| 8 | Linux 7.3 Bringing A KCFI Optimization To Benefit Older Intel CPUs | 0 | 9.79 | 10-08-2026 |
| 9 | Linux 7.3 To Overcome "Significant Bottleneck" For Small I/O With PCIe Gen5 NVMe SSDs | 5 | 7 | 01-07-2026 |
| 10 | Intel & AMD Power Management Driver Improvements Ready For Linux 7.3 | 0 | 7.37 | 17-08-2026 |