feat(memfill): join target cgroup without cgexec - #478
Conversation
memfill placed its process into the target's memory cgroup via 'cgexec -g memory:<path>', which depends on libcgroup-tools (cgroup-tools / libcgroup-tools). That package does not exist for Enterprise Linux 9 and never supported cgroup v2, so the extensions using memfill (extension-host, extension-container) could not be installed on RHEL 9 / Rocky 9 / Alma 9, and fill memory could not charge the right cgroup on cgroup-v2 hosts. Join the cgroup directly instead: a tiny sh wrapper writes its own PID to <cgroup>/cgroup.procs (cgroup v1 memory controller preferred, v2 unified fallback) and then execs memfill. The move happens before exec so nothing is allocated in the wrong cgroup under v2. This removes the cgexec runtime dependency entirely, letting the rpm packages drop it from both Requires and Recommends.
|
|
Claude finished @achoimet's task in 2m 52s —— View job Claude's Review
Note: I wasn't able to run SummaryThis is a well-scoped, well-verified change. The
No Minor, non-blocking observations
No bugs, security issues, or concurrency problems found in the diff. |



Why
memfillplaced its process into the target's memory cgroup withcgexec -g memory:<path>, which depends on libcgroup-tools (cgroup-toolson deb,libcgroup-toolson rpm). That package:steadybit-extension-hostandsteadybit-extension-containercannot be installed on RHEL 9 / Rocky 9 / Alma 9 (nothing provides /usr/bin/cgexec).cgexec -g memory:does not do the right thing on the unified hierarchy that RHEL 9 / Ubuntu 22+ use by default.This is the long-term fix for the packaging problem worked around in extension-host#240 and setup-scripts#71.
What
Join the cgroup directly instead of shelling out to cgexec. A tiny
shwrapper writes its own PID to<cgroup>/cgroup.procsand then execs memfill:memory:<path>semantics while adding v2 support.execing keeps the same PID and charges all of memfill's allocation to the target cgroup.The public API (
NewMemfillProcess) is unchanged, so extension-host and extension-container pick this up on their nextaction-kitbump with no code changes.Verification
cgexecno longer appears.0::/memfilltestand appears in the target'scgroup.procs— i.e. memfill runs inside the target cgroup, move-before-exec confirmed.Follow-up (separate PRs, after this is released)
Once a released action-kit carries this, both extensions can drop the cgexec dependency from their
.goreleaser.yamlentirely (rpm Requires/Recommends and deb Depends), which also restores the fill-memory attack on EL9 / cgroup-v2 hosts.