1 Star 0 Fork 1

chengang / ebpf-kill-example

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.62 KB
一键复制 编辑 原始数据 按行查看 历史

ebpf-kill-example

ebpf-kill-example is an example of an eBPF program hooking into the kill tracepoint. This project is a Proof-of-Concept (PoC) showing the feasibility and viability of eBPF. Furthermore, the project shows how to create and run a simple eBPF program.

Minimum requirements

To run this example, the following software is required.

  • Linux kernel v4.19+
  • LLVM 10+
  • libelf-dev (Installed via make deps)
  • gcc-multilib (Installed via make deps)

Installation

To install ebpf-kill-example, first clone this repository.

git clone https://github.com/niclashedam/ebpf-kill-example

Install dependencies needed to compile ebpf-kill-example.

make deps

Compile ebpf-kill-example.

make

Usage

Run ebpf-kill-example. Super user privileges are required to load the program into the kernel.

sudo ./src/ebpf-kill-example

Test

To test ebpf-kill-example, run make test. This will load the eBPF program, start a looping process and kill it. It will verify that the eBPF program was invoked when kill was called.

nhed@nhed-1:~/Development/ebpf-kill-example$ make test
./test/test.sh
-- Loading eBPF program.
-- Starting test process to kill.
-- PID of test process is 332996.
-- Killed. Waiting for eBPF program to terminate ..
[ OK ] -- eBPF program ran as expected.

Example

Example

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GPLv3

1
https://gitee.com/eric_cg/ebpf-kill-example.git
git@gitee.com:eric_cg/ebpf-kill-example.git
eric_cg
ebpf-kill-example
ebpf-kill-example
master

搜索帮助