<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amir Ghazanfari</title>
    <description>The latest articles on DEV Community by Amir Ghazanfari (@amir_ghazanfari_2937dd0cb).</description>
    <link>https://dev.to/amir_ghazanfari_2937dd0cb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1913361%2Ff66aac27-fc30-449c-8aea-3f7c444d3d62.jpg</url>
      <title>DEV Community: Amir Ghazanfari</title>
      <link>https://dev.to/amir_ghazanfari_2937dd0cb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amir_ghazanfari_2937dd0cb"/>
    <language>en</language>
    <item>
      <title>A Beginner's Guide to eBPF in Rust — from kprobes to a working agent</title>
      <dc:creator>Amir Ghazanfari</dc:creator>
      <pubDate>Sun, 18 Oct 2026 20:54:59 +0000</pubDate>
      <link>https://dev.to/amir_ghazanfari_2937dd0cb/a-beginners-guide-to-ebpf-in-rust-from-kprobes-to-a-working-agent-3dc3</link>
      <guid>https://dev.to/amir_ghazanfari_2937dd0cb/a-beginners-guide-to-ebpf-in-rust-from-kprobes-to-a-working-agent-3dc3</guid>
      <description>&lt;p&gt;A few months ago I decided to learn eBPF. Almost every beginner resource I found was C-centric — bcc, libbpf, kernel headers, Makefiles that break. Meanwhile I kept hearing that Rust, via the &lt;a href="https://aya-rs.dev/" rel="noopener noreferrer"&gt;Aya&lt;/a&gt; framework, is one of the nicest ways to write eBPF today: both the kernel-side programs &lt;em&gt;and&lt;/em&gt; the userspace loader in one language, one Cargo project, no C toolchain.&lt;/p&gt;

&lt;p&gt;What I couldn't find was a structured path from zero. So I built one, and I'm sharing it: &lt;strong&gt;&lt;a href="https://amghazanfari.github.io/ebpf-beginner/" rel="noopener noreferrer"&gt;A Beginner's Guide to eBPF in Rust&lt;/a&gt;&lt;/strong&gt; — 8 chapters, each with runnable code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What eBPF is, in two sentences
&lt;/h2&gt;

&lt;p&gt;eBPF lets you run small, sandboxed programs &lt;em&gt;inside the Linux kernel&lt;/em&gt; — triggered by events like a process starting, a network packet arriving, or a function being called. The kernel's verifier checks your program before it runs, which makes it safe to attach to a production machine: you can trace, filter, and observe at a level that used to require writing kernel modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the guide covers
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Getting started with Aya&lt;/strong&gt; — project setup, what the verifier actually checks, loading your first program&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kprobes&lt;/strong&gt; — run code when any kernel function is called&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XDP&lt;/strong&gt; — process network packets before they even reach the network stack (this is what powers fast firewalls)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traffic control (TC)&lt;/strong&gt; — packet processing on the egress side&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tracepoints and uprobes&lt;/strong&gt; — stable kernel hooks, plus hooking into userspace functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;eBPF maps&lt;/strong&gt; — shared state between kernel and userspace&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security &amp;amp; observability&lt;/strong&gt; — combining hooks to detect what's happening on a system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capstone&lt;/strong&gt; — a small agent that combines everything: it watches process executions and network events and reports them to userspace in real time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each chapter is a standalone Cargo project in the &lt;a href="https://github.com/amghazanfari/ebpf-beginner" rel="noopener noreferrer"&gt;repo&lt;/a&gt;, so you can &lt;code&gt;cargo build&lt;/code&gt; and try things as you read.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Rust + Aya?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One toolchain&lt;/strong&gt;: &lt;code&gt;cargo&lt;/code&gt; handles both sides of the program; no separate C build system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compile-time checks on kernel code&lt;/strong&gt;: the Rust compiler catches a lot before the verifier ever sees your program&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aya generates the bindings&lt;/strong&gt;: loading programs and reading maps is typed, safe Rust code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do still meet the verifier — and that's a feature. Learning to read verifier errors is half of learning eBPF, and the guide spends time on it instead of waving it away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;📖 Read the book online: &lt;strong&gt;&lt;a href="https://amghazanfari.github.io/ebpf-beginner/" rel="noopener noreferrer"&gt;https://amghazanfari.github.io/ebpf-beginner/&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;💻 Source code: &lt;strong&gt;&lt;a href="https://github.com/amghazanfari/ebpf-beginner" rel="noopener noreferrer"&gt;https://github.com/amghazanfari/ebpf-beginner&lt;/a&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you spot anything confusing or wrong, please open an issue — I'd genuinely like to keep improving it. And if you've been meaning to get into eBPF but kept bouncing off the C-heavy tutorials, I'd love to hear whether this gets you unstuck.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>linux</category>
      <category>tutorial</category>
      <category>systems</category>
    </item>
  </channel>
</rss>
