Repository navigation
Conversation
This was referenced Oct 9, 2026
zkwentz
force-pushed
the
zkwentz/openenvd-k3-kernel
branch
from
October 12, 2026 17:35
e438db8 to
c0d619d
Compare
zkwentz
changed the base branch from
zkwentz/openenvd-k2-trace
to
zkwentz/openenvd-k1-contract
October 12, 2026 17:35
zkwentz
force-pushed
the
zkwentz/openenvd-k3-kernel
branch
from
October 13, 2026 00:31
c0d619d to
3a6439f
Compare
1 task done
zkwentz
force-pushed
the
zkwentz/openenvd-k3-kernel
branch
from
October 13, 2026 01:09
3a6439f to
4b8b997
Compare
| body() | ||
| msg = "" | ||
| status = 0 | ||
| except BaseException as exc: # noqa: BLE001 - report, never propagate |
| for pid in pids: | ||
| try: | ||
| os.kill(pid, signal.SIGKILL) | ||
| except (ProcessLookupError, PermissionError): |
| return f"cgroup root is not writable ({exc.strerror})" | ||
| try: | ||
| probe.rmdir() | ||
| except OSError: |
Part 2 of 5 of openenvd on kernel primitives (#1053). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zkwentz
force-pushed
the
zkwentz/openenvd-k3-kernel
branch
from
October 13, 2026 14:23
4b8b997 to
902f6ff
Compare
cgroup_of_pid and is_within lost their only caller with peercred. The fake-cgroupfs removal now lives in the test fixture instead of cgroups.py. The real-kernel test can adopt the cgroup root when a throwaway container opts in, so it runs instead of skipping in privileged Docker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zkwentz
marked this pull request as ready for review
October 13, 2026 17:36
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This layer decides whether openenvd can isolate, and controls each zone's processes when it can.
preflight.py. One yes-or-no decision, with the reasons when it's no. Isolation is on when all of these hold:crun) is installed.That's true inside a microVM or a
--privilegedcontainer. Every failed check says how to fix it, for example(run the container with --privileged).cgroups.py. The unit's cgroup v2 tree (control/,zones/<zone>/<container>):cgroup.freeze;cgroup.kill, so a fork bomb can't outrun it;populated 0;This replaces an earlier design that probed the host and picked between three tiers. The deployment assumption makes that unnecessary: production runs in a microVM, and everything else simply runs without isolation.
Test plan
run.shin openenvd 5/5: unit assembly, daemon, enforcement check and live tests #1387 runs them on every live run.Stack
Part of openenvd on kernel primitives (#1053). Review bottom-up; each PR shows only its own layer.
Deployment assumption: openenvd ships in every image. Run privileged (a microVM in production, or
docker run --privilegedin development) and it isolates. Run any other way and it logsisolation disabledand serves the environment exactly as before.The trace machinery (hash-chained trace, seal, harness self-report cross-check,
/observe) is parked onzkwentz/openenvd-with-traceand is out of this stack's scope.🤖 Generated with Claude Code
Note
Medium Risk
New kernel-facing cgroup and namespace probing code affects process lifecycle and resource limits; misconfiguration could break isolation or teardown, though preflight is designed to disable isolation when prerequisites fail.
Overview
Adds isolation preflight and a cgroup v2 control layer for openenvd: decide whether the unit can run containers, and manage per-zone process trees when it can.
preflightreturns a single enable/disable result with log-friendly failure reasons (Linux, root, namespace creation in a forked child, writable cgroup v2 root, OCI runtime discovery forcrun/runc/runsc). Failed checks include hints such as--privilegedand--cgroupns=private.cgroups.CgroupTreeowns the unit cgroup namespace:adopt_selfintocontrol/, create delegated paths likezones/agent/{env,harness}, applyResourceslimits (memory, swap off, pids, cpu), move PIDs, freeze/thaw, kill viacgroup.killor SIGKILL sweep, async wait for frozen/empty, stats, and subtree removal.Tests cover fake cgroupfs behavior plus an optional root-only Linux lifecycle test.
Reviewed by Cursor Bugbot for commit eb77c21. Bugbot is set up for automated code reviews on this repo. Configure here.