TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Unit Testing eBPF Programs

114 点作者 ldelossa将近 2 年前

6 条评论

tyoma将近 2 年前
This past summer one of the Trail of Bits interns worked on a project to test BPF programs from userspace, independent of kernel version: <a href="https:&#x2F;&#x2F;blog.trailofbits.com&#x2F;2023&#x2F;01&#x2F;19&#x2F;ebpf-verifier-harness&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.trailofbits.com&#x2F;2023&#x2F;01&#x2F;19&#x2F;ebpf-verifier-harnes...</a><p>It is still very much a proof of concept but could be a starting point to make future BPF testing easier.
eyakubovich将近 2 年前
In my experience, the hardest part of developing with eBPF is dealing with the multiple kernel versions and configurations that the target machines may have. It&#x27;s a challenge not only because eBPF features were added gradually but because the internal data structures are not stable. While CO-RE finally makes it possible to be offset agnostic and allows for dealing with things like missing struct members, it&#x27;s still very much a game of finding out when the code is deployed in the wild. Unit testing is important but I long for a way to easily test across a large matrix of kernel versions&#x2F;configs (here at EdgeBit, we would be happy to pay for such a service).
danobi将近 2 年前
BPF_PROG_RUN is great but unfortunately depends on the running kernel version. To that end, I wrote `vmtest` (<a href="https:&#x2F;&#x2F;dxuuu.xyz&#x2F;vmtest.html" rel="nofollow">https:&#x2F;&#x2F;dxuuu.xyz&#x2F;vmtest.html</a>) which is designed for the BPF_PROG_RUN use case.
评论 #35991957 未加载
alexeldeib将近 2 年前
Beyond the content, kudos to the author for crisply and clearly laying out the intent of the article and prerequisites, referring to prior art for larger questions. Really enjoy the style.
ranting-moth将近 2 年前
Pardon my ignorance, is clang needed to build eBPF programs like it says in the article?
评论 #35992534 未加载
评论 #35990754 未加载
hugatest将近 2 年前
If your unit test needs root privileges, then it&#x27;s not really a unit test in all but very few exceptional cases. It means you are interacting with the actually running kernel, which means you are integration testing, not unit testing.
评论 #35996791 未加载