interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

GitHub aien-dev/aienux#170 (code only)

closed derived 2119d7184d0c79e4 #170

Imported from GitHub aien-dev/aienux#170 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 08fcbd701d063ba2a13be987ac9ce4891604d14e · Head 393e001eb66a66646d948fc231b4ec9439585158

Apply it

git checkout -b patch-2119d7184d0c79e4 08fcbd701d063ba2a13be987ac9ce4891604d14e
curl -fsSL https://interplane.io/drakestapleton/aienux/patches/2119d7184d0c79e4.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aienux
170
393e001eb66a66646d948fc231b4ec9439585158
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":170,"url":"https://github.com/aien-dev/aienux/pull/170","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:35:53Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/native/argus/Makefile b/native/argus/Makefile
index 9527aa10..c4a1ba32 100644
--- a/native/argus/Makefile
+++ b/native/argus/Makefile
@@ -85,7 +85,7 @@ LANE_B_SAN =
 endif
 
 .PHONY: all lib test test-lanes test-integration test-hostile bench sanitize clean \
-        test-argus1 test-contain test-e2e test-contain-hostile bench-contain sanitize-argus1
+        test-argus1 test-contain test-e2e test-contain-hostile test-contain-fp bench-contain sanitize-argus1
 
 all: lib
 lib: $(LIB)
@@ -151,14 +151,18 @@ endif
 ifneq ($(and $(CBENCH_SRC),$(STACK_SRC)),)
 $(CBENCH): $(CBENCH_SRC) $(STACK_SRC) $(BRIDGE_HDR) tests/stub_state.c $(INT_HDR) $(LIB)
 	$(CC) $(CFLAGS) $(STACK_INC) -pthread -o $@ $(CBENCH_SRC) $(STACK_SRC) tests/stub_state.c $(LIB)
+test-contain-fp: $(CBENCH)
+	./$(CBENCH) --gate-only
 bench-contain: $(CBENCH)
-	./$(CBENCH)
+	./tests/run_argus1_bench.sh "./$(CBENCH)" contain "$(OUT)/test_argus_integration" "$(OUT)/lane_b"
 else
+test-contain-fp:
+	@echo "test-contain-fp: skipped (needs tests/bench_argus_contain.c + bridge + gate, lane F)"
 bench-contain:
 	@echo "bench-contain: skipped (needs tests/bench_argus_contain.c + bridge + gate, lane F)"
 endif
 
-test-argus1: test-contain test-e2e test-contain-hostile
+test-argus1: test-contain test-e2e test-contain-hostile test-contain-fp
 
 # Linux only (called from `sanitize`): lane C unit test under ASan+UBSan, e2e under
 # ASan+UBSan and TSan, containment hostile under ASan+UBSan. Library sources are
@@ -193,9 +197,8 @@ test-integration: $(INT)
 test-hostile: $(HOSTILE)
 	./$(HOSTILE)
 
-bench: $(INT) bench-contain
-	$(MAKE) -f lane_b.mk $(SUBMAKE_VARS) LANE_B_OUT=$(OUT)/lane_b bench-ring
-	./$(INT) --bench
+bench: $(INT) $(CBENCH)
+	./tests/run_argus1_bench.sh "./$(CBENCH)" full "$(OUT)/test_argus_integration" "$(OUT)/lane_b"
 
 ifeq ($(UNAME_S),Darwin)
 sanitize:
diff --git a/native/argus/docs/ARGUS1_GATES.md b/native/argus/docs/ARGUS1_GATES.md
new file mode 100644
index 00000000..cc053de6
--- /dev/null
+++ b/native/argus/docs/ARGUS1_GATES.md
@@ -0,0 +1,51 @@
+# ARGUS-1 gate evidence (2026-09-29)
+
+This file records the gates measured by lanes F and H. The full pre-registered criteria
+remain in `ARGUS1_SPEC.md`; unmeasured gates are not counted as passed here.
+
+## G8 — hot-path non-regression: PASS
+
+DGX Spark, GCC 13.3.0, core 7 pinned, paired A/B x5, each timing round processes 5,000
+identical benign events in 100-event batches. Measurements ran with
+`/home/drakestapleton/workspace/.argus-bench.lock` held and no `.spark-quiet` marker.
+
+| Measurement | ARGUS-0 reference (`a64bc55`) | ARGUS-1 | Result |
+|---|---:|---:|---|
+| Ring push, single-thread p50 | 4.00 ns | 4.00 ns | Same median (0.00 ns change; within 0.5 ns limit) |
+| Ring push, single-thread p99 | 5.00 ns | 6.00 ns | +1 ns observed; p99 is reported, not the registered median gate |
+| Core ingest p50 | 1,055 ns/event | 1,070 ns/event with containment observe/propose attached | +1.42% (within +3% limit) |
+| Core ingest p99 | 1,076 ns/event | 1,092 ns/event with containment observe/propose attached | Reported for context |
+| `aienos_cap_validate` instruction count | — | 179 | Matches the registered count |
+
+The authority implementation file has no diff from the ARGUS-1 main base. The ring source
+is unchanged; the ring benchmark was re-run on both commits under the same pin and lock.
+Benchmark numbers vary with host scheduling, so the registered comparisons are the result.
+The two-thread ring throughput output is not used as a gate because pinning both worker
+threads to one core measures scheduler contention rather than the normal two-core path.
+
+Reproduce with `make -C native/argus bench`. The target refuses to run if
+`~/workspace/.spark-quiet` exists, takes the lock, and pins the benchmark to core 7.
+
+## G10 — false-positive containment: PASS
+
+`make -C native/argus test-contain-fp` processed the nine benign generated corpora
+(45,000 events total) and the recorded R7/R8/R9 streams (2,283 events total) through the
+real core and containment proposal path while a real AEGIS gate and capability authority
+with an observer and auto-grant policy were active. Each candidate proposal would be
+submitted to the gate; the test found none. Result:
+
+`GATE ARGUS1_FALSE_POSITIVE_PASS PASS events=47283 proposals=0 authority_calls=0`
+
+The authority observer count was unchanged after gate creation, so the replay caused no
+mint, revoke, decision, or execution. The recorded streams were captured from the
+observer-backed runtime runs listed in the fixture README. They are replayed through an
+isolated core because their original authority slot numbers cannot be transplanted into a
+new authority instance. The streams are fixed test fixtures under
+`tests/fixtures/argus1/`; their source and SHA-256 values are in that directory's README.
+
+## Lane H hostile evidence
+
+The current hostile containment suite reports 103 checks, 0 failures. See the containment
+section in `HOSTILE_REVIEW.md` for defended cases and limits. Correct-secret human resolve
+remains untested because the office secret is not exposed to the harness. Producer
+attestation and validator enforcement of reserved stream 16383 remain outside ARGUS-1.
diff --git a/native/argus/tests/bench_argus_contain.c b/native/argus/tests/bench_argus_contain.c
new file mode 100644
index 00000000..94b73cac
--- /dev/null
+++ b/native/argus/tests/bench_argus_contain.c
@@ -0,0 +1,33 @@
+#define _GNU_SOURCE
+#include "../argus_abi.h"
+#include "../argus_core.h"
+#include "../argus_contain.h"
+#include "stub_state.h"
+#include "../../capability/aienos_capability.h"
+#include "../../capability/aienos_contain.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#define CORPUS_N 5000u
+#define BATCH_N 100u
+#define ROUNDS 5u
+#define SAMPLE_N ((CORPUS_N/BATCH_N)*ROUNDS)
+static int failures;
+#define CHECK(x) do { if(!(x)){failures++;fprintf(stderr,"FAIL %s:%d: %s\n",__FILE__,__LINE__,#x);} } while(0)
+typedef struct { ArgusCore *core; ArgusContain *contain; void *cmem,*smem; } State;
+typedef struct { uint32_t calls; } Obs;
+static uint64_t now_ns(void){struct timespec t;if(clock_gettime(CLOCK_MONOTONIC_RAW,&t))abort();return(uint64_t)t.tv_sec*1000000000u+t.tv_nsec;}
+static void obs(void *p,uint32_t op,const AienosCapEntry *e,int rc){(void)op;(void)e;(void)rc;((Obs*)p)->calls++;}
+static int init(State*s,int contain){memset(s,0,sizeof *s);s->cmem=calloc(1,argus_core_footprint());if(!s->cmem||argus_core_init(&s->core,s->cmem,argus_core_footprint()))return-1;if(contain){s->smem=calloc(1,argus_contain_footprint());if(!s->smem||argus_contain_init(&s->contain,s->smem,argus_contain_footprint()))return-1;}return 0;}
+static void fini(State*s){free(s->smem);free(s->cmem);}
+static int replay(State*s,const ArgusEvent*ev,size_t n,int attached,uint64_t*samples,size_t*ns,size_t*proposals){ArgusFinding cf[ARGUS_CORE_MAX_FINDINGS],xf[ARGUS_CORE_MAX_FINDINGS],all[ARGUS_CORE_MAX_FINDINGS*2];ArgusContainmentRequest rq[ARGUS_CONTAIN_WINDOW_MAX];ArgusEvent pe[ARGUS_CONTAIN_WINDOW_MAX];for(size_t b=0;b<n;b+=BATCH_N){size_t z=b+BATCH_N<n?b+BATCH_N:n;uint64_t t=now_ns();for(size_t i=b;i<z;i++){size_t nc=0;int rc=argus_core_ingest(s->core,&ev[i],cf,ARGUS_CORE_MAX_FINDINGS,&nc);if(rc!=ARGUS_OK&&rc!=ARGUS_ERR_FULL)return rc;if(attached){size_t nx=0,na=0,np=0;rc=argus_contain_observe(s->contain,s->core,&ev[i],xf,ARGUS_CORE_MAX_FINDINGS,&nx);if(rc)return rc;for(size_t j=0;j<nc;j++)all[na++]=cf[j];for(size_t j=0;j<nx;j++)all[na++]=xf[j];rc=argus_contain_propose(s->contain,s->core,all,na,&ev[i],rq,ARGUS_CONTAIN_WINDOW_MAX,pe,ARGUS_CONTAIN_WINDOW_MAX,&np);if(rc)return rc;*proposals+=np;}}if(samples&&*ns<SAMPLE_N)samples[(*ns)++]=(now_ns()-t)/(z-b);}return ARGUS_OK;}
+static int cmp64(const void*a,const void*b){uint64_t x=*(const uint64_t*)a,y=*(const uint64_t*)b;return(x>y)-(x<y);}
+static uint64_t pct(uint64_t*v,size_t n,double p){qsort(v,n,sizeof *v,cmp64);return v[(size_t)((n-1)*p)];}
+static int feed(const ArgusEvent*ev,size_t n,AienosContain*gate,size_t*proposals,size_t*decisions,size_t*executions){State s;if(init(&s,1))return-1;ArgusFinding cf[ARGUS_CORE_MAX_FINDINGS],xf[ARGUS_CORE_MAX_FINDINGS],all[ARGUS_CORE_MAX_FINDINGS*2];ArgusContainmentRequest rq[ARGUS_CONTAIN_WINDOW_MAX];ArgusEvent pe[ARGUS_CONTAIN_WINDOW_MAX];int rc=ARGUS_OK;for(size_t i=0;i<n;i++){size_t nc=0,nx=0,na=0,np=0;rc=argus_core_ingest(s.core,&ev[i],cf,ARGUS_CORE_MAX_FINDINGS,&nc);if(rc!=ARGUS_OK&&rc!=ARGUS_ERR_FULL)break;rc=argus_contain_observe(s.contain,s.core,&ev[i],xf,ARGUS_CORE_MAX_FINDINGS,&nx);if(rc)break;for(size_t j=0;j<nc;j++)all[na++]=cf[j];for(size_t j=0;j<nx;j++)all[na++]=xf[j];rc=argus_contain_propose(s.contain,s.core,all,na,&ev[i],rq,ARGUS_CONTAIN_WINDOW_MAX,pe,ARGUS_CONTAIN_WINDOW_MAX,&np);if(rc)break;for(size_t j=0;j<np;j++){(*proposals)++;AienosContainRequest ar;memcpy(&ar,&rq[j],sizeof ar);uint8_t dig[AIENOS_CONTAIN_DIGEST_LEN];aienos_contain_request_digest(&ar,dig);AienosContainDecision d={0};AienosContainResult x={0};rc=aienos_contain_submit(gate,&ar,dig,&d);if(rc)break;(*decisions)++;if(d.status==AIENOS_CONTAIN_GRANT){rc=aienos_contain_execute(gate,d.decision_id,&x);if(rc)break;(*executions)++;}}if(rc)break;}ArgusCoreHealth h;argus_core_health(s.core,&h);CHECK(h.events_rejected==0);fini(&s);return rc;}
+static int load(const char*name,ArgusEvent**out,size_t*n){char path[256];snprintf(path,sizeof path,"tests/fixtures/argus1/%s",name);FILE*f=fopen(path,"rb");if(!f)return-1;if(fseek(f,0,SEEK_END)){fclose(f);return-1;}long bytes=ftell(f);rewind(f);if(bytes<0||bytes%ARGUS_EVENT_SIZE){fclose(f);return-1;}*n=(size_t)bytes/ARGUS_EVENT_SIZE;uint8_t*raw=malloc((size_t)bytes);*out=calloc(*n,sizeof **out);if(!raw||!*out||fread(raw,ARGUS_EVENT_SIZE,*n,f)!=*n){free(raw);free(*out);fclose(f);return-1;}fclose(f);for(size_t i=0;i<*n;i++)if(argus_event_decode(raw+i*ARGUS_EVENT_SIZE,&(*out)[i])){free(raw);free(*out);return-1;}free(raw);return 0;}
+static void gate10(void){AienosCapAdmin*a=NULL;AienosCapView*v=NULL;AienosContain*g=NULL;AienosCapRef office;Obs o={0};void*gm=calloc(1,aienos_contain_footprint());CHECK(gm!=NULL);CHECK(aienos_cap_start(&a,&v)==AIENOS_CAP_OK);CHECK(aienos_cap_office(a,&office)==AIENOS_CAP_OK);CHECK(aienos_cap_set_observer(a,obs,&o)==AIENOS_CAP_OK);AienosContainTablePolicy p={0};p.verdict[AIENOS_CONTAIN_REVOKE_CAPABILITY]=AIENOS_CONTAIN_GRANT;AienosContainAuthorizer az={aienos_contain_table_decide,&p};CHECK(aienos_contain_create(&g,gm,aienos_contain_footprint(),a,v,office,&az)==AIENOS_CONTAIN_OK);uint32_t baseline=o.calls;size_t proposals=0,decisions=0,executions=0,events=0;for(uint64_t seed=1;seed<=9;seed++){ArgusEvent*ev=calloc(CORPUS_N,sizeof *ev);CHECK(ev!=NULL);size_t n=argus_corpus_benign(ev,CORPUS_N,seed);CHECK(n==CORPUS_N);CHECK(feed(ev,n,g,&proposals,&decisions,&executions)==ARGUS_OK);events+=n;free(ev);}const char*files[]={"r7-v11.bin","r8-v11.bin","r9-v11.bin"};for(size_t i=0;i<3;i++){ArgusEvent*ev=NULL;size_t n=0;CHECK(load(files[i],&ev,&n)==0&&n>0);CHECK(feed(ev,n,g,&proposals,&decisions,&executions)==ARGUS_OK);events+=n;free(ev);}CHECK(proposals==0&&decisions==0&&executions==0);CHECK(o.calls==baseline);printf("GATE ARGUS1_FALSE_POSITIVE_PASS %s events=%zu proposals=%zu decisions=%zu executions=%zu authority_calls=%u\n",failures?"FAIL":"PASS",events,proposals,decisions,executions,o.calls-baseline);aienos_cap_set_observer(a,NULL,NULL);aienos_contain_destroy(g);aienos_cap_stop(a,v);free(gm);}
+static void one_bench(int attached,uint64_t*vals,size_t*nvals){ArgusEvent*ev=calloc(CORPUS_N,sizeof *ev);if(!ev)abort();if(argus_corpus_benign(ev,CORPUS_N,77)!=CORPUS_N)abort();State s;if(init(&s,attached))abort();size_t props=0;int rc=replay(&s,ev,CORPUS_N,attached,vals,nvals,&props);if(rc||props){fprintf(stderr,"bench replay rc=%d proposals=%zu\n",rc,props);failures++;}fini(&s);free(ev);}
+static void bench_g8(void){uint64_t b[SAMPLE_N],a[SAMPLE_N];size_t nb=0,na=0;for(size_t i=0;i<ROUNDS;i++){if(i&1){one_bench(1,a,&na);one_bench(0,b,&nb);}else{one_bench(0,b,&nb);one_bench(1,a,&na);}}uint64_t bp=pct(b,nb,.5),ap=pct(a,na,.5),b99=pct(b,nb,.99),a99=pct(a,na,.99);double d=100.0*((double)ap/(double)bp-1.0);printf("GATE ARGUS1_G8_INGEST base_p50=%llu attached_p50=%llu base_p99=%llu attached_p99=%llu delta=%.2f%% batches=%zu\n",(unsigned long long)bp,(unsigned long long)ap,(unsigned long long)b99,(unsigned long long)a99,d,nb);if(d>3.0)failures++;}
+int main(int argc,char**argv){int gate_only=argc>1&&!strcmp(argv[1],"--gate-only");gate10();if(!gate_only)bench_g8();printf("ARGUS-1 F: %s\n",failures?"FAIL":"PASS");return failures?1:0;}
diff --git a/native/argus/tests/fixtures/argus1/README.md b/native/argus/tests/fixtures/argus1/README.md
new file mode 100644
index 00000000..ab6f793f
--- /dev/null
+++ b/native/argus/tests/fixtures/argus1/README.md
@@ -0,0 +1,10 @@
+# Recorded G10 streams
+
+These are the canonical 128-byte ARGUS events captured by the pinned RX_ARGUS=2
+speed-round runs from `workspace/argus-runtime-streams/speed2-pinned` on 2026-09-29.
+They are replay inputs for the containment false-positive gate; the metadata sidecars
+remain in that evidence directory. SHA-256 values:
+
+- R7: `bdad718d85ad1b57c1ca99111923494f2e8f39134e73f4480877cdbe4ef459f0` (320 events)
+- R8: `78d10f0b2f6c3b8b9834039ea84f4bd93134c064a0463ea5f088233b7e397588` (1,926 events)
+- R9: `8ce9de0c372128e2abf3acf779c1f4cbf84d1c5c28bcc2623e778add3dcdcb2e` (37 events)
diff --git a/native/argus/tests/fixtures/argus1/r7-v11.bin b/native/argus/tests/fixtures/argus1/r7-v11.bin
new file mode 100644
index 00000000..59868fc6
Binary files /dev/null and b/native/argus/tests/fixtures/argus1/r7-v11.bin differ
diff --git a/native/argus/tests/fixtures/argus1/r8-v11.bin b/native/argus/tests/fixtures/argus1/r8-v11.bin
new file mode 100644
index 00000000..37acd3c3
Binary files /dev/null and b/native/argus/tests/fixtures/argus1/r8-v11.bin differ
diff --git a/native/argus/tests/fixtures/argus1/r9-v11.bin b/native/argus/tests/fixtures/argus1/r9-v11.bin
new file mode 100644
index 00000000..9d1f874a
Binary files /dev/null and b/native/argus/tests/fixtures/argus1/r9-v11.bin differ
diff --git a/native/argus/tests/run_argus1_bench.sh b/native/argus/tests/run_argus1_bench.sh
new file mode 100755
index 00000000..98564dae
--- /dev/null
+++ b/native/argus/tests/run_argus1_bench.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+bench_bin=$1
+mode=$2
+integration_bin=$3
+lane_out=$4
+quiet_file="${HOME}/workspace/.spark-quiet"
+lock_file="${HOME}/workspace/.argus-bench.lock"
+
+if [[ -e "$quiet_file" ]]; then
+    echo "ARGUS-1 benchmark blocked: .spark-quiet is present" >&2
+    exit 2
+fi
+if ! command -v taskset >/dev/null || ! command -v flock >/dev/null; then
+    echo "ARGUS-1 benchmark needs taskset and flock on the Spark host" >&2
+    exit 2
+fi
+
+flock -n "$lock_file" bash -c '
+    set -euo pipefail
+    taskset -c 7 "$1"
+    if [[ "$2" == full ]]; then
+        taskset -c 7 make -f lane_b.mk LANE_B_OUT="$4" bench-ring
+        taskset -c 7 "$3" --bench
+    fi
+' bash "$bench_bin" "$mode" "$integration_bin" "$lane_out"