TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Notes on BPF and eBPF

216 pointsby mlernerover 3 years ago

8 comments

daenzover 3 years ago
&gt;eBPF programs can’t access arbitrary kernel memory. Instead the kernel provides functions to get at some restricted subset of things.<p>I must finally becoming a security pessimist when I read those sentences and the first thing I think is: these statements will not age well.
评论 #29773914 未加载
评论 #29775132 未加载
评论 #29776085 未加载
评论 #29773845 未加载
评论 #29776738 未加载
评论 #29774108 未加载
kylequestover 3 years ago
Lots of good eBPF info from eBPF Summit: <a href="https:&#x2F;&#x2F;ebpf.io&#x2F;summit-2021&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ebpf.io&#x2F;summit-2021&#x2F;</a> and <a href="https:&#x2F;&#x2F;ebpf.io&#x2F;summit-2020&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ebpf.io&#x2F;summit-2020&#x2F;</a><p>Also videos from eBPF Day KubeCon 2021: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLj6h78yzYM2Pm5nF_GmNQHMyt9CUZr2uQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLj6h78yzYM2Pm5nF_GmNQ...</a>
halpertover 3 years ago
One cool project that uses eBPF is Cilium. It allows restricting network traffic to &#x2F; from containers in Kubernetes. Many of the problems it solves, in my opinion, are better solved via user-space solutions, e.g. service-to-service traffic is better controlled via signing &#x2F; encryption, but overall Cilium is a pretty cool piece of technology.
评论 #29776485 未加载
netsec_burnover 3 years ago
Many of the links under &quot;things you can attach eBPF programs to&quot; are broken, unfortunately.
pwnnaover 3 years ago
BPF is indeed a pretty interesting technology. As the knowledge about it becomes more widespread, I anticipate that we will unlock some new capabilities both in terms of tracing. Brendan Gregg&#x27;s book (<a href="https:&#x2F;&#x2F;www.brendangregg.com&#x2F;bpf-performance-tools-book.html" rel="nofollow">https:&#x2F;&#x2F;www.brendangregg.com&#x2F;bpf-performance-tools-book.html</a>) serves as a good intro to this, although you probably only need to read a small chunk of it as a lot of it is reference-book-style material.<p>The author&#x27;s mentioned that you can trace MySQL with USDT, which is a tracepoint inserted by the developer at select locations in the code. This kind of tracepoints form a &quot;stable interface&quot; for tracing&#x2F;performance debugging, whereas uprobe, which hooks into select userspace functions, are unstable as the binary is recompiled. Unfortunately, the USDT tracepoints (via DTrace) have been removed in MySQL 8.0. This makes it significantly more difficult to trace MySQL, although it&#x27;s not impossibl<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29772927e" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29772927e</a>. I&#x27;ve done a proof of concept of tracing MySQL with uprobe instead of USDT in this repo[1], which can kind of give you the same results (and possibly more stuff, as I can more easily read arbitrary memory address due to how the old USDT tracepoints are structured). This is not stable tho, as any MySQL upgrade may introduce incompatibility with the trace script, as I read memory address based on offsets (whereas with USDT this can be kept pretty stable). My appeal to Oracle to re-add this functionality[2] has unfortunately been rejected, which I think is a mistake given the wide range of possibilities unlocked via BPF.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;shuhaowu&#x2F;mysqld-bpf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;shuhaowu&#x2F;mysqld-bpf</a><p>[2]: <a href="https:&#x2F;&#x2F;bugs.mysql.com&#x2F;bug.php?id=105741" rel="nofollow">https:&#x2F;&#x2F;bugs.mysql.com&#x2F;bug.php?id=105741</a><p>Another thing that I&#x27;ve been recently thinking of is using BPF to validate programs written for real-time Linux (via PREEMPT_RT). To my understanding, one of the main thing to avoid is page faults [3]. With the proper BPF tracing scripts, I think we can validate that programs indeed avoids page faults in integration testing. I&#x27;m not sure if it is super useful yet, but as I&#x27;m trying to write a few RT programs, it&#x27;s something that came to my mind.<p>[3]: <a href="https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;837019&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lwn.net&#x2F;Articles&#x2F;837019&#x2F;</a><p>In addition to tracing (so bpftrace-based&#x2F;bcc-based tools), I&#x27;ve recently discovered that there there are:<p>1. ebpfsnitch (<a href="https:&#x2F;&#x2F;github.com&#x2F;harporoeder&#x2F;ebpfsnitch" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;harporoeder&#x2F;ebpfsnitch</a>): which is an application-level firewall without kernel modules.<p>2. ebpf-traffic-monitor (<a href="https:&#x2F;&#x2F;source.android.com&#x2F;devices&#x2F;tech&#x2F;datausage&#x2F;ebpf-traffic-monitor" rel="nofollow">https:&#x2F;&#x2F;source.android.com&#x2F;devices&#x2F;tech&#x2F;datausage&#x2F;ebpf-traff...</a>): which appears to be using BPF to account for traffic for different apps on Android.<p>3. kubectl trace (<a href="https:&#x2F;&#x2F;github.com&#x2F;iovisor&#x2F;kubectl-trace" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;iovisor&#x2F;kubectl-trace</a>): Run tracing on k8s.<p>There are apparently also use cases in the context of security, but I&#x27;m not familiar with it.
评论 #29775299 未加载
rammy1234over 3 years ago
Is PDF link broken in the blog ?
评论 #29774368 未加载
crtxcrover 3 years ago
&gt;things you can attach eBPF programs to<p>&gt;...<p>&gt;seccomp &#x2F; landlock security things<p>Landlock does not use *BPF.<p>Seccomp can only use BPF at this point, not eBPF (though there has been some work on it).
Warlockcraftover 3 years ago
I tried clicking on the link with these words: &quot;The BSD Packet Filter: A New Architecture for User-level Packet Capture&quot;. The link appears to be an unsecure website that my internet browser preevented me from going on.