Commit 5e020f7
committed
test(microvm): the PSS fixture assumed
Two assertions in e11-density.test.sh failed on ubuntu-24.04 in CI while passing
on macOS and on Amazon Linux 2023. One root cause, and it is the FIXTURE, not the
driver:
sh -c 'sleep 5' & # $! is the wrapper, matched by pattern "sleep 5"
dash — Ubuntu's /bin/sh — does not exec the command in `sh -c CMD`; it FORKS a
child. Reproduced in an ubuntu:24.04 container (dash, procps-ng 4.0.4, Python
3.12.3), `pgrep -f -- "sleep 5"` returns two pids:
pid=2534 cmdline=[sh -c sleep 5] <- $!, the only pid the fake proc tree covered
pid=2536 cmdline=[sleep 5] <- the forked child, uncovered
pss_bytes_for_pids then found a LIVE pid with no readable smaps_rollup under the
fabricated $PROC_ROOT and refused, exactly as spec §7.3's boxed warning requires
("refusing to fall back to RSS"). host_signals_snapshot propagated that, so
`a nonzero PSS ... IS accepted with require_vmm=1` read "want 0, got 1" and the
next assertion's json.load got an empty file — the traceback in the CI log is
that symptom, not a second bug. bash, which is /bin/sh on macOS and on Amazon
Linux 2023, execs instead: one pid, fixture covers it, both hosts pass. Nothing
here involves yama.ptrace_scope: every file this block reads comes from the
fabricated proc root, never /proc.
Fixed by making the fixture deterministic rather than by touching the driver
(shape 1, fully synthetic — the zero-PSS refusal is the whole point of the
finding and is untouched):
- spawn_marker_process starts ONE process, no shell wrapper, whose argv carries
a token unique to this suite run, so no exec/fork choice and no host process
can change what the pattern matches.
- discovered_pids_for runs the REAL discover_pids, retrying until the process is
visible, so a scheduling delay cannot silently make a block assert things
about an empty pid set.
- plant_rollups fabricates a rollup for EVERY pid discover_pids actually
returns, so the fixture covers the real pid set instead of assuming it, and
the expected total is derived from that count.
- All three `sh -c 'sleep 5' &` sites move to markers. Two of them passed in CI
for partly wrong reasons: killing the wrapper orphaned its `sleep` child into
later blocks matching the same pattern, and the chmod-000 case could refuse
because of an uncovered sibling rather than the unreadable rollup it is about.
Non-vacuousness, as required before asserting a refusal does not fire: the block
now proves the real discover_pids DOES find its marker before asserting anything
about the pid set, and the CI failure mechanism itself is pinned as correct
behaviour — a second live process the pattern matches, whose rollup the fixture
does not cover, must make the whole snapshot refuse and print no JSON. That case
skips visibly ("not run, not claimed verified") if the second process never
becomes discoverable, so it can never read as a pass.
Verified on the platform that failed, not only locally, in an ubuntu:24.04
container matching the runner (dash, procps-ng 4.0.4, Python 3.12.3, non-root
uid 1001):
- before: SUITE EXIT 2, the same two failures
- after: SUITE EXIT 0, 159 ok, no FAIL, no skip
- e10-lifecycle 114 ok, build-snapshot 190 ok, systemd-units 24 ok, all exit 0
- mutation check on the same container: disabling the driver's zero-PSS refusal
turns "a matched VMM whose PSS sums to 0 is refused as well" red, so the
rebuilt fixture still catches the regression it exists to catch
- macOS: 160 ok, exit 0; make test-deploy PASS; shellcheck -S warning clean
Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <dettori@us.ibm.com>sh -c execs, which dash does not1 parent e226bd3 commit 5e020f7
1 file changed
Lines changed: 140 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
61 | 141 | | |
62 | 142 | | |
63 | 143 | | |
| |||
106 | 186 | | |
107 | 187 | | |
108 | 188 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
113 | 195 | | |
114 | 196 | | |
115 | 197 | | |
| |||
163 | 245 | | |
164 | 246 | | |
165 | 247 | | |
166 | | - | |
167 | | - | |
| 248 | + | |
168 | 249 | | |
169 | 250 | | |
170 | 251 | | |
| |||
271 | 352 | | |
272 | 353 | | |
273 | 354 | | |
274 | | - | |
275 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
276 | 358 | | |
277 | 359 | | |
278 | 360 | | |
| |||
302 | 384 | | |
303 | 385 | | |
304 | 386 | | |
305 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
306 | 391 | | |
307 | 392 | | |
308 | 393 | | |
| |||
318 | 403 | | |
319 | 404 | | |
320 | 405 | | |
321 | | - | |
322 | | - | |
| 406 | + | |
323 | 407 | | |
324 | 408 | | |
325 | 409 | | |
| |||
636 | 720 | | |
637 | 721 | | |
638 | 722 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
643 | 740 | | |
644 | | - | |
| 741 | + | |
645 | 742 | | |
646 | 743 | | |
647 | 744 | | |
648 | | - | |
| 745 | + | |
| 746 | + | |
649 | 747 | | |
650 | | - | |
| 748 | + | |
| 749 | + | |
651 | 750 | | |
652 | | - | |
| 751 | + | |
653 | 752 | | |
654 | 753 | | |
655 | | - | |
656 | | - | |
657 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
658 | 776 | | |
659 | 777 | | |
660 | 778 | | |
| |||
0 commit comments