Linux Kernel & OS

systemd v263-rc1 introduces VSOCK isolation and stricter /run/ protections

Key Takeaway

systemd v263-rc1 implements significant security hardening by isolating AF_VSOCK sockets via network namespaces and enforcing read-only /run/ directories under strict protection modes.

Summary

The release of systemd v263-rc1 introduces several breaking changes and security enhancements aimed at tightening namespace isolation. A major change involves the default configuration of net.vsock.child_ns_mode, which now isolates AF_VSOCK sockets by network namespace. This affects containers and services using PrivateNetwork=yes, as they will no longer be able to reach host-side vsock services or hypervisors via guest-to-host transports.

Additionally, the release fixes a long-standing behavior where /run/ remained writable even when ProtectSystem=strict was enabled. The update ensures /run/ is correctly treated as read-only in these scenarios, requiring services to explicitly request write access via RuntimeDirectory= or ReadWritePaths=. The release also announces the upcoming removal of inotify-backed device watch support in favor of fanotify.

Technical changes in systemd v263-rc1

  • Network Isolation: The sysctl net.vsock.child_ns_mode is now set to 'local' by default on kernels v7.0+, meaning AF_VSOCK sockets are isolated by network namespaces; this prevents processes in private network namespaces from accessing host vsock services.
  • Filesystem Hardening: Under ProtectSystem=strict, the /run/ directory is now strictly read-only, correcting a previous issue where MountAPIVFS= left the directory writable in shared mount namespaces.
  • Device Watching Deprecation: Future versions will remove inotify-backed device watch support, mandating the use of fanotify, which requires Linux kernel v5.13 or newer with CONFIG_FANOTIFY, CONFIG_TMPFS, and CONFIG_SHMEM enabled.
  • Namespace Environment Variables: The service manager now populates $LISTEN_PID, $LISTEN_PIDFDID, $WATCHDOG_PID, and $SYSTEMD_EXEC_PID after setting up the service's PID namespace to support socket activation with PrivatePIDs=yes.
  • Transient Unit Improvements: Empty assignments to *Directory= transient properties now reset the corresponding directory list rather than being ignored, and colon/quote escaping has been improved for D-Bus paths.

Why it matters

System administrators and container developers must review service files using PrivateNetwork=yes or those relying on vsock for host-guest communication to prevent connectivity loss. Linux distribution maintainers will need to ensure initrd configurations are updated to handle the write-once nature of the new vsock sysctl setting.

What to do

  • Services using PrivateNetwork=yes that need to reach host vsock services should mask the net.vsock.child_ns_mode sysctl setting.
  • Services using ProtectSystem=strict that require a writable /run/ directory must explicitly request access via ReadWritePaths= or RuntimeDirectory=.
  • Prepare for the removal of inotify-backed device watch support by ensuring your system uses Linux kernel v5.13 or newer with CONFIG_FANOTIFY, CONFIG_TMPFS, and CONFIG_SHMEM enabled.

Original reference: github.com →