Qwen3-0.6B inference (12 KB), bare-metal bootable OS (22 KB), and from-scratch Mini-GPT trainer with live Braille TUI (32 KB) in 100% pure x86-64 NASM assembly. Zero C, zero libc, zero dependencies.
eBPF-Jev Shared Architecture & Binary Contract (v1)
Defensive Linux kernel security research project (05-ebpf-jev/).
All tests use inert fixtures (disposable dummy files, local loopback sinks) — zero offensive payloads.
1. Scope & Hooks (Linux 6.12 KVM testbed, CONFIG_BPF_LSM=y, lsm=...,bpf)
Monitored processes live inside a dedicated launcher-managed cgroup.
Four non-sleepable lsm/* hooks (zero tail_call dependencies, 100% bpf_loop-compatible):
lsm/task_alloc: copies 32-byteint8_t h[32]+ metadata from parentBPF_MAP_TYPE_TASK_STORAGEto child (withmodel_gencheck and gracefulNULLhandling).lsm/bprm_check_security: extracts bounded event feature vectorx[32]from executable identity (bprm->fileinode/dev class + hashed byte 3-grams ofbprm->filename, interpreter class, depth/uid flags) and updatesh[32]intask_storage.lsm/file_open: extractsx[32]from resolved(dev, ino)against a registered protected-object map (protected_objects_map), open flags (O_RDONLY/O_WRONLY/O_RDWR), and file class. Registered config (40) and protected (85/127) objects advance recurrent state. Opens of unregistered inodes leave that state intact.lsm/socket_connect: extractsx[32]fromsockaddr(sa_family, port bucket, loopback/private/allowlisted CIDR vs external), runs the recurrent forward pass on[x[32], h[32]], updatesh[32], evaluates the calibrated multi-head decision scoresy[4], emits aBPF_RINGBUFevent (with exactktime_nsdelta, scores, action), and returns-EPERMif(deterministic_floor_deny || (y[0] >= thresh_deny && y[3] <= max_uncertainty)).
2. Exact Fixed-Point Recurrent Micro-Jev Math (Bit-Exact Python <-> eBPF C)
- Input per event:
int8_t in[64], where:in[0..31]= current event feature vectorx[32](int8,[-128, 127])in[32..63]= previous task hidden stateh[32](int8,[-128, 127], initialized to0at root task start)
- Layer 1 (
64 -> 64, INT8 weights, INT32 bias & accumulator):W1[64][64](int8_t, 4,096 B),b1[64](int32_t, 256 B),shift1(uint8_t, right-shift after acc)- For
j in 0..63:acc = b1[j] + sum_{i=0..63} ((int32_t)in[i] * (int32_t)W1[j][i])val = (acc > 0) ? (acc >> shift1) : 0// ReLU + arithmetic shifth1[j] = clamp_i8(val, 0, 127)
- State Update (Recurrent Carry in
BPF_MAP_TYPE_TASK_STORAGE):h_next[0..31] = h1[0..31](stored back intotask_storage!)
- Layer 2 (
64 -> 4Multi-Head Jev Decision Output):W2[4][64](int8_t, 256 B),b2[4](int32_t, 16 B),shift2(uint8_t)- For
k in 0..3:acc = b2[k] + sum_{j=0..63} ((int32_t)h1[j] * (int32_t)W2[k][j])logit = clamp_i32(acc >> shift2, -128, 127)prob_u8[k] = sigmoid_lut[logit + 128]// 256-byte calibrated LUT (uint8_tin0..255)
- The 4 Jev heads:
k=0:exfil_risk(0..255, probability of unauthorized secret-to-network exfiltration)k=1:evasion_chain(0..255, probability of suspicious child-fork / wrapper chain after protected access)k=2:benign_dev_workflow(0..255, probability of legitimate developer/CI workflow)k=3:uncertainty(0..255, calibrated abstention / low-confidence score)
- Optional Content N-Gram Embedding Table (in flat
BPF_MAP_TYPE_ARRAY, single element):emb[1024][16](int8_t,16,384 B) indexed byfnv1a_3gram(filename_bytes) & 1023forin[16..31], whilein[0..15]carry structured kernel features (event_type one-hot, protected_obj_class, open_flags, exec_interpreter_class, fork_depth, uid_class, dst_cidr_class, dst_port_bucket, time_delta_bucket, prior_protected_count, prior_exec_count).- Total model weight footprint: ~21 KB (16 KB embedding + 4.6 KB recurrent MLP + 256 B sigmoid LUT + metadata) — fits completely inside L1/L2 cache and double-buffered BPF map (
active_slotatomic flip for live hot-swap!).
3. Feature Layout in[0..31] (Shared Frozen Mapping)
in[0]: event_type (0=bprm,64=file_open,127=socket_connect)in[1]: protected_object_class (0=none,40=config_nonsecret,85=dummy_env,127=dummy_key)in[2]: open_access_mode (0=none,40=rdonly,85=wronly,127=rdwr)in[3]: exec_binary_class (0=other,30=coreutils_git,65=build_pkg_mgr,95=shell,127=script_interp_net_tool)in[4]: fork_depth_from_cgroup_root (min(depth * 25, 127))in[5]: dst_class (0=none,30=loopback_approved,75=local_private,127=unapproved_sink)in[6]: dst_port_bucket (0=none,30=http_https,65=dns_ssh,95=high_ephemeral,127=nonstandard_sink)in[7]: time_since_protected_open_bucket (0=never,127=<1s,90=1..5s,50=5..30s,20=>30s)in[8]: protected_open_count (min(cnt * 32, 127))in[9]: exec_count_since_protected (min(cnt * 32, 127))in[10]: inherited_taint_flag (0or127if parent hadprotected_open_count > 0)in[11]: benign_allowlist_hint (0or127if binary+dst match known approved dev registry/tooling)in[12..15]: reserved / zero (0)in[16..31]: pooled 16-dim INT8 FNV-1a 3-gram hash embedding over bounded path/filename bytes (<= 64 B, clamped[-128, 127];0when hook has no string).
4. Shared Binary Pack Format (ebpf_jev_model.bin + ebpf_jev_weights.h)
Little-endian C struct struct jev_model_weights (fixed exact size, padded to 8B):
uint32_t magic(0x4A455631="JEV1")uint32_t model_genuint8_t shift1, shift2, thresh_deny, max_uncertaintyuint8_t emb_shift, reserved[3]int8_t emb[1024][16]int8_t W1[64][64]int32_t b1[64]int8_t W2[4][64]int32_t b2[4]uint8_t sigmoid_lut[256]
5. Required Comparators (Identical Features & Splits)
noop(empty LSM hooks, latency baseline)rule_fsm(deterministic: any protected open -> deny unapproved connect)oblivious_gbdt(16–32 depth-4 oblivious trees inBPF_MAP, INT16 leaves, same 32 features + counters)stateless_mlp(same32 -> 64 -> 4INT8 MLP withh[32]zeroed)recurrent_jev(full recurrent64 -> 64 -> 4INT8 multi-head Micro-Jev withtask_storageh[32])