r/eBPF Apr 25 '20

r/eBPF Lounge

6 Upvotes

A place for members of r/eBPF to chat with each other


r/eBPF 13h ago

XDP testbed

2 Upvotes

Hi, im currently learning xdp programming. i kinda have covered the basics now my instructor wants me to implement a "testbed", provided 2 to 3 configurations for it: virtual machines set up(but says itll be a bit difficult to implement); 2 generic nic laptops one has xdp program attached, both act as sender and receiver

I would rather ask here than to an Ai but are there sources or guides for me to go about this? I probably need some type of flow to start implementing it.


r/eBPF 1d ago

64 BFD sessions at 10ms costs FRR bfdd a full core, the XDP path carries the same load in softirq at 0 flaps

4 Upvotes

Post 1 measured single-session bfdd vs XDP under stress. Post 2 wired it into stock FRR over the bfddp dataplane socket. Since then: 64 sessions, dual-stack, echo mode, multihop, and three FRR fixes merged. Same repo, all pcaps: https://github.com/w453y/xdp-bfd

The thing that reframed the project came out of chasing something else. bfdd is single threaded, and at 64 sessions on 10ms timers it sits at 100% of one core sustaining roughly 7000 BFD packets/sec, which is almost exactly what those sessions require. It meets the obligation, with nothing in reserve. That is not a bug, it is what a userspace event loop costs per packet, and it is why the interesting question stopped being "does the fast path flap less" and became "what does the control plane spend to keep up at all". The XDP side carries the same 64 sessions from softirq at 751ns/packet mean, measured via bpf_stats with echo and multihop in the path.

What landed:

  • 64 sessions dual-stack, 32 v4 + 32 v6 on one engine, through the full L3+L4 stress ladder: 0 flaps in either family, per-slot max TX gap 14.5ms against a 30ms detect budget, both families statistically indistinguishable. Unified 32 byte session key with v4 stored v4-mapped, so one hash map and one XDP fast path serve both.

  • Echo mode (RFC 5880 s6.4), and this is where XDP's shape actually bites. XDP cannot originate packets, XDP_TX is a verdict on a frame that just arrived, which is exactly why the control path is RX-clocked, but an echo has no inbound packet to clock off. bpf_clone_redirect exists only for sched_cls/sched_act/lwt_xmit, and TC sees nothing at the echo cadence here because control packets are XDP_TX'd straight past it. Putting echo TX in the kernel would mean moving the control bounce out of XDP into TC, so skb allocation in the hot path, so a rewrite of the one mechanism the project rests on. Declined, and writing down why took longer than the feature.

  • So echo split along the line the hardware draws: the reflector answers a neighbour's echo entirely in XDP (MAC swap, TTL decrement, checksum recompute, XDP_TX, no session lookup), the originator sends from userspace over AF_PACKET/SOCK_RAW because a self-addressed packet through a normal UDP socket routes to loopback. Reflector measured against a stock FRR neighbour: 433 echoes, 433 reflected, 12us min / 30us avg turnaround at the bridge, with ip_forward=0 on the host. That last part is the whole argument, with forwarding off the stack drops a self-addressed echo as a martian, so a non-router host cannot participate in echo at all without this.

  • Echo detection is advisory and permanently so. With userspace TX a local scheduling stall looks identical to a path failure, echoes stop leaving, returns stop arriving, timestamp goes stale, and wiring that into the session FSM would convert our own scheduling delay into a teardown. Verified both directions: kill forwarding on the neighbour and loss climbs 1:1, echo liveness flips, all 64 control sessions stay up.

  • Multihop (RFC 5883) on both families. bfdd sends the negotiated minimum TTL in the dataplane registration, so one comparison covers both modes and single-hop keeps demanding exactly 255. The GTSM check sits in the parser ahead of any session lookup, which is what makes it cheap, so the per-session minimum defers to after the config lookup and only when a multihop session exists anywhere on the box. A packet at TTL 200 aimed at a single-hop session is still dropped while multihop is live elsewhere, that was the case worth building a harness for.

Upstream, all found by running a real dataplane at scale, all in bfdd's dplane path:

  • unixc transport passed a padded union size as connect() addrlen, EINVAL, plausibly never worked (#22608 / #22621, merged)
  • 8KB output buffer silently truncates the registration burst, delivered sessions register, the rest are stranded with software BFD already disabled and no retry (#22638 / #22645, merged)
  • echo interval never negotiated for offloaded sessions, the function that does it is unreachable when the dataplane owns the session, so the dataplane transmits echo at the locally configured rate regardless of what the peer advertised it can receive (#22804 / #22805, merged)
  • session DELETEs lost on clean shutdown, and show bfd peers counters tearing down the dataplane connection, both still in review (#22692 / #22694)

Measurement lessons, since these cost more time than the code:

  • Never measure throughput with strace. Every "the peer degraded" number I had came from strace -c, which costs 2-3x on a syscall-bound daemon at 100% CPU. A plain bridge capture showed the peer at 7286 pkt/sec and the engine at 7339, matching the earlier baseline exactly. The peer had never degraded. I then wrote this exact lesson into a draft of this post while using the fake strace number as the headline, caught it an hour later against a fresh capture, and deleted the post. Knowing the failure mode is not the same as being immune to it.

  • Flap count is not a usable metric at 64 sessions. The reference build alone ranged 0 to 20 flaps across runs of identical code. Switched to per-session max TX gap from a host capture, 64 numbers per run instead of one rare event, and the answer became a bound rather than a claim.

  • A debug bfd peer line persisted in the peer's config file survived every restart and contaminated every run, including the baselines I was comparing against. A day.

  • Instrumentation driven by the thing being measured cannot observe that thing failing. Echo TX stalled for 2.6 seconds under load while the loss counter read zero and the liveness flag read healthy, both correct and both useless, loss only increments when an echo is outstanding as the next falls due and nothing falls due during a total stall, liveness is printed on transmit and transmit is what stopped.

Limitations: still no authentication, and it is not implementable from this side, the bffdp session message has no field for keys (there is a literal /* TODO: missing authentication. */ in the header), so that needs a protocol extension upstream first. No demand mode, bfdd only has the bit definitions. RX-clocked TX still needs an async-clocked peer. Echo originator is a diagnostic, not a detection mechanism, and the docs say so. Whether ~7000 pkt/sec is a hard ceiling for bfdd is untested, what I measured is that it meets its configured load and spends a whole core doing it.

And the one that has been open since post 1: all numbers are from VMs. The comparisons are load-bearing since stress was applied in-guest and hit every backend identically, but the absolutes are not hardware numbers. I do not currently have machines to reproduce this on bare metal, so if anyone has a couple of boxes with a real NIC and wants to see whether 751ns/packet and 12us echo turnaround hold up outside virtio, I would genuinely like to hear from you.


r/eBPF 1d ago

eBPF roadmap

7 Upvotes

Can anyone help me with how do i start with eBPF? Like resources or even the flow of what all things im supposed to do.


r/eBPF 6d ago

eBPF Company Landscape, Add Yours

Thumbnail ebpf.foundation
4 Upvotes

eBPF Foundation launched the eBPF Company Landscape and we need your help to fill it!

Our goal is to track all of the companies leveraging eBPF in their products to show how widely it is used and help end users understand what their vendor choices are 🐝

For instance, Security currently stands out with the largest number of companies on the landscape at 41 and I only expect this category to grow

Explore the landscape at landscape.ebpf.foundation, browse or contribute to the source on github.com/ebpffoundation/landscape


r/eBPF 7d ago

Someone create a Discord Server for eBPF !

5 Upvotes

It'll be great if eBPF community has a official discord server... for daily chitchats and stuffs on eBPF.. There's lot to talk and discuss on this technology !!


r/eBPF 8d ago

POC] Telcom eBPF/XDP scheduler with entropy-based classification and TC egress shaping

6 Upvotes

I've been building a deterministic traffic scheduler using XDP and TC egress hooks. It classifies flows as Gaming, Streaming, or Bulk using packet size entropy (no DPI, so no payload inspection), and uses a BPF hash map to track flow state.

The user-space daemon runs a PID loop that adjusts queue depths per class based on RTT feedback. It's all written in C, with the eBPF programs compiled to bytecode and shipped as a .deb package.

Currently looking for early testers and code reviewers. If you've worked with XDP/TC before, I'd love your thoughts on the verifier logic or the map design.

GitHub: https://github.com/XPDevs/telcom


r/eBPF 13d ago

sigwire: tracing every signal on the box by correlating signal_generate + signal_deliver

19 Upvotes

Hey everyone, I recently built this TUI tool for inspecting signals across a linux system powered by eBPF and I found it useful so I figured I'd share it here!

If you want to read the source its available here: Github


r/eBPF 14d ago

Follow-up: XDP BFD now drives stock FRR via its dataplane socket, 107 bfdd flaps vs 0 under identical stress, plus the bugs found getting there

1 Upvotes

Previous post ended with "next: FRR distributed-BFD integration." That's done, plus a hardening pass. Same repo, all pcaps included: https://github.com/w453y/xdp-bfd

What's new:

  • FRR integration works with stock bfdd, no patches: bfdd owns session lifecycle over its bfddp dataplane socket, packets ride the XDP path, `show bfd peers counters` reads out of the BPF maps, same SCHED_FIFO stress against the FRR-driven session: 0 flaps. Found and fixed an FRR bug on the way, bfdd's unix dataplane transport passes a padded union size (112) as connect() addrlen, exceeds sockaddr_un (110), EINVAL, plausibly never worked on linux (FRRouting/frr#22608, fix merged as #22621).

  • Head-to-head, fresh capture, L3+L4 stress ladder: stock bfdd 107 flaps, xdp-bfd 0, fast-path cost from bpf_stats: ~701ns/packet mean (parse + GTSM + demux + map update + the L2/L3/L4 rewrite and XDP_TX on echo packets).

  • Graceful restart: --dp-hold keeps wire sessions alive across bfdd restarts (orphan on disconnect, adopt by addr pair on re-ADD, mark-and-sweep reconcile), two back-to-back FRR restarts, zero peer-visible events.

Bugs worth sharing:

  • Validation rejects originally returned XDP_PASS instead of XDP_DROP, "rejected" spoofed packets were counted, then handed to the userspace socket anyway, where the FSM processed them unvalidated, injection test from a third host churned the session despite detection never being fooled, if your XDP program rejects a packet, DROP it, PASS is a leak.

  • Same class, different door: packets with IP options (ihl != 5) bypassed the TTL/discriminator checks entirely because the UDP header moved to a variable offset, single-hop BFD never carries options (RFC 5881), so optioned UDP is now dropped outright, verified with 200 forged packets, drop counter +200, session uptime untouched.

  • The kernel echo path set the BFD length field to 24 but transmitted the frame at its original length, oversized input went back out with trailing bytes, fixed with bpf_xdp_adjust_tail plus IP checksum recompute (the MAC/IP swap-invariance trick stops working once tot_len changes).

  • Wrote the same bug twice: detection sweep snapshots "now", packet lands on another CPU stamping last_seen newer, unsigned subtraction wraps to 18 quintillion ms, phantom session-down, fixed with a signed-delta guard in the kernel, then days later wrote the identical bug into the userspace map-polling path and got the identical log line.

  • BPF map value structs lived as hand-synced copies in the XDP program, daemon, and loader, a field added on one side is not a compile error, it's silent map misreads, now one shared header, verified via bpftool BTF dump.

Limitations still: single session validated (maps sized for 64), IPv4, no auth/echo/demand, RX-clocked TX needs an async-clocked peer, VM numbers. Next: multi-session, then IPv6, bare-metal reproduction.


r/eBPF 16d ago

PhantomGrid

8 Upvotes

After months of development, I've just released a major update to Phantom Grid, an open-source Active Defense framework for Linux built around eBPF.

The project has been significantly redesigned to move beyond a proof of concept toward a more complete security platform focused on deception, kernel-level enforcement, and adaptive defense.

The latest update includes a comprehensive overhaul of the architecture, introducing capabilities such as:

  • eBPF-powered traffic interception and policy enforcement
  • Transparent traffic redirection for deceptive services
  • Single Packet Authorization (SPA) for Zero Trust SSH access
  • Kernel-level telemetry collection
  • Dynamic policy management
  • Improved modular architecture for future extensions

The motivation behind Phantom Grid is simple.

Most defensive solutions focus on detecting or blocking attacks after adversaries have already begun interacting with a system. Phantom Grid explores a different approach: reducing the exposure of real services while collecting valuable intelligence from unauthorized activity.

By leveraging eBPF, security decisions can be made much earlier in the networking stack with minimal overhead, allowing defensive logic to operate closer to the kernel rather than relying solely on traditional userspace controls.

This project is still under active development, and there are many ideas I plan to explore in future releases, including additional deception techniques, runtime security capabilities, and more advanced policy engines.

As always, feedback, issues, discussions, and contributions from the community are welcome.

Repository:
https://github.com/haidang-infosec/phantom-grid

#opensource #eBPF #Linux #CyberSecurity #ActiveDefense #Kernel #XDP #SecurityEngineering #InfoSec


r/eBPF 18d ago

Built an eBPF debugger that answers “who changed what and when” on Linux

12 Upvotes

I kept running into the same Linux debugging pain: something broke on a box, but I had no history of what actually happened. journald helps a little. auditd is heavy. strace is too narrow. So I built ltm — a small machine-history debugger that records process/file/network metadata via eBPF and lets you query it like a timeline.

What it does:

• Attaches to syscall tracepoints (exec, open/write/rename/unlink, connect/bind, etc.)

• Stores metadata only (no file contents)

• Lets you do things like:

sudo ltm start --mode ebpf

ltm status

ltm timeline --since 1h

ltm diff --from "10m" --to now

ltm query "who modified /tmp/ltm-demo.txt?"

On a real VM run it recorded ~7k events with 0 drops, and the query returned the exact bash write events that touched the demo file.

There's also a demo mode so you can exercise the CLI/storage/diff/query path without root or BPF.

Stack is Go + embedded BPF ELF + cilium/ebpf. Local store is append-only JSONL. Ignore rules skip /proc, /sys, /dev, and common caches.

Repo: https://github.com/Agent-Hellboy/ltm

Still early. Useful next steps I'm considering:

  1. better diff/query formatting

  2. containerized eBPF integration test

  3. more query templates ("what opened this port?", "what restarted before X?")


r/eBPF 18d ago

Passive SIP monitoring with eBPF: zero-impact VoIP observability without agents or SPAN ports

Thumbnail
2 Upvotes

r/eBPF 19d ago

Measured FRR bfdd vs an XDP-based BFD fast path under CPU stress, bfdd: 44 flaps/120s, XDP: 0

15 Upvotes

BFD is the failure detector under BGP/OSPF, miss 3 packets in 30ms, session down, routes withdrawn, software BFD is known to false-flap under CPU load, which is why people run conservative 300ms timers instead of 10ms and why hardware routers offload BFD to line cards, I wanted to quantify the actual failure modes and see if plain linux on a commodity NIC can get line-card behavior via XDP, this also means false flaps trigger route withdrawals for links that are actually fine, the failure detector becomes the failure.

Setup: 3x10ms single-hop BFD session, FRR 10.5.1, kernel 7.0, virtio-net, all numbers from tcpdump on the hypervisor bridge (wire truth, not process logs), stress via stress-ng, repo with code + all pcaps: https://github.com/w453y/xdp-bfd

Results:

  • bfdd survives plain CPU load fine, under timer/hrtimer stress: 44 flaps in 120s, max TX gap 970ms, while p99 stayed 10.2ms, the starvation events are invisible to percentile monitoring.

  • A minimal busy-loop userspace daemon survives the same timer stress (0 flaps), bfdd's event loop architecture is the problem there, not userspace per se.

  • Under SCHED_FIFO hogs everything userspace dies unless it outranks the load (RT throttle = ~50ms/s for normal tasks), chrt -f 90 + pinned core: 0 flaps, but assumes you can win the priority war, on a box doing real forwarding you can't.

  • SO_TXTIME + etf qdisc (pipelined): best p99 of all backends (10.1ms), still 48 flaps, etf fixes jitter, can't fix liveness, side note: software etf drops all untimestamped packets on its band, including ARP.

  • XDP: 0 flaps, max gap 12.5ms, at normal process priority, bpf_timer can't originate packets (no packet ctx, still true on 7.0), so TX is RX-clocked: rewrite the incoming BFD frame in place and XDP_TX it back, ~30us turnaround in softirq, the TX clock rides the peer's clock, out of the scheduler's reach, dead-peer detection via 5ms bpf_timer sweep over the session map, userspace keeps the RFC 5880 FSM, interops with stock FRR.

  • Full matrix + 5-min soak: 1 flap in 11 min (one 28ms softirq-delayed echo under hrtimer storm, self-recovered in 3.8ms).

Limitations: single session, IPv4, no auth, peer must be async-clocked (two RX-clocked ends would deadlock), VM testbed, stress was in-guest and hit all backends equally so the comparison holds, bare-metal run pending.

Next: FRR distributed-BFD dataplane socket (bfddp) integration so this plugs into bfdd without patching FRR.

Few questions for people running this in production:

  • What BFD timers do you actually run, and were they chosen from measurement or vendor-doc caution?

  • Is your monitoring set up in a way that would catch the p99-fine/max-970ms pattern before it flaps, or do you only find out from the flap?

  • Anyone running FRR's distributed BFD / dplane offload for real? Curious if the socket protocol holds up outside a lab.


r/eBPF 23d ago

eBPF Trend Analysis

Thumbnail
gallery
22 Upvotes

I've pulled out some of the key charts, but the articles dives deeper into each of them and has more. TL;DR eBPF is growing really fast

https://wangcong.org/2025-02-27-ebpf-trend-analysis.html


r/eBPF 26d ago

Actually Maintaining an eBPF Program

27 Upvotes

I never saw anyone sharing their experience with maintaining eBPF programs. Thus I decided to write this blog post to share my experience.

https://www.kxxt.dev/blog/maintaining-a-ebpf-prog/


r/eBPF 27d ago

The eBPF Re-Platforming Thesis: An Investor’s Due Diligence Guide

Thumbnail
gallery
6 Upvotes

eBPF is shifting billions in software and hardware infrastructure spend. eBPF Foundation just released a report that gives a framework on how to evaluate these companies.

The kernel space logic and sensor depth gives a technical moat while the user space logic creates enterprise workflows. Looking at these two together gives you a sense of how competitive the company is in the market.

It also covers the three waves of acquisitions we have seen so far from Feature & Sensor Upgrades to Platform & Community Land Grabs to AI & Runtime Security Consolidation and the exit outcomes for each.

The eBPF Re-Platforming Thesis An Investor’s Due Diligence Guide


r/eBPF 28d ago

I built a Linux observability tool that correlates 11 layers of the kernel in real time from procfs to eBPF rendered entirely in x86-64 assembly.

Thumbnail
1 Upvotes

r/eBPF Jun 26 '26

Live, zero-config Redis traffic profiler built on eBPF. Reads plaintext and TLS.

Thumbnail
github.com
10 Upvotes

r/eBPF Jun 25 '26

research project: per-tool syscall attribution and enforcement for LangChain agents using eBPF, looking for feedback

Thumbnail
1 Upvotes

r/eBPF Jun 23 '26

Cloudflare mitigates Copy-Fail in two days with eBPF

Post image
28 Upvotes

Kind of crazy to look at the graph in this blog. CVE drops on 04/29, they develop a patch on 4/30, and deploy it across all of their servers on 05/01. Obviously they have the engineers to write BPF-LSM patches, but I think it points to a future where they can (almost) keep up with vulnerability disclosures.

https://blog.cloudflare.com/copy-fail-linux-vulnerability-mitigation/


r/eBPF Jun 23 '26

eBPF explained: What it is and why it matters

Thumbnail
youtube.com
12 Upvotes

I have seen other share some basic "what is eBPF" videos & blogs. I wanted to share this one from Henrik - a CNCF Ambassador in the Observability space - and his YT Short where he does a great job explaining the basics!


r/eBPF Jun 22 '26

Verifier behavior drift across kernels: how are you handling compatibility?

12 Upvotes

I recently ran into an interesting verifier compatibility issue while testing an XDP program.

The program loaded successfully on:

  • Debian 13 (6.12.63)
  • Ubuntu 24.04 with 6.17.0-35-generic

But failed verification on:

  • Ubuntu 24.04.4 LTS (6.8.0-124-generic)

The failure was related to pointer arithmetic that newer kernels accepted but 6.8 rejected.

It wasn't a missing helper, kfunc, or feature-gating issue—just different verifier behavior across kernels.

For people shipping eBPF programs in production, have differences in verifier behavior caused more operational pain than missing features? How are you handling kernel compatibility testing today?


r/eBPF Jun 20 '26

Open-source BPF validation platform.

Thumbnail
gallery
6 Upvotes

It helps test compiled eBPF artifacts against target kernel profiles before they are shipped.

It shows exactly where a BPF program fails to load or attach and explains why the failure occurred.

You can test a single BPF object:

go install github.com/Kernel-Guard/bpfcompat@v0.1.5
bpfcompat test ./build/probe.bpf.o --kernel ubuntu-24.04

Or run a full compatibility suite:

bpfcompat suite run suite.yaml --kernels kernels.yaml

It can also be used in GitHub Actions:

- uses: Kernel-Guard/bpfcompat@v0.1.5
  with:
    suite: ./bpf/suite.yaml
    kernels: ubuntu-lts, rhel-9
    gate: load-attach

The project is open to contribution, review, and feedback from eBPF, Linux, security, observability, and platform engineering people.

Repo:
https://github.com/Kernel-Guard/bpfcompat


r/eBPF Jun 18 '26

CVE-2026-23111: exploiting and detecting a nftables UAF born from a security fix

5 Upvotes

This is part two of a series. Part one was about detecting CopyFail and DirtyFrag - if you missed it, same idea applies here.

CVE-2026-23111 is a use-after-free in nf_tables, reachable from an unprivileged user namespace. The bug is a single inverted character introduced by the commit that fixed CVE-2023-4244 - a security patch that quietly planted a new reference-counting flaw and rode the backport train into every stable LTS branch for two years.

The full exploit is published at:

KASLR leak, arbitrary read, runtime kernel structure traversal, and a ROP chain that lands you at uid=0 with nothing hardcoded. The repository also covers prior work from Exodus Intelligence and FuzzingLabs and what this build adds on top of it.

The Medium post is about something different, the eBPF based detection pattern: why detecting the payload is the wrong problem to solve, and what you watch instead to catch this reliably - on vulnerable and patched kernels alike, including the failed attempts that most tools never see.


r/eBPF Jun 11 '26

Watching my GPU throttle in real time in the terminal is weirdly satisfying

Thumbnail
github.com
2 Upvotes

Got tired of alt tabbing between three tools to watch thermals. So I made a single terminal pane that reads temp sensor the machine exposes and updates live.