Repository navigation
test(rig-lock): open the lock read-only so a non-root reserve can't EACCES the root gate (#242) - #245
Merged
Merged
Conversation
VijitSingh97
enabled auto-merge (squash)
July 12, 2026 01:24
…ACCES the root gate (#242) /var/lock -> /run/lock is a sticky world-writable tmpfs with fs.protected_regular=2. A lock file first created by a NON-root flock (a manual reserve after a reboot clears the tmpfs) is owned by that user, and protected_regular then blocks even root's O_CREAT-write (exec 9>) of it with EACCES — the release perf gate aborted with 'Permission denied' until the file was rm'd (hit live during the v1.7.0 rollout). Open the lock read-only (exec 9<) instead: a read-open is never protected_regular-guarded and flock -x/-s works on a read fd, so this sidesteps it without rm-ing a possibly-held lock. Applied to both e2e-real.sh and e2e-pithead.sh (drift guard keeps them identical); 2 new tests; live-verified on miner-3 (vijit-created lock: old 9> EACCES, new 9< ACQUIRED). Closes #242 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
VijitSingh97
force-pushed
the
claude/rig-lock-readfd-242
branch
from
July 12, 2026 01:25
c85f074 to
7e31500
Compare
VijitSingh97
added a commit
that referenced
this pull request
Jul 13, 2026
…ACCES the root gate (#242) (#245) /var/lock -> /run/lock is a sticky world-writable tmpfs with fs.protected_regular=2. A lock file first created by a NON-root flock (a manual reserve after a reboot clears the tmpfs) is owned by that user, and protected_regular then blocks even root's O_CREAT-write (exec 9>) of it with EACCES — the release perf gate aborted with 'Permission denied' until the file was rm'd (hit live during the v1.7.0 rollout). Open the lock read-only (exec 9<) instead: a read-open is never protected_regular-guarded and flock -x/-s works on a read fd, so this sidesteps it without rm-ing a possibly-held lock. Applied to both e2e-real.sh and e2e-pithead.sh (drift guard keeps them identical); 2 new tests; live-verified on miner-3 (vijit-created lock: old 9> EACCES, new 9< ACQUIRED). Closes #242 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #242. Hit live during the v1.7.0 rollout: a manual non-root
flockreserve created/run/lock/rig-e2e.lockowned by that user, and withfs.protected_regular=2(Ubuntu default) the roote2e-real.shrig_lock'sexec 9>(O_CREAT-write) then failed with EACCES — aborting the perf gate until the file wasrmed.Fix: open the lock read-only (
exec 9<). Read-opens aren't protected_regular-guarded andflock -x/-sworks fine on a read fd, so this sidesteps the block without everrm-ing a possibly-held lock (the tmpfiles pre-create the issue floated would have added clutter to every production rig; this doesn't). Applied identically toe2e-real.shande2e-pithead.sh(the #183 drift guard keeps them in lockstep). The~/README.mdbox contracts already updated to reserve-as-root as belt-and-suspenders.Verification: 2 new sandbox tests (pre-existing file; restrictive-mode file); all 11 existing #183 lock tests still green; and a live root repro on miner-3 — a
vijit-created lock file: old9>→ EACCES, new9<→ ACQUIRED. Local gate: 1227 passed / 0 failed, lint + lint-md green.