Skip to content

scope: shell-cov via busybox env-gate; netbinds always reports#873

Merged
lacraig2 merged 4 commits into
mainfrom
scope-shellcov-netbinds
Jun 29, 2026
Merged

scope: shell-cov via busybox env-gate; netbinds always reports#873
lacraig2 merged 4 commits into
mainfrom
scope-shellcov-netbinds

Conversation

@lacraig2

Copy link
Copy Markdown
Collaborator

What

Refines the analysis-scoping feature (#870) after two post-merge problems:

  1. netbinds was scoped → silently dropped infra binds (gdbserver, vpnguin, …) and broke the indiv_debug+gdbserver test. Now netbinds always reports (igloo_driver drops the sock gate).
  2. shell coverage was host-scoped via an exec-seeded pid set — lossy (fork-without-exec subshells missed), unbounded (PID-reuse drift), host/driver split. Now it self-gates in busybox on the IGLOO_NO_SHELL_COV env marker.

Syscall/exec scoping is unchanged — that's the noise we actually want gone, and it stays.

How the marker works

  • gen_image.py injects export IGLOO_NO_SHELL_COV=1 into preinit only when analysis_scope is enabled (config-driven, not hardcoded — and avoids the MIPS 256-byte cmdline limit).
  • The marker is inherited across fork/exec through init.sh + the source.d helpers, so the whole infra subtree (incl. subshells) stays silent.
  • init.sh clears it at the firmware handoff → firmware reports.
  • busybox portal_hc() early-returns when it's set (busybox PR).

core.analysis_scope stays the single switch: firmware enables both the driver syscall gate and the preinit marker; none disables both. Removed the host-side in_scope_pids machinery entirely (scope.py now only enables the driver gate).

Coverage

Test fixtures go back to the default analysis_scope: firmware so the default path is exercised in CI again (was none as a workaround for the netbinds/gdbserver break, which this fixes properly).

⚠️ Blocked on releases

CI builds against pinned deps, so this is red until:

Pins are already set to 0.0.17 / 0.0.86 in this PR; just need the matching releases cut.

Known edge case

guest_cmd/call_usermodehelper spawns don't inherit the env marker, so their shell coverage still reports (while their syscalls are scoped out as infra). Main infra path is fully covered. Can follow up by injecting the marker in portal_exec.c's envp if desired.

Refines the analysis-scoping feature in response to two problems found after
merge:

- netbinds was scoped to the firmware subtree, which silently dropped infra
  binds (e.g. gdbserver) and broke the indiv_debug+gdbserver test. Netbinds
  now always reports (igloo_driver: drop the sock_hc scope gate).
- shell coverage was scoped on the host via an exec-seeded pid set, which
  missed fork-without-exec subshells, grew unbounded, and drifted on PID
  reuse. It now self-gates in busybox on the IGLOO_NO_SHELL_COV env marker,
  which gen_image injects into preinit only when scoping is enabled and
  init.sh clears at the firmware handoff. No host-side pid tracking.

Syscall/exec scoping (namespace + driver scope_filter) is unchanged.
core.analysis_scope remains the single switch: 'firmware' enables the driver
syscall gate AND the preinit marker; 'none' disables both so everything
reports. Test fixtures run the default 'firmware' path again so it stays
covered.

Requires busybox >= 0.0.17 (env-gated coverage) and igloo_driver >= 0.0.86
(netbinds ungated); pins bumped accordingly.
lacraig2 added 3 commits June 29, 2026 11:52
penguin-tools 0.0.18 bundles busybox a435ba5e with the shell-coverage env
gate (IGLOO_NO_SHELL_COV), which is how the busybox change actually reaches
the image (busybox is shipped via penguin-tools.tar.gz, not a release asset).
BUSYBOX_VERSION is provenance-only, bumped to match. igloo_driver already at
0.0.86 (netbinds ungated).
The committed schema_doc.md was generated with the image's older pydantic,
which renders multi-line Field descriptions unindented; current pydantic (what
the test_schema CI job pip-installs) indents them. Regenerate so the snapshot
section matches and the up-to-date check passes. Pre-existing drift surfaced
by this PR; analysis_scope wording is unchanged.
@lacraig2 lacraig2 merged commit 847c03c into main Jun 29, 2026
15 checks passed
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.

1 participant