DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
FREEDOM251

Freedom251 › Blog › BPF LSM

Your Antivirus Only Watches. Mine Kills: Building a Detect-and-Respond Agent with Rust and eBPF

By Freedom251 Team · · 5 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Linux agent built with Rust and eBPF can do more than collect security events: it can pair kernel-level instrumentation with a user-space process that evaluates events and takes a response action. But “kills” needs a precise meaning. A BPF LSM hook can deny a covered operation at the hook; a separate user-space agent can request termination of a process after receiving an event. Those are different designs, and neither makes a custom agent a proven malware detector.

What “kills” means in a Linux security agent

For this design, “kills” means a defined response to a defined event—not a claim that the agent identifies and eliminates every threat. The response could be a kernel policy that denies a particular operation, or a user-space component that asks the operating system to terminate a process after evaluating telemetry. The first acts at a selected security hook; the second acts after event delivery and analysis.

As an Amazon Associate I earn from qualifying purchases.

That distinction matters operationally. A hook can mediate only operations covered by that hook and policy. A user-space response depends on event delivery, the policy decision, permissions, and the process still being actionable. The available documentation establishes the building blocks, not that a particular implementation reliably detects malware, responds to every event, or always succeeds in stopping a harmful process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the Rust and eBPF architecture fits together

Kernel side: observe or mediate selected operations

eBPF programs run in the Linux kernel and can attach to supported hook points. With BPF LSM, a program can instrument selected Linux security hooks. The kernel documentation describes the capability this way: “These BPF programs allow runtime instrumentation of the LSM hooks by privileged users to implement system-wide MAC (Mandatory Access Control) and Audit policies using eBPF.” This makes BPF LSM a mechanism for policy and audit at relevant operations, not an automatic, comprehensive malware detector. See the Linux kernel BPF LSM documentation.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

User space: load programs and decide what to do

A user-space component can load and manage eBPF programs, receive events, apply policy, and initiate a response. Aya is a Rust eBPF library; its documentation says it does not rely on libbpf or bcc and describes BTF support and portability where the necessary Linux support exists. That portability goal is not a promise that one binary works on every distribution or kernel.

A proposed event-to-response flow could look like this:

Rank #2
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts
  1. Attach: the Rust agent loads an eBPF program and attaches it to a supported hook.
  2. Observe or enforce: the kernel program reports a relevant event to user space, applies a narrow policy at the hook, or does both where the implementation supports it.
  3. Evaluate: the user-space policy loop decides whether the event warrants a response.
  4. Respond: the agent records the decision and, for a post-event response, requests an action such as terminating a process.

This is an architecture, not evidence that a specific agent has been implemented or tested. Do not describe a user-space termination request as atomic with the event that triggered it: the observation, delivery, decision, and response are separate boundaries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choosing where enforcement belongs

Design What it does Response boundary Main limitation
Hook-level policy A BPF LSM program can allow or deny a covered operation according to policy. At the selected security hook. It only governs operations covered by the chosen hook and implemented policy; it does not by itself establish threat detection quality.
User-space response A Rust agent receives telemetry, evaluates it, and can request a response such as process termination. After event delivery and policy evaluation. Success depends on the user-space loop and the target still being actionable; it is not the same as blocking the original operation.
Combined design Kernel instrumentation supplies events or narrow enforcement while user space handles broader policy and response logic. Depends on whether the specific action is enforced in-kernel or requested later from user space. More components and compatibility conditions must work together; no benchmark or detection guarantee follows from the architecture alone.

Check BPF LSM compatibility before building around it

The documented Aya LSM route has specific prerequisites. Aya lists a minimum kernel version of 5.7, CONFIG_BPF_LSM=y, CONFIG_DEBUG_INFO_BTF=y, and enabling BPF LSM through boot parameters. Its example boot setting is lsm=lockdown,yama,bpf. These are requirements for this LSM route, not universal requirements for every kind of eBPF program. Consult the Aya LSM macro documentation and verify the actual target kernel configuration and boot setup.

Rank #3
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

A minimum kernel version is not a distribution support guarantee. Kernel configuration and vendor packaging can vary, so test the systems you intend to support rather than assuming that every kernel at or above 5.7 exposes a usable BPF LSM setup. BTF and the LSM boot configuration are part of the documented path.

What an existing endpoint product demonstrates—and what it does not

Microsoft documents an eBPF sensor in Defender for Endpoint on Linux. The sensor supplies supplementary event data and describes event flow previously obtained from AuditD; the product documentation also publishes agent-version and distribution/kernel prerequisites. This is evidence that a production endpoint-security product uses eBPF for Linux sensing. It does not show that the product uses Aya, follows the architecture above, or uses BPF LSM to kill threats.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Microsoft’s compatibility requirements are product-specific and can change. Its documentation identifies a minimum agent version of 101.23082.0006 and provides distribution-specific kernel requirements, including a warning about a problematic Oracle Linux 8.8 UEK kernel configuration/version. Check the current Defender for Endpoint eBPF support documentation for the exact product matrix rather than treating those values as general eBPF requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Evaluate the design by coverage and compatibility, not speed claims

The available documentation does not provide an apples-to-apples performance benchmark for a custom Rust/eBPF agent. A useful evaluation instead asks what the system observes or enforces, which hook covers the operation, where the response occurs, and which target kernels and distributions meet its prerequisites.

Best Value
FIDO2 U2F Security Key Passkey Two-Factor Authentication (2FA) USB Key PIN+Touch (Non-Biometric) USB-A Type TrustKey T110
  • Security Key : Protect your online accounts against unauthorized access by using FIDO2 and U2F authentication with T110. It's the world's most protective security key that works with windows, Mac OS, Linux as well as Chrome, Firefox, Edge and many other major browsers.
  • Certified with the new FIDO2 standard, T110 provides the benefit of fast login and strong protection against phishing, account takeover as well as many other online attactks.
  • Works with : Bank of America, Github, Google, Microsoft, DUO, Twitter, Facebook, Dropbox, Apple, ebay, BINANCE, mor and more.
  • Fits USB-A port : Insert the T110 security key into the USB-A port of each service and log in conveniently with one touch
  • For the driver download and user guide, please visit TrustKey Solutions Home support page.
  • Coverage: identify the events and operations the selected hooks actually cover; do not equate a stream of telemetry with complete visibility.
  • Response location: distinguish a decision that denies an operation at a hook from a later user-space action.
  • Compatibility: validate kernel version, BPF LSM configuration, BTF availability, boot parameters, and distribution-specific behavior on each supported target.
  • Operational behavior: define what happens if the agent is unavailable, an event cannot be delivered, or a response request fails. These are implementation questions, not outcomes guaranteed by Aya or BPF LSM.
  • Maintenance: account for kernel and distribution variation and keep supported-target claims tied to versions that have actually been verified.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

BPF LSMcybersecurityeBPFLinuxRust

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.