You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 890d339
Browse filesBrowse the repository at this point in the historyBrowse files
# 170 — #2114 and #2108: the fence that could not re-ask
2
+
3
+
Both reports are the same shape wearing two operating systems: a probe that
4
+
could not get an answer, a verdict of `unknown`, and a fence that holds for the
5
+
whole process. Every native request 503s and only `ocx restart` clears it.
6
+
7
+
Shipped as PR #2130, five commits.
8
+
9
+
## The three changes
10
+
11
+
**#2114 — the Linux session bus.**`inspectSystemd` called every non-zero exit
12
+
`unknown`. Its own comment was right that a non-zero status means the question
13
+
never reached the bus — and that is exactly why the verdict was wrong. It is
14
+
evidence about the bus, not about who owns this home.
15
+
16
+
Widening on the exit code alone fails open: with the bus down `systemctl`
17
+
cannot see a foreign unit either, so "no answer" would read as "no owner" on a
18
+
machine that has one. The classification asks the disk instead, which needs no
19
+
bus.
20
+
21
+
**#2108 (a) — an unaskable WinSW query.** WinSW is optional, and a
22
+
scheduler-only install has neither its XML nor its exe on disk. A timed-out
23
+
`sc.exe query` still returned `unknown`, which outranks the disk. With both
24
+
assets gone there is nothing for a registration to belong to.
25
+
26
+
**#2108 (b) — the fence re-asks.**`startServer` takes the verdict once and
27
+
holds it, which is why waiting never helped and restart always did. Correct for
28
+
`foreign-ownership` — a foreign owner is a fact. Wrong for
29
+
`ownership-unknown`, which says the probe could not answer.
30
+
31
+
## What the audit caught, three rounds running
32
+
33
+
This is the part worth keeping. The functional idea was right in round one; the
34
+
**ownership model was wrong three times in a row**, and each time the symptom
35
+
was identical — a fence with no way to re-ask, which is #2108 returning by
36
+
another route.
37
+
38
+
| Round | Defect | Why it slipped |
39
+
|---|---|---|
40
+
| 1 |`inspectSystemdOffline` checked ONE path, so a foreign unit in `~/.local/share/systemd/user` or an XDG override was invisible → `ownership: owned` on a foreign host | The bus-up path never had the hole; I reused its constant, not its coverage |
41
+
| 2 | The probe decremented the refcount AND the fence's own `release()` decremented again → a fence another holder owned got lifted |`Math.max(0, ...)` floored it, so it under-counted silently instead of going negative |
42
+
| 2 | A spent hook stayed in the map, so no LATER fence could install one | The "do not reset the budget" guard was right; its scope was not |
43
+
| 3 | Owner-identity guard was correct but **untested** — replacing it with `if (true)` left every suite green | A third route to the same wedge, with nothing pinning it |
44
+
45
+
Round 1's fail-open is the one that mattered: I wrote "a unit naming a foreign
46
+
home stays present and still blocks" in a commit message, and the auditor proved
47
+
it end-to-end as `ownership = owned`. The claim was true only for a unit at the
48
+
canonical path.
49
+
50
+
The fix that finally held is smaller than either attempt: the hook delegates to
51
+
the fence's own idempotent `release()`. One fence, one payment, whoever triggers
52
+
it. Both earlier versions were modelling the ownership in the wrong place.
53
+
54
+
## Guards, and the ones that were not guards
55
+
56
+
Every branch was ablated. Three that looked like guards were not:
57
+
58
+
- the multi-unit conflict branch — a fail-closed decision with nothing asserting
59
+
it; ablating it left the suite green
60
+
- "foreign never retries" — double-implemented, so removing either half alone
61
+
stayed green; only removing both failed
62
+
- the owner-identity check — round 3's finding, above
63
+
64
+
All three now have tests driven red against the real code.
65
+
66
+
## Stated rather than hidden
67
+
68
+
**Locale.** systemd localizes the bus-failure strings, so a non-English host
69
+
will not match and keeps the old `unknown`. That fences rather than admits,
70
+
which is the safe direction, but the #2114 fix does not reach every affected
71
+
user. Forcing `LC_ALL=C` on the probe would remove the caveat and is the
72
+
obvious follow-up; it is not done here because it changes every `systemctl`
73
+
call the module makes.
74
+
75
+
**Coverage.** These are Windows and Linux platform paths. The suites that prove
76
+
them ran on macOS and on `ssh lidge`; the platform CI legs are the check that
77
+
actually matters.
78
+
79
+
**A hostile `XDG_CONFIG_HOME`** redirects the offline check to an
80
+
attacker-chosen directory. The auditor raised it and then cleared it: reaching
81
+
that requires controlling the proxy's own environment, at which point
82
+
`CODEX_HOME` is equally controllable and the comparison is moot. No privilege
83
+
boundary is crossed.
84
+
85
+
## Coordination with #2029
86
+
87
+
Draft PR #2029 edits the same function for #1939 and classifies two other bus
88
+
messages as `absent`. This branch never touched it or its branch. The two
89
+
agree in direction; if it lands first this reconciles rather than replaces.
90
+
91
+
## Verification
92
+
93
+
```
94
+
full suite on ssh lidge 13,524 pass / 15 skip / 0 fail across 855 files
95
+
probe + startup + boundary 96 pass / 0 fail
96
+
bun x tsc --noEmit exit 0
97
+
bun run privacy:scan exit 0
98
+
```
99
+
100
+
One CI failure was investigated and dismissed on evidence: `keyring ubuntu`
101
+
stalled eight minutes on an apt mirror and was cancelled by the job timeout —
102
+
an infrastructure fault with no relation to the diff.
0 commit comments