Eventually implement landlock LSM for restricting abstract unix sockets #877
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#877
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Someone, I think @vriska, pointed out on matrix that it’s possible to landlock unix sockets into just their own landlock zone thing. This sounds sick, we should do it.
Problem is that they’re restricted to 6.12 and higher, or whatever libc bump we need for the headers. We could feature detect but it’ll be a pain until we have headers for it in stable nixpkgs, which maybe we do already?
25.05 has 6.12 but I'm not a big fan of it because VM tests that makes intense use of 9pfs cannot use 6.12 due to 9pfs folio management being broken there, FWIW.
Nixpkgs 25.05's
linuxHeadersis from 6.12, so I think doing feature detection is probably fine?all kernel versions < 6.12 but 6.1 are marked for EOL in dec 2026, so maybe we can start working on this then
It's better done at the systemd level in https://github.com/systemd/systemd/issues/37963
@raito Doing this at the systemd level would presumably mean blocking abstract Unix sockets entirely, which I don't think is ideal if it's avoidable. Having the sandbox use Landlock would allow isolating each build such that they can use sockets independently.
(Also, as far as I know this isn't blocked? It'd just need a check that the Landlock ABI version is at least 6.)
@vriska blocking abstract Unix sockets at the systemd unit level would block them for nix-daemon@.service template and its subdaemons, do you have usecases of abstract unix domain sockets inside subdaemons but not inside builds themselves?
What do you mean? The mechanism I'm proposing would allow builds to each use independent abstract Unix sockets. Am I misunderstanding the goal of this issue?
@vriska wrote in #877 (comment):
For me, the goal is first and foremost to harden against malicious derivations exploiting abstract UDS to cooperate with the external world or fellow derivations.
Enabling derivations to use abstract UDS for their testing and stuff comes second to me. In general, our own sandboxing code is not great so I would prefer not tack on more functionality in there until we overhaul it.