Skip to content

fix(sandbox): allow read access to /sys for interface stats under Landlock#370

Merged
domcyrus merged 1 commit into
mainfrom
fix/landlock-sysfs-interface-stats
Jun 2, 2026
Merged

fix(sandbox): allow read access to /sys for interface stats under Landlock#370
domcyrus merged 1 commit into
mainfrom
fix/landlock-sysfs-interface-stats

Conversation

@domcyrus
Copy link
Copy Markdown
Owner

@domcyrus domcyrus commented Jun 2, 2026

The Landlock ruleset handles all filesystem reads but only added read allow-rules for /proc and the GeoIP read_paths. The interface-stats poller enumerates interfaces via read_dir("/sys/class/net") and reads each /sys/class/net//statistics/* counter, which got denied with EACCES once the sandbox was enforced. The error was swallowed at debug level, so the Interfaces panel silently showed "No interface stats available" (independent of -i any vs auto-detected interface).

Add read-only allow-rules for /sys/class/net (enumeration) and /sys/devices (the per-interface statistics entries are symlinks into /sys/devices and Landlock evaluates the resolved path). Sandbox stays fully enforced; this only grants read.

Also surface the stats-collection failure once at warn! instead of a silent debug!, so a future sandbox/permission regression is visible at the default log level.

Verified in OrbStack (Landlock ABI 7, FullyEnforced): without the rule read_dir("/sys/class/net") fails with EACCES; with it all interfaces are readable.

…dlock

The Landlock ruleset handles all filesystem reads but only added read
allow-rules for /proc and the GeoIP read_paths. The interface-stats
poller enumerates interfaces via read_dir("/sys/class/net") and reads
each /sys/class/net/<iface>/statistics/* counter, which got denied with
EACCES once the sandbox was enforced. The error was swallowed at debug
level, so the Interfaces panel silently showed "No interface stats
available" (independent of -i any vs auto-detected interface).

Add read-only allow-rules for /sys/class/net (enumeration) and
/sys/devices (the per-interface statistics entries are symlinks into
/sys/devices and Landlock evaluates the resolved path). Sandbox stays
fully enforced; this only grants read.

Also surface the stats-collection failure once at warn! instead of a
silent debug!, so a future sandbox/permission regression is visible at
the default log level.

Verified in OrbStack (Landlock ABI 7, FullyEnforced): without the rule
read_dir("/sys/class/net") fails with EACCES; with it all interfaces are
readable.
@domcyrus domcyrus merged commit e2a26ea into main Jun 2, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant