GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(qualification): publish sealed device generations with exact pac… · arencloud/unf@94c3478

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .containerignore
  • bins/unf-agent/examples
    • device_context_seed.rs
    • device_observation_loader.rs
  • docs
    • adr
      • 0377-whole-program-device-generation-publication.md
    • development
      • phase9-required-locality-plan.md
    • project-status.md
  • ebpf/unf-ebpf-tc/examples
    • device_lease.rs
  • hack
    • device-lease-publication-gate.jq
    • verify-device-lease-publication-gate.sh
    • verify-device-lease-publication.sh
    • verify-device-lease.sh
  • images
    • DeviceLeaseTestContainerfile
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.containerignore‎

Copy file name to clipboardExpand all lines: .containerignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ hack/*
1919
!hack/verify-device-lease.sh
2020
!hack/device-observation-layout.jq
2121
!hack/device-lease-concurrency-gate.jq
22+
!hack/device-lease-publication-gate.jq
23+
!hack/verify-device-lease-publication.sh
2224
tests/
Collapse file

‎bins/unf-agent/examples/device_context_seed.rs‎

Copy file name to clipboardExpand all lines: bins/unf-agent/examples/device_context_seed.rs
+193-13Lines changed: 193 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
//! Non-transmitting context acquisition for the isolated device-lease fixture.
2-
use std::path::{Path, PathBuf};
2+
use std::{
3+
io::Read as _,
4+
os::fd::{AsFd as _, AsRawFd as _},
5+
path::{Path, PathBuf},
6+
};
37

48
use anyhow::{Context, Result, ensure};
59
use aya::{
610
Pod,
7-
maps::{Array, Map, MapData, MapError, MapType, xdp::DevMap},
11+
maps::{Array, Map, MapData, MapError, MapType, ProgramArray, xdp::DevMap},
812
programs::{SchedClassifier, TestRun, TestRunOptions},
913
};
1014

@@ -106,17 +110,7 @@ fn seed(directory: &Path, ifindex: u32) -> Result<()> {
106110
result
107111
}
108112

109-
fn main() -> Result<()> {
110-
ensure!(
111-
std::env::var("UNF_DEVICE_OBSERVATION_ISOLATED_CONTAINER").as_deref() == Ok("yes"),
112-
"isolated fixture opt-in required"
113-
);
114-
let arguments: Vec<_> = std::env::args_os().skip(1).collect();
115-
ensure!(
116-
arguments.len() == 2,
117-
"expected private bpffs directory and device index or bindings"
118-
);
119-
let directory = PathBuf::from(&arguments[0]);
113+
fn private_directory(directory: &Path) -> Result<()> {
120114
ensure!(
121115
directory.file_name().is_some_and(|name| name == "bpffs")
122116
&& directory
@@ -127,6 +121,160 @@ fn main() -> Result<()> {
127121
.starts_with("unf-device-observation.")),
128122
"unexpected private pin directory"
129123
);
124+
Ok(())
125+
}
126+
127+
fn frozen_fdinfo(value: &str) -> bool {
128+
let rows: Vec<_> = value
129+
.lines()
130+
.filter_map(|line| line.strip_prefix("frozen:"))
131+
.collect();
132+
rows.len() == 1 && rows[0].trim() == "1"
133+
}
134+
135+
fn exact_bank_maps(mut actual: Vec<u32>, mut expected: Vec<u32>) -> bool {
136+
actual.sort_unstable();
137+
expected.sort_unstable();
138+
expected.len() == 7
139+
&& expected[0] != 0
140+
&& expected.windows(2).all(|pair| pair[0] != pair[1])
141+
&& actual == expected
142+
}
143+
144+
fn publish(directory: &Path, bank: &Path) -> Result<()> {
145+
private_directory(bank)?;
146+
let mut expected_maps = Vec::with_capacity(7);
147+
let mut held_maps = Vec::with_capacity(6);
148+
let mut held_tag: Option<Array<MapData, u32>> = None;
149+
for (name, kind, entries, bytes) in [
150+
("P9LEASECFG", MapType::Array, 1, 160),
151+
("P9LEASEPTR", MapType::Array, 1, 8),
152+
("P9LEASEDEV", MapType::DevMap, 4, 8),
153+
("P9LEASEOWN", MapType::Array, 4, 104),
154+
("P9LEASETAG", MapType::Array, 1, 4),
155+
] {
156+
let map = MapData::from_pin(bank.join("maps").join(name))?;
157+
let info = map.info()?;
158+
expected_maps.push(info.id());
159+
ensure!(
160+
info.map_type()? == kind
161+
&& info.max_entries() == entries
162+
&& info.key_size() == 4
163+
&& info.value_size() == bytes,
164+
"unexpected bank map shape"
165+
);
166+
let mut text = String::new();
167+
std::fs::File::open(format!(
168+
"/proc/self/fdinfo/{}",
169+
map.fd().as_fd().as_raw_fd()
170+
))?
171+
.take(4097)
172+
.read_to_string(&mut text)?;
173+
ensure!(
174+
text.len() <= 4096 && frozen_fdinfo(&text),
175+
"bank is not sealed"
176+
);
177+
if name == "P9LEASETAG" {
178+
held_tag = Some(Array::try_from(Map::Array(map))?);
179+
} else {
180+
held_maps.push(map);
181+
}
182+
}
183+
let tag = held_tag.context("missing sealed tag descriptor")?;
184+
ensure!((1..=2).contains(&tag.get(&0, 0)?), "invalid bank tag");
185+
for (name, kind, entries, bytes) in [
186+
("P9LEASECON", MapType::PerCpuArray, 1, 24),
187+
("P9LEASESEQ", MapType::Array, 65536, 8),
188+
] {
189+
let map = MapData::from_pin(bank.join("maps").join(name))?;
190+
let info = map.info()?;
191+
ensure!(
192+
info.map_type()? == kind
193+
&& info.max_entries() == entries
194+
&& info.key_size() == 4
195+
&& info.value_size() == bytes,
196+
"unexpected bank observer map"
197+
);
198+
expected_maps.push(info.id());
199+
held_maps.push(map);
200+
}
201+
let data = MapData::from_pin(directory.join("maps/P9LEASENEXT"))?;
202+
let info = data.info()?;
203+
ensure!(
204+
info.map_type()? == MapType::ProgramArray && info.max_entries() == 1,
205+
"unexpected dispatcher map"
206+
);
207+
let mut dispatch = ProgramArray::try_from(Map::ProgramArray(data))?;
208+
let program = SchedClassifier::from_pin(bank.join("concurrent"))?;
209+
let program_info = program.info()?;
210+
let actual_maps = program_info
211+
.map_ids()?
212+
.context("unavailable program map identities")?;
213+
ensure!(
214+
exact_bank_maps(actual_maps, expected_maps),
215+
"classifier does not own this exact bank"
216+
);
217+
let id = program_info.id();
218+
dispatch.set(0, program.fd()?, 0)?;
219+
// Hold every checked descriptor through the publication syscall. A removed
220+
// pin cannot turn a checked map ID into a replacement object in this gap.
221+
drop(tag);
222+
drop(held_maps);
223+
println!(
224+
"{}",
225+
serde_json::json!({"schemaVersion":1,"publishedProgramId":id,
226+
"scope":"isolated-device-generation","productionAuthority":false})
227+
);
228+
Ok(())
229+
}
230+
231+
fn ledger(directory: &Path) -> Result<()> {
232+
let data = MapData::from_pin(directory.join("maps/P9LEASESEQ"))?;
233+
ensure!(
234+
data.info()?.map_type()? == MapType::Array,
235+
"unexpected sequence map type"
236+
);
237+
let sequences: Array<_, [u32; 2]> = Array::try_from(Map::Array(data))?;
238+
ensure!(sequences.len() == 65_536, "unexpected sequence capacity");
239+
let mut entries = Vec::new();
240+
for key in 0..sequences.len() {
241+
let value = sequences.get(&key, 0)?;
242+
if value != [0, 0] {
243+
ensure!(
244+
(1..=2).contains(&value[0]) && (1..=2).contains(&value[1]),
245+
"invalid sequence observation"
246+
);
247+
entries.push([key, value[0], value[1]]);
248+
}
249+
}
250+
println!(
251+
"{}",
252+
serde_json::json!({"schemaVersion":1,"capacity":65536,
253+
"entries":entries,"productionAuthority":false})
254+
);
255+
Ok(())
256+
}
257+
258+
fn main() -> Result<()> {
259+
ensure!(
260+
std::env::var("UNF_DEVICE_OBSERVATION_ISOLATED_CONTAINER").as_deref() == Ok("yes"),
261+
"isolated fixture opt-in required"
262+
);
263+
let arguments: Vec<_> = std::env::args_os().skip(1).collect();
264+
ensure!(
265+
arguments.len() == 2 || (arguments.len() == 3 && arguments[1] == "publish"),
266+
"expected private bpffs directory and index|bindings|ledger, or publish and a bank directory"
267+
);
268+
let directory = PathBuf::from(&arguments[0]);
269+
private_directory(&directory)?;
270+
if arguments[1] == "publish" {
271+
ensure!(arguments.len() == 3, "publish requires a bank directory");
272+
let bank = PathBuf::from(&arguments[2]);
273+
return publish(&directory, &bank);
274+
}
275+
if arguments[1] == "ledger" {
276+
return ledger(&directory);
277+
}
130278
if arguments[1] == "bindings" {
131279
let data = MapData::from_pin(directory.join("maps/P9LEASEDEV"))?;
132280
ensure!(
@@ -169,6 +317,38 @@ fn main() -> Result<()> {
169317
mod tests {
170318
use super::*;
171319

320+
#[test]
321+
fn sealing_requires_one_exact_frozen_fdinfo_field() {
322+
assert!(frozen_fdinfo("map_type:\t2\nfrozen:\t1\n"));
323+
for invalid in [
324+
"",
325+
"frozen:\t0\n",
326+
"frozen:\t1\nfrozen:\t1\n",
327+
"notfrozen:\t1\n",
328+
"frozen:\t10\n",
329+
] {
330+
assert!(!frozen_fdinfo(invalid));
331+
}
332+
}
333+
334+
#[test]
335+
fn publication_requires_the_exact_distinct_generation_maps() {
336+
let expected: Vec<_> = (1..=7).collect();
337+
assert!(exact_bank_maps((1..=7).rev().collect(), expected.clone()));
338+
for actual in [
339+
vec![],
340+
(1..=6).collect(),
341+
(1..=8).collect(),
342+
(2..=8).collect(),
343+
vec![1, 2, 3, 4, 5, 6, 6],
344+
] {
345+
assert!(!exact_bank_maps(actual, expected.clone()));
346+
}
347+
for invalid in [vec![], vec![0, 1, 2, 3, 4, 5, 6], vec![1, 2, 3, 4, 5, 6, 6]] {
348+
assert!(!exact_bank_maps(invalid.clone(), invalid));
349+
}
350+
}
351+
172352
#[test]
173353
fn context_exposes_only_the_requested_device_coordinate() {
174354
let bytes = context(301).unwrap();
Collapse file

‎bins/unf-agent/examples/device_observation_loader.rs‎

Copy file name to clipboardExpand all lines: bins/unf-agent/examples/device_observation_loader.rs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ fn main() -> Result<()> {
4141
("device_lease_seed", "seed"),
4242
("device_lease_redirect", "program"),
4343
("device_lease_concurrent", "concurrent"),
44+
("device_lease_dispatch", "dispatch"),
4445
]
4546
} else {
4647
&[("device_observation", "program")]
@@ -63,6 +64,10 @@ fn main() -> Result<()> {
6364
"P9LEASEOWN",
6465
"P9LEASERES",
6566
"P9LEASECON",
67+
"P9LEASENEXT",
68+
"P9LEASEDIS",
69+
"P9LEASETAG",
70+
"P9LEASESEQ",
6671
]
6772
} else {
6873
&["P9DEVCFG", "P9DEVOBS"]
Collapse file

‎docs/adr/0377-whole-program-device-generation-publication.md‎

Copy file name to clipboard
+70Lines changed: 70 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# ADR 0377: Whole-Program Device Generation Publication Experiment
2+
3+
Date: 2026-09-14
4+
5+
Status: locally verified fixture; cl02-before-Kind qualification pending
6+
7+
The four-endpoint gate qualifies revocation, but its explicit rebinds occur while
8+
senders are idle. Production publication must not combine an old cached device
9+
pointer with replacement binding/configuration tables. Investigate one dispatch
10+
slot selecting an entire classifier instance with its own maps, rather than
11+
separately replacing related live table entries.
12+
13+
The upstream [program-array update](https://github.com/torvalds/linux/blob/v5.14/kernel/bpf/arraymap.c)
14+
exchanges its referenced program pointer and releases the old program reference.
15+
[Program release](https://github.com/torvalds/linux/blob/v5.14/kernel/bpf/syscall.c)
16+
defers exposed-program destruction through RCU; subsequent
17+
[program cleanup](https://github.com/torvalds/linux/blob/v5.14/kernel/bpf/core.c)
18+
releases its used-map references. These semantics motivate the experiment, not
19+
a completed deployed-kernel proof. Kernel device-map invalidation remains
20+
independent of the publisher.
21+
22+
The private dispatcher drops on an empty or unsuccessful tail call. Each bank
23+
has distinct configuration, cached-pointer, device, ownership, tag, counter and
24+
sequence maps. The publisher requires exact map types/capacities, sealed authority
25+
maps, a valid generation tag, and an exact match between all seven checked map
26+
IDs and the classifier's kernel-reported map IDs. It holds every checked map
27+
descriptor through the publication syscall, preventing map-ID reuse in that
28+
gap. It does not export pointer contents. The dispatcher must itself reference
29+
only its dispatch table and counters, not a bank's device/configuration maps.
30+
31+
The fixture stages A as the valid ownership bank and B with a deliberately
32+
mismatched expected source owner, making B deny. This is a diagnostic ownership
33+
negative, not a production policy transaction. Both are seeded while idle, their
34+
configuration/pointer/device/ownership/tag maps are frozen, and their seed pins
35+
are removed. An unsealed publication and later user updates to frozen device
36+
maps must fail; an empty dispatcher must reject forty armed-receiver attempts.
37+
38+
Forty thousand uniquely sequenced IPv4/IPv6 packets run through 22 checked
39+
publication operations. Per-generation ledgers must assign every sequence
40+
exactly once: A requests delivery, B rejects. Observed receiver sequences must
41+
match A's ledger exactly, with zero foreign delivery, socket drops or unobserved
42+
redirects. A compact typed reader inspects all 65,536 ledger slots and exports
43+
only populated public observations, avoiding a large per-byte JSON map dump.
44+
45+
After the alternating swaps finish on A, the fixture removes A's exact program
46+
and authority-map pins while A remains selected. The final swap to B releases
47+
the last A program reference while both senders are still running. Retained
48+
public counter/ledger maps do not reference A's device/configuration maps. The
49+
old authority-map IDs must become unavailable; this does not claim instantaneous
50+
physical reclamation or a measured RCU grace period. Finally, moving B's target
51+
peer must still invalidate its frozen device-map slot through the kernel.
52+
53+
All prior seventy serial/recovery attempts and the 40,000-packet sticky-movement
54+
gate remain mandatory. The publication stage adds a ninth non-transmitting seed,
55+
forty empty-dispatch denials and its separate 40,000-packet matrix. Disposable
56+
pin removal is exact and scoped; no live UNF maps, history, journals or authority
57+
are changed. Missing observers or unexpected syscall errors remain failures.
58+
59+
The separate BPF object builds with SHA-256
60+
`4ce81c6b2606eceb75330d933de977cffac3e450456a83fc0cc463fad6a2d47a`.
61+
All 807 workspace tests pass (26 ignored), four explicit adapter tests pass,
62+
and strict workspace/all-target Clippy and formatting pass. Publication gate:
63+
one positive / 43 negative cases; existing movement gate: three positive / 141
64+
negative cases. Runtime loading, map freezing, last-reference retirement and the
65+
complete matrix must pass cl02 before identical-image retained Kind.
66+
67+
This is not the production publisher, authenticated attachment/address/route
68+
join, complete source-side concurrency or policy/Service/egress composition.
69+
Whole-bank staging costs and tail-call/resource budgets are unmeasured. Full
70+
Phase 9 and stabilization S1–S5 remain open; no scale or superiority claim follows.
Collapse file

‎docs/development/phase9-required-locality-plan.md‎

Copy file name to clipboardExpand all lines: docs/development/phase9-required-locality-plan.md
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ ADR 0376 verifies that matching Kind gate, including all seventy serial checks,
118118
40,000 concurrent packets, sticky slot invalidation and explicit recovery.
119119
Generation-coherent publication and authenticated production consumption are next;
120120
full Phase 9 and stabilization remain open.
121+
ADR 0377 implements a locally checked whole-program dispatch experiment for
122+
generation-coherent publication and retirement, retaining sealed map descriptors
123+
and exact sequence attribution. The complete cl02-before-Kind gate is next;
124+
authenticated production attachment/address/route consumption remains open.
121125

122126
L3a (ADR 0327) implements runtime Pod-UID capture, versioned durable attachment
123127
ownership and veth incarnation cookies. 778 workspace tests and strict Clippy pass;
Collapse file

‎docs/project-status.md‎

Copy file name to clipboardExpand all lines: docs/project-status.md
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ stays revoked after movement; this is not transparent handoff. Kind is next.
744744
ADR 0376 verifies the identical complete Kind four-endpoint gate and retained
745745
log audit. Both kernels pass the isolated sticky-invalidation mechanism; safe
746746
generation publication and authenticated production consuming integration remain.
747+
ADR 0377 adds a locally verified whole-program publication experiment, with
748+
sealed generation maps, exact retained map identities, per-sequence attribution
749+
and last-reference retirement under traffic. Its full cl02-before-Kind gate is
750+
pending; this does not activate a production locality consumer.
747751
ADR 0338 closes the staging guard's init-container failure/restart gap before
748752
the matching Kind rollout; no live image changes occur in that metadata slice.
749753
Required locality/replica coverage, full lifecycle requalification and S1–S5

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.