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 +#include +#include +#include + +#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;bcore,&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;jcontain,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&&*nsy)-(x0);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;i3.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"