magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
2 min read

MGS2005: kernel landlock unavailable; binding-level checks only

The sandbox is in best-effort mode but the host kernel does not support the landlock LSM. magus runs every child under its binding checks and env allowlist alone.

[MGS2005] kernel landlock unavailable; children run under magus's binding checks and env allowlist only
  reason=sandbox: kernel sandbox unsupported on this host: ...

Why

The sandbox enforces one policy through two layers:

  1. Kernel layer: magus starts each child through a launcher that applies the policy's landlock ruleset to itself and then execs the command, so the child and everything it starts are confined.
  2. Binding layer: magus's own fs, archive, crypto and http bindings and Buzz's own os and io check the policy before touching a path, and the exec binding checks the binary it is about to start.

When the kernel does not have landlock (macOS, Windows, Linux older than 5.13 or without the LSM enabled), only layer 2 runs. The notice is printed once, by the invocation you started; a nested magus prints nothing, since its parent already said it.

What still works

  • A magusfile or spell calling those bindings is refused when it targets a path outside the allowlist or writes a control file.
  • The first binary a step execs is checked against the exec allowlist.
  • Env scrubbing still applies (it runs in pure Go), so secrets stay out of the child's environment.

What does not work

  • Everything a subprocess does after it starts. sh, go test, npm and every other tool a spell runs read and write with the user's full authority. Running subprocesses is most of what a build does, so treat this host as having no filesystem sandbox for build steps.
  • Anything in magus that reaches the filesystem without going through a checking binding. The binding layer is a set of checks written into particular bindings, not a boundary around the interpreter.

Resolution

  • Run on Linux 5.13 or newer with landlock enabled (check that /sys/kernel/security/landlock exists).
  • To refuse this fallback instead of accepting it, set sandbox.mode: required (or MAGUS_SANDBOX=required); magus then stops with MGS2012 on a host like this one.
  • On macOS or Windows, accept the reduced enforcement knowingly, or pass --sandbox=off to run without the sandbox and without the notice. MAGUS_SANDBOX cannot do it: the variable is a floor that magus.yaml can raise and never lower.
MGS2005sandboxlandlockkernelmacOSLinuxinterpreterbest-effortenforcement
Last updated (a9ff8609)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

Invocation

One magus process's recorded facts - the targets it finished, their outcomes, the lease it acted as, and the session it ran in when a host delivered one - kept in a repo-scoped store every worktree shares. magus session lists them; the store prunes itself by last-fact age.

Window

The terminal a command runs in. It keys fire-once notices for a caller no host gave a session, and is never recorded as a session.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.