如何使用 ebpf 终止进程?

发布于 2025-01-14 19:12:57 字数 113 浏览 1 评论 0原文

我想从 bpf 函数(execve)内部将 send_sig_info 发送到进程,但它不会加载。 我知道他们从内核 5.3 开始添加了一个辅助函数,但我正在开发较低的内核。 有没有办法从 bpf 函数终止进程?

I want to send_sig_info to a process from inside bpf function (execve) but it won't load.
I know that they added a helper function since kernel 5.3 but I'm working on a lower kernel.
Is there a way to kill a process from bpf function?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放低过去 2025-01-21 19:12:57

我相信您指的是 Linux v5.3 中引入的 bpf_send_signal 帮助程序。据我所知,在引入该助手之前,无法从 BPF 程序终止进程

如果您试图从 execve(2) 执行中终止当前进程,您可以改用 seccomp-bpf。请注意,由于 seccomp-bpf 依赖于 cBPF 而不是 eBPF,因此您将无法过滤参数(故意的,因为存在 TOCTTOU 攻击的风险)。

I believe you are referring to the bpf_send_signal helper, introduced in Linux v5.3. As far as I know, before that helper was introduced, there was no way to terminate a process from a BPF program.

If you are trying to kill the current process from it's execve(2) execution, you may be able to rely on seccomp-bpf instead. Note that, since seccomp-bpf relies on cBPF instead of eBPF, you won't be able to filter on the arguments (on purpose, because of the risk of TOCTTOU attacks).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文