Probe unshare capability once instead of failing a daemon launch per mode - #8
Open
davidoj wants to merge 1 commit into
Open
Probe unshare capability once instead of failing a daemon launch per mode#8davidoj wants to merge 1 commit into
davidoj wants to merge 1 commit into
Conversation
Without CAP_SYS_ADMIN every external daemon launch failed identically and
appended "unshare: unshare failed: Operation not permitted" to
djinn_daemon_bridge_{mode}.log on every attempt. Probe once per process,
log a single line, and skip the doomed launch. This also removes the 50 ms
poll() race that could mistake a slow-exiting unshare for a live daemon.
Salvaged from #2; the rest of that PR landed via #5 and #6.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rSFHpdtkVYpGAEafamz5R
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.
Salvaged from #2. The rest of that PR landed via #5 (
e2bimport) and #6 (env-var marker fix, byte-identical). TheProblemdefaults from #2 are deliberately not carried over: #6 decided to keepexploit_typeandinsecure_verifier_inforequired, and this branch leaves that as is.Problem
Without
CAP_SYS_ADMIN(typical in unprivileged containers and pods) every external daemon launch fails identically, appendingunshare: unshare failed: Operation not permittedto/tmp/djinn_daemon_bridge_{mode}.logon every attempt. Verification still works via the in-process forkserver fallback, but the log reads like a hard error, and the fallback was inferred fromproc.poll()after a 50 ms sleep — which could mistake a slow-exitingunsharefor a healthy daemon.Fix
_unshare_supported()probesunshare -Urmp --mount-proc --fork trueonce per process (lock-guarded, cached), prints one line either way, and_ensure_daemonskips the doomed launch entirely when the probe fails. The per-mode_unshare_failedcache is kept for the case where the probe passes but a real launch still fails.Testing
Daemon-backed stall tests plus
djinn/tests/test_marker_isolation.py, 17 tests, pass onmainand on this branch. Bridge log after the run:/tmp/djinn_daemon_bridge_*.logmain(unprivilegedpython:3.12-slim)unshare: unshare failed: Operation not permitted[djinn] namespace isolation unavailable (unshare: unshare failed: Operation not permitted); using in-process forkserver daemon instead. Verification results are unaffected; isolation is weaker.unsharebinary)`unshare` binary not found🤖 Generated with Claude Code
https://claude.ai/code/session_014rSFHpdtkVYpGAEafamz5R