epoch-valid lookup
0.018µs
RESEARCH PROTOTYPE · LINUX eBPF LSM
PolicyTLB is an in-progress research prototype that uses BPF LSM hooks and a TLB-hit-modeled three-tier decision pipeline to detect and block dangerous local agent behavior.
epoch-valid lookup
0.018µs
safe & cacheable cases
0.023µs
path · command · socket
0.989µs
Documented cost-model values from the repository.
THE SECURITY GAP
MCP gives LLM agents access to local tools, files, databases, and network resources. Prompt injection or agent hijacking can lead to unauthorized command execution, sensitive-file access, or outbound connections.
Command-prefix policy matching is part of the exec decision path.
bprm_check_security
File-path policy matching and resource-id lookups support the file access path.
file_open · file_permission
IPv4 and port rules are evaluated for socket connection decisions.
socket_connect
CACHE-FIRST ENFORCEMENT
PolicyTLB evaluates a resource at allocation, open, connect, or exec time, then stores the decision with the current global epoch. Repeated events can reuse an epoch-valid entry; misses fall through to a deeper layer.
L1 · FAST PATH
The cache key contains tgid, pid, hook, and resource id. An entry is used only when its epoch equals the current global epoch.
L2 · SEMI-FAST PATH
Some cases, such as selected non-regular files, can be handled without deep path or string matching.
L3 · SLOW PATH
Generation-aware indexes evaluate path, command, socket, and resource rules and emit deny or audit events.
IMPLEMENTATION MAP
Only the L1 programs are attached to LSM hooks. Internal L2 and L3 programs are reached through per-hook BPF tail-call program arrays.
BUILT FOR INSPECTION
The repository includes policy files, tests, metrics, and a controlled experiment harness for hook-internal policy-path latency and end-to-end workload overhead.
Inspect the repositoryLPM trie policy lookup covers file paths, command prefixes, and IPv4/port rules.
Ring-buffer events are delivered to user space, while per-CPU metrics track hook, layer, and action.
The harness keeps hook-internal policy latency separate from end-to-end workload time.
A profile file and comm, pid, and tgid selectors can scope enforcement to an agent.
IMPORTANT CONTEXT
The implementation, GUI, policy format, and experiment harness are intended for academic evaluation and controlled development environments, not production deployment.