8000 fix(minimald): a daemon leaf whose cgroup.procs can't be read counts as an unplaced daemon · Issue #3224 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): a daemon leaf whose cgroup.procs can't be read counts as an unplaced daemon #3224

Closed

Description

@agent-137

Follow-up from #3187 (minimal-foundry LOW thread 4518246278, deferred so #3187 could merge at its approved head).

Problem

daemon_unplaced(root) is daemon_leaf(root).is_dir() && daemon_fetch_leaf(root).is_none(). daemon_fetch_leaf returns None both when this pid isn't in the leaf's cgroup.procs and when reading cgroup.procs fails (read_to_string(..).ok()?). So a read error counts as an unplaced daemon, and Decision::over_daemon_placement re-spells ProbeUnreadable as DaemonNotPlaced.

Two related points:

  • main.rs (read_host_ip_enforcement_fact) inlines the check instead of calling daemon_unplaced.
  • re_read_classifier_fact reads the probe and the placement separately, after the probe, so the two reads can disagree while the placement unit answers.

Effect: wording only, never fail-open

  • An unplaced box would run unenforced anyway (A2), and the new text says so.
  • A placed deny-all box is refused by the gate's DaemonNotPlaced arm (refused_unenforced_host_address_box), the same outcome ProbeUnreadable gives. Only the refusal's words differ: "not in its classifier leaf" instead of "could not be read".
  • Triggering it needs a daemon leaf whose cgroup.procs the daemon's own account can't read, alongside an unreadable probe. That's very unlikely.

Fix

  • Add daemon_in_leaf(root) -> io::Result<bool>, which reads cgroup.procs once. Build daemon_fetch_leaf on top of it, keeping the Option signature for its callers.
  • A daemon counts as unplaced only on Ok(false). A read error counts as "not unplaced", so the decision keeps the cause it read.
  • In main.rs, derive placed and unplaced from one daemon_in_leaf read (unplaced_over(&in_leaf)), so start-up still reads the placement once.
  • In re_read_classifier_fact, read the placement once, before the probe.
  • In a_daemon_is_unplaced_only_beside_a_leaf_it_is_not_in, add the case of a leaf whose cgroup.procs can't be read.

A ready implementation is on local branch fix/3187-followup-leaf-read-error (f4cd0ab7, agent-137, on pc). minimald passes 1444/1444 non-root tests. It will be rebased onto main after #3187 merges.

Activity

  1. agent-137 commented on Nov 10, 2026

    @agent-137
    MemberAuthor

    Change of plan, decided by Karl on 2026-11-10 during #3240's review: a cgroup.procs read error now counts as unplaced, not "not unplaced" as the Fix section above says. Keeping ProbeUnreadable over a read error, or over a missing daemon leaf beside an installed tree, makes the create advisory say the deny-all box is refused. A daemon that really is unplaced runs that box unenforced (A2), so the advisory would claim a refusal that isn't happening. That is #3067's original bug. Counting the daemon unplaced can only over-warn: the launcher places a box by its own probe, and a placed deny-all box is still refused over DaemonNotPlaced.

    The rest of the Fix section stands: daemon_in_leaf returns a Result, start-up reads the placement once, and re_read_classifier_fact reads it once, before the probe. One trade-off is accepted and documented on unplaced_over: over a read error, the words "not in its classifier leaf" are stronger than the evidence. The read error is logged once at start-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0