#bpf #jit #interpreter #filtering

bvm_filter

Virtual machine and JIT compiler for eBPF programs

2 releases (1 stable)

Uses old Rust 2015

1.0.0 Jun 24, 2019
0.0.0 Jun 24, 2019

#37 in #bpf

Apache-2.0/MIT and GPL-2.0 licenses

315KB
5K SLoC

Contains (ELF lib, 10KB) tests/elfs/multiple_file.so, (ELF exe/lib, 1KB) examples/load_elf__block_a_port.o, (ELF lib, 10KB) tests/elfs/empty_rodata.so, (ELF lib, 10KB) tests/elfs/noop.so, (ELF lib, 2KB) tests/elfs/noro.so, (ELF lib, 10KB) tests/elfs/pass_stack_reference.so and 3 more.

bvm_filter

Bitconch Virutl Machine, 用Rust编写的eBPF解释器(用户空间)。

BVM虚拟机

Description

此包含用于执行eBPF程序的虚拟机。 与_Berkeley Packet Filter_中一样,BPF是一种最初为BSD系统开发的类似汇编的语言,用于使用tcpdump等工具过滤内核中的数据包,以避免无用的副本到用户空间。 它后来移植到Linux,在那里它演变成eBPF(extended BPF)。 eBPF运行速度更快,功能更多。 虽然BPF程序最初打算在内核中运行,但此crate的虚拟机允许在用户空间应用程序中运行它;它包含一个解释器,一个用于eBPF程序的x86_64 JIT编译器,以及一个反汇编程序。

该软件基于Rich Lane的[uBPF软件](https://github.com/iovisor/ubpf/),的功能基本相同,但用C语言编写。

该软件包应该在Linux,MacOS X上编译和运行,并将在以后支持Windows。

这个包可以从[crates.io](https://crates.io/crates/bvm_filter)获得,所以它应该开箱即用,只需将它作为依赖项添加到你的Cargo.toml文件中。

[dependencies]
bvm_filter = "1.0.0"

您还可以使用此GitHub存储库中的开发版本。 这应该就像把它放在你的Cargo.toml中一样简单。

[dependencies]
bvm_filter = { git = "https://github.com/bitconch/bvm_filter" }

当然,如果您愿意,可以在本地克隆它,可能会破坏板条箱, 然后在Cargo.toml中指出本地版本的路径。

[dependencies]
bvm_filter = { path = "path/to/bvm_filter" }

然后在源代码中指出您要使用包:

extern crate bvm_filter;

Dependencies

~18–29MB
~340K SLoC