Skip to content

fix(e11): a pid reaped mid-sample is gone, not an ambiguous refusal (#302) - #310

Merged
pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:fix/302-pid-mm-gone-enoent
Sep 21, 2026
Merged

pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:fix/302-pid-mm-gone-enoent

Conversation

@pdettori

@pdettori pdettori commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Closes #302. Finishes what #299 started.

Stack: this is 1/3 of the e11-density.sh stack (#302 → rossoctl/moca-experiments#8 → #305). It targets main.
The next two target the branch below them, because all three edit the same two files.

The gap

#299 excuses a dying VMM only when /proc/<pid>/cmdline is readable and empty. But the
caller's guard is kill -0 && ! pid_mm_is_gone, so the pid was alive a moment ago and can be
reaped inside that window — and then the redirection fails with ENOENT, which #299
classified as "ambiguous" and still refused.

Observed 4 times across 4 runs on srv-r16b14s16. Inside host_signals_snapshot's
idle-standby poll that refusal is fatal, so it aborts the ladder.

The discriminator, and why it is not "the entry is absent"

A re-test of kill -0. Case F of the test file already pins that a live pid with an absent
cmdline must keep refusing, because that is indistinguishable from a misconfigured
SH_E11_PROC_ROOT — the optimistic-direction failure spec §7.3 forbids. So "absent" alone is not
safe to act on; "absent AND the task is now gone" is.

EPERM/EIO on a live, memory-holding process still refuses, and new Case I pins that the hole
stays shut.

kill -0 only separates the two because this sampler runs as root — unprivileged it also fails
with EPERM on another user's live process. That is not a new exposure (the caller's own gate would
already have skipped such a pid), but it is recorded in the source, because it makes the root
requirement load-bearing rather than conventional.

Also in here

  • The [ -r ] pre-test is dropped, not patched. It bought nothing — the read is the real
    test, and the file must be read rather than stat'ed anyway, since every procfs file reports
    st_size 0 — while adding a second, differently-handled failure path for one condition.
  • The stderr redirect now wraps the whole group. tr ... 2>/dev/null never covered this: the
    failure is in the redirection, which bash reports itself before tr runs. That is the source
    of the bare line NNN: ...: No such file or directory in the run logs.
  • The reads-after--r refusal is reworded. It used to end "Most likely the pid is not ours:
    check SH_E11_VMM_PROC_PATTERN"
    . In every observed occurrence that variable was unset at its
    correct default and the box was idle — and it is meant to stay unset (the jailer chroots, so
    its install path matches nothing, and any value passed is matched inside sudo's own argv by the
    unscoped pgrep -f). The message named the one thing that was not the cause and pushed the
    reader toward making it worse. It now names ptrace gating and a wrong SH_E11_PROC_ROOT.

On two of the four new checks

Cases H and J assert on the source text, not by execution, and say so in place. Both triggers
are TOCTOU races that cannot be staged deterministically, and the portable stand-ins do not
reproduce them: on macOS open() on a directory succeeds and awk simply reads nothing, so
such a test passes with or without the fix. I wrote Case H by execution first, watched it pass
against the unfixed source, and replaced it — a vacuous green is worse than no test.
Source-shape assertions are this file's existing idiom for exactly this.

Verification

check result
bash deploy/microvm/tests/e11-density.test.sh 473 ok, 0 FAIL, exit 0 (463 before)
same suite, source reverted to pre-PR 6 FAIL
same suite, source reverted to the first commit 2 FAIL (both Case K behavioral checks)
make lint (shellcheck + prettier + gitleaks) exit 0

The "466 before" in the first version of this table was wrong — review caught it by
grepping static check calls (446 → 453, +7) against a table claiming +4. The real pre-PR
number is 463, measured by reverting both files inside the same worktree rather than by
extracting deploy/microvm/ alone, which silently skips whole blocks. 463 → 470 was exactly
the +7 static delta; no loop-driven count had shifted. With round 2 the static count is 456
and the suite is 473, still +10/+10.

The reworded-refusal assertions were separately re-proven against the original message after I
revised them: my first version asserted the variable was never named, which the new message
violates on purpose (it names it to say "leave this unset"). The assertion now pins the
misdirection — check SH_E11_VMM_PROC_PATTERN — not the substring.


Review round 2 (6e78988)

  • The wrong-root hint moved to the refusal that can reach it. A wrong SH_E11_PROC_ROOT
    makes the proc entry absent, so [ ! -r "$smaps" ] is true and the first refusal fires
    — confirmed by execution against an empty PROC_ROOT and a live pid. Offering it as a cause
    of the second sent a reader whose root was almost certainly fine off to re-verify it, a
    milder form of the misdirection this PR removes. It now lives on the first refusal, which
    until now offered no diagnosis at all; the second names it only to rule it out. New Case K
    pins both halves and both fail against 0bdb0cd.
  • Case H's pattern is anchored to the cmdline read (<"$cmdline"; } 2>/dev/null) instead of
    a bare } 2>/dev/null. $pss_body holds both functions, so a future group redirect anywhere
    in pss_bytes_for_pids would have turned it green regardless — the exposure Case J already
    guards against. Proven reachable by mutation: with fix(e11): a dying VMM contributes 0 to Σ PSS, it is not a refusal #299's bug restored plus an unrelated
    { : ; } 2>/dev/null, the old pattern reports ok and the anchored one FAILs.
  • Two nits: the dead $fake_proc/$dead_pid/cmdline rmdir operand (nothing ever creates
    it — Case C picks dead_pid by walking kill -0 upward precisely so no entry exists), and a
    stray second blank line at the Case E/F boundary.

One honest limit recorded in the thread: of the two Case K checks, only root_diagnosed also
fails against pre-PR source. The other passes there vacuously, because the old message never
named the root — it is a regression guard against re-adding it, like Case I, not a proof of
new behavior.

🤖 Generated with Claude Code

…ossoctl#302)

rossoctl#299 excuses a dying VMM only when /proc/<pid>/cmdline is READABLE AND EMPTY. But
the caller's guard is `kill -0 && ! pid_mm_is_gone`, so the pid was alive a moment
ago and can be reaped inside that window -- and then the redirection fails with
ENOENT, which rossoctl#299 classified as "ambiguous" and still refused. Observed 4 times
across 4 runs on srv-r16b14s16, and inside host_signals_snapshot's idle-standby
poll that refusal is fatal, so it aborted the ladder.

The discriminator is a RE-TEST of `kill -0`, deliberately not "the proc entry is
absent": Case F of the test file pins that a LIVE pid with an absent cmdline must
keep refusing, because that is indistinguishable from a misconfigured
SH_E11_PROC_ROOT -- the optimistic-direction failure spec section 7.3 forbids.
"Absent AND the task is now gone" is the only safe reading. EPERM/EIO on a live,
memory-holding process still refuses, and Case I now pins that the hole stays shut.

The `[ -r ]` pre-test is dropped rather than patched. It bought nothing -- the read
is the real test, and the file must be READ rather than stat'ed anyway, since every
procfs file reports st_size 0 -- while adding a second, differently-handled failure
path for the same condition.

The stderr redirect now wraps the whole group. `tr ... 2>/dev/null` does not cover
this: the failure is in the REDIRECTION, which bash reports itself before tr is
executed, which is where the bare "line NNN: ...: No such file or directory" in the
run logs came from.

Also rewords the reads-after-r refusal. It used to end "Most likely the pid is not
ours: check SH_E11_VMM_PROC_PATTERN". In every observed occurrence that variable was
unset at its correct default and the box was idle, and it is meant to STAY unset:
the jailer chroots so its install path matches nothing, and any value passed is
matched inside sudo's own argv by the unscoped pgrep -f. So the message named the one
thing that was not the cause and pushed the reader toward making it worse. It now
names ptrace gating and a wrong SH_E11_PROC_ROOT, and says explicitly that the
pattern variable should be left unset.

Two of the four new checks assert on the source text rather than by execution, and
say so: both triggers are TOCTOU races that cannot be staged deterministically, and
the portable stand-ins do not reproduce them -- on macOS open() on a directory
succeeds and awk just reads nothing, so such a test passes with or without the fix.
Source-shape assertions are this file's existing idiom for that situation.

470 checks pass (466 before); shellcheck and prettier clean.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bellissimo. This is the kind of fix where the reasoning is the deliverable, and the reasoning holds — I traced it rather than took it.

I walked all four combinations of read-fails x task-alive through the old and new pid_mm_is_gone. The only behavioral change is the intended one: read fails and the task is gone now returns 0 instead of 1. The misconfigured-SH_E11_PROC_ROOT hazard still refuses (a wrong root means a live pid, so the kill -0 re-test succeeds and you fall to return 1). No new hole, and the §7.3 optimistic direction stays closed.

Three other claims I checked rather than trusted:

  • Both call sites gate on kill -0 first (e11-density.sh:667 and :687), so the root-requirement note at :650-654 is load-bearing and accurate — unprivileged EPERM on another user's live process really cannot reach the function.
  • The group redirect is correct bash. A group's redirections are installed before the inner command runs, so bash's own redirection error lands in the group's already-muzzled stderr. tr ... 2>/dev/null genuinely never could have covered it — that bare line NNN: ... No such file or directory had no other exit.
  • "5 FAIL when reverted" is exactly right. Pre-fix: G fails, H fails, and three of the four Case-J wording checks fail. Case I and the J presence-check pass pre-fix, which is correct — those are regression guards, not new-behavior proofs. Nice that the number is honest in both directions.

Dropping [ -r ] instead of patching it is the right call: one condition deserves one failure path, and the read was always the real test. And writing Case H by execution, watching it pass against unfixed source, then replacing it with a source-shape assertion — perfetto. A vacuous green really is worse than no test, and most people never go back to check.

Nothing blocking. Two suggestions and two nits inline.

One arithmetic nit on the verification table: static check calls go 446 → 453 (+7 by grep on both revisions), but the table reads 470 ok / 466 before (+4). If a loop-driven count shifted under the source diff, that reconciles it — otherwise one of those two numbers is from an older tree.


Areas reviewed: Shell (source + tests), commit conventions, security
Agent/IDE config (.claude/.vscode): none
Commits: 1, signed-off — and Assisted-By, matching the repo's CLAUDE.md
CI: 13/13 passing

# and such a test passes with or without the fix). Source-shape assertions are this
# file's existing idiom for exactly that situation.
case "$pss_body" in
*'} 2>/dev/null'*) muzzled=yes ;;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — this pattern is matched against $pss_body, which extract_fns builds from both pid_mm_is_gone and pss_bytes_for_pids. I confirmed } 2>/dev/null is unique in that body today, so the check is not vacuous right now.

But that is precisely the vacuity you guarded against 40 lines down in Case J — "Matched on the die LINE, not the whole body -- pss_bytes_for_pids' own comments already discuss ptrace gating, so a body-wide match would pass vacuously." The same exposure applies here: any future group redirect anywhere in pss_bytes_for_pids silently turns this green regardless of the cmdline read.

Anchoring it to the actual redirect costs nothing and makes it unfoolable:

  *'<"$cmdline"; } 2>/dev/null'*) muzzled=yes ;;

Your own Case J reasoning, applied one case earlier.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anchored: *'<"$cmdline"; } 2>/dev/null'*.

I checked whether the vacuity was actually reachable rather than taking it on the argument. Mutation: restore #299's bug on the cmdline read (tr -d '\0' <"$cmdline" 2>/dev/null, no group) and add an unrelated { : ; } 2>/dev/null inside pss_bytes_for_pids:

=== anchored pattern ===
  FAIL: the cmdline read muzzles the REDIRECTION's own error, not just tr's (want 'yes', got 'no')
=== same mutation, old unanchored pattern ===
  ok: the cmdline read muzzles the REDIRECTION's own error, not just tr's

So the hole was real, not theoretical — the old pattern reports green on a source that has the bug back. The comment above the case now records the anchor and cites Case J's reasoning, so the next person editing it sees why the pattern is longer than it needs to be.

Comment thread deploy/microvm/e11-density.sh Outdated
if [ "$pid_rc" -ne 0 ] || [ -z "$pid_kb" ]; then
if kill -0 "$pid" 2>/dev/null && ! pid_mm_is_gone "$pid"; then
die "smaps_rollup for pid $pid ($smaps) passed a readability test and then FAILED to read while the process is still alive - refusing to let it contribute 0 bytes to Sigma PSS (spec section 7.3's boxed warning). Most likely the pid is not ours: check SH_E11_VMM_PROC_PATTERN, which is matched with an unscoped pgrep -f and will pick up any process whose command line contains the pattern, including another user's."
die "smaps_rollup for pid $pid ($smaps) passed a readability test and then FAILED to read while the process is still alive AND still holds an address space - refusing to let it contribute 0 bytes to Sigma PSS (spec section 7.3's boxed warning). The two benign causes are already excused before this point: a task whose mm is torn down (empty cmdline) and one reaped mid-sample (#302). What is left is a live, memory-holding process we genuinely cannot read - most likely ptrace gating on a process we do not own, where the mode bits let -r pass and the open still yields EPERM, or an SH_E11_PROC_ROOT that is not this host's /proc. Note it is NOT evidence that SH_E11_VMM_PROC_PATTERN needs setting: it is meant to stay unset, because the jailer chroots so its install path matches nothing, and any value passed is matched inside sudo's own argv by the unscoped pgrep -f."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — the rewording is a clear improvement, and naming the pattern variable in order to say "leave this unset" is much better than silence. One thing about the other half of the new diagnosis, though.

The message offers two likely causes: ptrace gating, or "an SH_E11_PROC_ROOT that is not this host's /proc". The first is exactly right. The second is hard to reach from here — a wrong root means $PROC_ROOT/$pid/smaps_rollup does not exist, [ ! -r "$smaps" ] is true, and you take the first die at line 668 instead. Landing on this one requires a path that passes -r and then fails to open: a directory at that name, an ENODEV-ish mount, something contrived.

So a reader who actually got this refusal has their root almost certainly configured fine, and now has a second thing to go rule out. That is a milder version of the failure this PR is fixing.

Both messages do interpolate $smaps, so the effective root is visible either way — which is why this is a suggestion and not a must-fix. But if the wrong-root hint belongs anywhere it is at line 668, which currently offers the reader no diagnosis at all.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified by execution rather than by reading, and you're right — an empty PROC_ROOT plus a genuinely live pid takes the first refusal:

DIE: smaps_rollup unreadable for pid 75250 (/tmp/wrongroot.I9hPOz/75250/smaps_rollup) - refusing to fall back to RSS (spec section 7.3's boxed warning)

kill -0 succeeds, pid_mm_is_gone fails its read and then re-tests kill -0 successfully, so ! pid_mm_is_gone holds and line 668 fires. Reaching the second one that way really does need a path that passes -r and then fails to open.

So the hint moved to line 668, which offered the reader nothing. It now says: alive and still holding an address space, and this is the absent case rather than the refused-open one — running as root the mode bits let -r pass even on a process we do not own, so ptrace gating fails at the open and takes the other refusal. Likely cause: an SH_E11_PROC_ROOT that is not this host's /proc; failing that, a kernel with no smaps_rollup at all (pre-4.14), where it is absent for every pid.

The second refusal no longer offers it as a cause — it names it only to rule it out, which is the same trade the SH_E11_VMM_PROC_PATTERN clause already makes:

A wrong SH_E11_PROC_ROOT is NOT it: that makes the entry absent, which takes the refusal above instead.

New Case K pins both halves, matched on each die line for the reason you gave here — both function bodies discuss PROC_ROOT in comments, so a body-wide match would pass vacuously either way. Both new behavioral checks fail against the previous head:

=== source @ 0bdb0cd, tests as edited ===
  FAIL: the absent-smaps_rollup refusal names the cause that can actually reach it (a wrong root)
  FAIL: the reads-after-r refusal no longer offers a wrong root as a likely cause

One honest limit: against pre-PR source, only the first of those fails. The second passes there vacuously, because the old message never named the root at all — it is a regression guard against re-adding it, in the same category as Case I and Case J's presence check, not a proof of new behavior.

) || rc_live_unreadable=$?
check "a LIVE pid whose cmdline cannot be read still refuses (EPERM/EIO hole shut)" \
"$([ "$rc_live_unreadable" -ne 0 ] && echo refuses || echo "admitted")" "refuses"
rmdir "$fake_proc/$live_pid/cmdline" "$fake_proc/$dead_pid/cmdline" 2>/dev/null || true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — the second operand is dead. Nothing ever creates $fake_proc/$dead_pid/: Case C picks dead_pid by walking kill -0 upward and then calls pss_bytes_for_pids "$dead_pid" against a fake_proc that has no entry for it, which is exactly why Case G's "absent proc entry" precondition holds for free.

Harmless under 2>/dev/null || true, but it implies Case G staged a directory there, and a later reader may well go looking for the mkdir that matches it. rmdir "$fake_proc/$live_pid/cmdline" alone says what actually happened.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped — rmdir "$fake_proc/$live_pid/cmdline" alone now.

Confirmed rather than assumed: every mkdir/redirect under $fake_proc names $live_pid (lines 224, 294, 310, 395), and Case C picks dead_pid by walking kill -0 upward, which is exactly why Case G's "absent proc entry" precondition holds for free. Nothing has ever created that path.

"$([ "$rc_hasmm" -ne 0 ] && echo yes || echo no)" "yes"
check "that refusal still names smaps_rollup" "$named_hasmm" "yes"


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — stray second blank line, unrelated to the change. Every other case boundary in this block uses one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The fix is correct and the discriminator choice is well-argued: re-testing kill -0 rather than treating an absent proc entry as proof, which preserves Case F's guard against a misconfigured SH_E11_PROC_ROOT. Dropping [ -r ] rather than patching it is the right call — it was the source of the very short-circuit that hid the stderr leak.

The reworded refusal is a genuine improvement: the old message named the one variable that was never the cause and pushed the reader toward setting it.

Verified by reproduction, not taken on trust

I reproduced the central claims locally (macOS, bash 3.2.57):

what I ran result
old form tr … <absent 2>/dev/null leaks bash: …: No such file or directory
new group-wrapped form, same input silent
an execution-based Case H against the pre-fix source passes vacuously — the [ -r ] short-circuit means the redirect never runs, so there is no stderr to assert on
} 2>/dev/null occurrences in the file exactly 1 → the source-shape assertion carries no false-pass risk
Case I on macOS redirect from the directory fails, kill -0 succeeds → returns 1, refuses. Non-vacuous.

So the decision to make Cases H and J source-shape assertions is sound, and the "a vacuous green is worse than no test" reasoning in the description checks out — I confirmed the vacuous-green outcome directly. One footnote on the mechanism named for it, in an inline comment.

Areas reviewed: Shell (bash), tests, commit/PR conventions, security
Commits: 1, signed-off (DCO passing)
CI status: all 13 checks passing
Findings: 0 must-fix, 1 suggestion, 2 nits

Two minor notes that did not warrant inline comments: the title is 74 characters (2 over the 72 guideline), and the description repeats the open()-on-a-directory mechanism discussed inline.

Ho verificato tutto per riproduzione — fidarsi è bene, controllare è meglio. The [ -r ] removal is the quiet star of this patch: it is what turns the stderr leak from invisible into reproducible.

# Case I: the hole stays shut. Same unopenable cmdline, but the task is ALIVE --
# EPERM/EIO on a live, memory-HOLDING process is the hazard the guard exists for
# (spec section 7.3 forbids the RSS fallback), so it must still refuse.
mkdir -p "$fake_proc/$live_pid/cmdline"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion — this mkdir -p only succeeds because Case F removed that same path as a file at line 329, and the file is nowhere recreated in between.

The suite runs under set -uo pipefail with no errexit, so the dependency is silent if it ever breaks. mkdir -p over an existing regular file fails with File exists (rc=1), and nothing here checks it:

$ : > cmdline && mkdir -p cmdline; echo $?
mkdir: cmdline: File exists
1

If Case F is reordered, or its rm -f dropped, Case I would then read the populated cmdline written at line 310 (firecracker\0--id\0vm-7\0) — the read succeeds, content is non-empty, pid_mm_is_gone returns 1, and the check still reports refuses. Passing for entirely the wrong reason, and green either way.

Making the fixture self-contained closes it:

rm -f "$fake_proc/$live_pid/cmdline"
mkdir -p "$fake_proc/$live_pid/cmdline"

Not a live bug — the ordering holds today. But given how deliberately the rest of this block guards against vacuous greens, this one is worth pinning too.

#
# Asserted against the SOURCE TEXT rather than by execution, deliberately: the
# runtime trigger is a TOCTOU race that cannot be staged deterministically, and the
# portable stand-ins do not reproduce it (on macOS, open() on a directory SUCCEEDS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — the conclusion is right but the mechanism named is not quite what happens. On macOS (bash 3.2.57, Darwin 25) a redirect from a directory does fail:

$ bash -c 'c="$( { tr -d "\0" <somedir; } 2>/dev/null )"; echo rc=$?'
rc=1

So it is not that open() succeeds and awk/tr reads nothing. What makes the directory stand-in vacuous is that neither form emits a bash-level redirection diagnostic for a directory — the old narrow 2>/dev/null and the new group wrap are indistinguishable on that input:

OLD form, directory:  (no leak)
NEW form, directory:  (no leak)
OLD form, absent:     bash: t/nope: No such file or directory
NEW form, absent:     (no leak)

The distinction only shows up on an absent path, which is exactly the case [ -r ] used to short-circuit — and that is the real reason an execution test could not have caught this before the pre-test was dropped. Worth correcting in place, since this comment is the record of why the check is source-shaped.

"$([ "$rc_hasmm" -ne 0 ] && echo yes || echo no)" "yes"
check "that refusal still names smaps_rollup" "$named_hasmm" "yes"


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit — stray extra blank line; double blank between Case E and Case F.

Review follow-ups on rossoctl#310.

- The reads-after-r refusal offered "an SH_E11_PROC_ROOT that is not this
  host's /proc" as a likely cause, but a wrong root makes the proc entry
  ABSENT, so `[ ! -r "$smaps" ]` is true and the FIRST refusal fires instead
  -- confirmed by execution against an empty PROC_ROOT and a live pid. A
  reader who got the second refusal therefore had a correctly configured root
  and a second thing to go rule out, which is a milder form of the
  misdirection this PR removes. The hint moves to the first refusal, which
  until now offered no diagnosis at all; the second names the root only to
  rule it out. New Case K pins both halves, and both fail against the
  previous head.

- Case H's source-shape pattern is anchored to the cmdline read itself
  (`<"$cmdline"; } 2>/dev/null`) rather than a bare `} 2>/dev/null`.
  $pss_body holds BOTH functions, so any future group redirect anywhere in
  pss_bytes_for_pids would have turned it green whatever the read did -- the
  exposure Case J already guards against by matching on the die line. Proven
  by mutation: with rossoctl#299's bug restored and an unrelated group redirect added,
  the old pattern reports ok and the anchored one fails.

- Drop the dead `$fake_proc/$dead_pid/cmdline` rmdir operand: nothing ever
  creates that directory, and naming it implies Case G staged one. Drop a
  stray second blank line at the Case E/F boundary.

bash deploy/microvm/tests/e11-density.test.sh: 473 ok, 0 FAIL, exit 0
make lint: exit 0

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori

Copy link
Copy Markdown
Member Author

Addressed in 6e78988 — both suggestions taken, both nits fixed, and the arithmetic nit was a real error.

On the count. The 466 was wrong, and your grep was the right way to catch it. The real pre-PR number is 463: I had measured "before" by extracting deploy/microvm/ alone into a temp tree, which silently skips whole blocks (and fails the Go build check), so that number was never comparable. Measured properly — reverting both files inside the same worktree — it is 463 → 470, exactly the +7 static delta you counted, with no loop-driven count shifting. Round 2 makes it 446 → 456 static and 463 → 473 executed. Table corrected, and the correction is recorded there rather than quietly swapped.

Worth noting for its own sake: while re-running the pre-PR tree I hit a one-off failure in tick 1 carries pssBytes, then every 3rd tick does (got '0 - 524288 ...'), which did not reproduce across three further runs. That is a fixture timing flake in the sampler block, unrelated to this PR and present before it — filing separately rather than folding it in here.

The two suggestions, in short (details in the threads):

  • The wrong-root hint moved to the first refusal. You were right that it is unreachable from the second; I confirmed by execution rather than by reading — empty PROC_ROOT + a live pid takes line 668. The second now names the root only to rule it out, and the first carries the diagnosis it never had.
  • Case H is anchored to <"$cmdline"; } 2>/dev/null. The vacuity you described turned out to be reachable, not theoretical: with fix(e11): a dying VMM contributes 0 to Σ PSS, it is not a refusal #299's bug restored plus an unrelated group redirect, the old pattern reports ok and the anchored one FAILs. That mutation is in the thread.

Verification after round 2: 473 ok, 0 FAIL, exit 0; 6 FAIL against pre-PR source, 2 FAIL against 0bdb0cd; make lint exit 0. One limit stated plainly in the die-message thread: of the two new Case K checks, only one also fails against pre-PR — the other is a regression guard, like Case I, and I would rather label it that than let the "fails first" claim cover it.

@pdettori
pdettori merged commit 80074c4 into rossoctl:main Sep 21, 2026
13 checks passed
@pdettori
pdettori deleted the fix/302-pid-mm-gone-enoent branch September 21, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e11: #299 still refuses on a VMM whose smaps_rollup read fails while its cmdline reads

3 participants