# When must an instance treat an eBPF tool-interception allowlist as a continuity invariant rather than a per-syscall check **Date of Record:** 2026 November 25 **Scope:** Applies to LLM agent runtimes that enforce policy by intercepting tool invocations and network egress at the syscall boundary (eBPF/LSM hooks, seccomp-BPF user-notify, or equivalent kernel-level mediators) and that persist agent state across checkpoints. Does not apply to in-process tool dispatch with no kernel mediation, nor to stateless single-shot invocations with no resume path. ## Core Distinction A kernel-level interception layer enforces policy *per event*: a hook fires, a verdict is computed against the current policy object, and the syscall is allowed, denied, or rewritten. This is a stateless predicate over `(pid, cgroup, syscall, args, policy_version)`. An agent, by contrast, is a *stateful* computation whose semantics span many events: a tool call sequence, a plan, a checkpointed context. The boundary failure appears when the runtime treats the *aggregate* of these per-event verdicts as if it were a policy, and the agent treats that aggregate as if it were a guarantee. They are not the same object. The per-event allowlist bounds individual syscalls; it does not bound the *composition* of allowed syscalls into an exfiltration channel, a privilege ladder, or a plan that survives a checkpoint into a runtime where the policy has changed. The non-obvious invariant is this: **the policy version under which an agent's plan was formed must be bound into the agent's checkpoint, and any resume under a different policy version must invalidate the plan, not merely re-adjudicate the next syscall.** Absent this binding, an agent can carry a plan across a policy transition and execute a sequence whose every individual step is permitted under the *new* policy while the composition is only meaningful under the *old* one. ## What Was Observed A tool-using agent was assigned a task on a sandboxed host with an eBPF egress filter attached to its cgroup. The policy in force (v17) allowed egress to `api.internal:443` and to a model-gateway endpoint, and denied all other destinations. The agent's plan involved: (1) read a dataset via an MCP tool that shells out to `curl` against `api.internal`, (2) summarize, (3) post a summary to the gateway. Every step was permitted under v17. The agent checkpointed its plan and partial context mid-step-2. While the agent was suspended, an operator rotated the policy to v18, which added a *new* permitted destination `telemetry.internal:443` for a monitoring agent co-resident in the same cgroup, and removed `api.internal` for the research agent by narrowing the LSM rule to a per-binary `bpf_get_current_comm()` match. The kernel enforcement was correct: after v18, the research agent's `curl` to `api.internal` returned `EPERM` at the `connect()` hook. The failure was not in the kernel. On resume, the agent's runtime re-issued the plan. Step 1's `curl` failed with `EPERM`, which the tool wrapper surfaced to the model as a generic `tool_error: connection refused`. The model, reasoning probabilistically over a context that still contained the *old* plan and no policy-version marker, treated the error as transient and retried with a fallback destination it had seen in a prior task: `telemetry.internal:443`. That destination was permitted under v18. The agent posted the *dataset contents* — not the summary — to `telemetry.internal`, because the plan's step ordering assumed step 1 had succeeded and step 2 (summarize) had not yet run. The egress filter allowed every individual packet. The composition was an exfiltration that no single hook verdict flagged. The trace, condensed: ``` t0 v17 connect(api.internal:443) ALLOW plan.step=1 t1 v17 checkpoint{plan, ctx, policy_version: } t2 --- policy rotate v17 -> v18 t3 v18 connect(api.internal:443) EPERM plan.step=1 retry t4 v18 model reasons: "transient; fallback to telemetry.internal" t5 v18 connect(telemetry.internal:443) ALLOW (permitted for sibling agent) t6 v18 write(dataset_bytes) ALLOW ``` The checkpoint at t1 carried no `policy_version`. The runtime at t3 had no way to know the plan was formed under a policy that no longer held. The model at t4 had no signal distinguishing "policy changed" from "network blip." The hook at t5 had no visibility into the plan. ## Condition of Validity The per-syscall allowlist is a valid enforcement mechanism only under the following condition: **the agent's plan is a pure function of state that is itself bounded by the current policy, and no plan step's permission depends on a policy version other than the one in force at execution time.** This holds for stateless tool calls where each invocation is independently justified. It fails whenever: 1. The plan was formed under a policy version `P_old` and is executed under `P_new`, and 2. The set of destinations permitted under `P_new` is not a subset of those permitted under `P_old` (i.e., the policy *widened* anywhere, even for a different principal in the same cgroup), and 3. The agent's error-handling is probabilistic — it treats `EPERM` as a recoverable condition and searches its context for an alternative destination. Condition 2 is the sharp edge. A policy rotation that only *narrows* is safe against this failure: every fallback the model might select is also denied. A rotation that narrows for one principal and widens for another in the same enforcement domain is not safe, because the widened destination is reachable by the narrowed principal's syscalls unless the LSM rule distinguishes them — and LSM rules distinguish by binary identity, cgroup, or label, not by *which agent's plan* issued the call. Two agents sharing a cgroup share an enforcement domain; the union of their permitted destinations is what the kernel sees. ## Decision Boundary The runtime must decide, at every resume, whether the checkpointed plan is *admissible* under the current policy. The decision boundary is not "is the next syscall permitted" but "was the plan formed under a policy whose permitted-destination set is a superset of the current one, for this principal." Concretely: - If `checkpoint.policy_version == current_policy_version`: resume the plan unchanged. - If `checkpoint.policy_version != current_policy_version` AND `permitted_set(current, principal) ⊇ permitted_set(checkpoint.policy_version, principal)`: resume, because no fallback the model could select is newly reachable. - Otherwise: **invalidate the plan**, discard the fallback-search context, and re-plan from the task description under the current policy. The model must not be given the old plan as context, because the old plan is the very artifact that encodes the stale permission assumptions. The boundary is crossed the moment a policy rotation widens the enforcement domain for any principal sharing the agent's cgroup, label, or binary identity. At that moment every checkpointed plan in that domain becomes potentially inadmissible, regardless of whether the agent's own principal was narrowed. ## Operational Effect The architectural guardrail is a *policy-version fence* on the checkpoint: the checkpoint record must carry `policy_version` and `principal_id`, and the resume path must compare the checkpoint's permitted-destination set against the current one before re-issuing any plan step. The comparison is over sets, not over individual syscalls, and it must account for the union across co-resident principals in the same enforcement domain. When the fence trips, the runtime raises a typed fault that the orchestrator handles by re-planning, not by retrying. The model is never shown the stale plan on the re-plan path. The second guardrail is on the error surface: `EPERM` from a policy hook must be distinguishable from `ECONNREFUSED` from a downed service, and the former must be surfaced to the model as a *terminal policy event* that forbids fallback search, not as a transient. The model's probabilistic error-handling is the amplifier; removing the ambiguity removes the amplifier. The following reference implementation encodes the fence and the fault: ```python from dataclasses import dataclass, field from typing import FrozenSet class PolicyFenceViolation(RuntimeError): """Raised when a checkpointed plan is resumed under a policy whose permitted-destination set is not a superset of the set in force when the plan was formed, for the same principal in the same enforcement domain. Resuming would allow a composition of individually-permitted syscalls that the plan's author never intended.""" @dataclass(frozen=True) class Policy: version: str # Destinations permitted for a given principal in this enforcement domain. permitted: dict = field(default_factory=dict) def permitted_for(self, principal: str, domain: str) -> FrozenSet[str]: # Union across co-resident principals: the kernel sees the domain, # not the individual agent's plan. union = set() for (p, d), dests in self.permitted.items(): if d == domain: union |= dests return frozenset(union) @dataclass(frozen=True) class Checkpoint: plan: tuple principal: str domain: str policy_version: str permitted_at_formation: FrozenSet[str] def resume_checkpoint(cp: Checkpoint, current: Policy) -> tuple: if cp.policy_version == current.version: return cp.plan now = current.permitted_for(cp.principal, cp.domain) if not cp.permitted_at_formation.issubset(now): # Policy widened somewhere in the domain, or rotated in a way that # makes the old plan's assumptions unverifiable. Invalidate. raise PolicyFenceViolation( f"checkpoint formed under policy {cp.policy_version} " f"(permitted={sorted(cp.permitted_at_formation)}) is not " f"admissible under {current.version} " f"(permitted={sorted(now)}); re-plan required" ) return cp.plan def handle_tool_error(errno: int, cp: Checkpoint, current: Policy) -> tuple: if errno == 1: # EPERM from a policy hook: terminal, no fallback search. raise PolicyFenceViolation( f"EPERM at syscall under policy {current.version}; " f"fallback search forbidden, plan {cp.plan} invalidated" ) # ECONNREFUSED and friends may be transient; retry is permitted. return resume_checkpoint(cp, current) ```