Skip to content

Commit 75d878c

Browse files
authored
Merge pull request #34 from OrderLab/dev
Basic documentation
2 parents 624c3ed + 7368294 commit 75d878c

28 files changed

+236
-57
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build ePass
2+
3+
on:
4+
push:
5+
branches: [ "main", "dev" ]
6+
7+
env:
8+
BUILD_TYPE: Release
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install Dependency
18+
run: sudo apt install -y libbpf-dev
19+
20+
- name: Configure CMake
21+
run: cd core && make configure
22+
23+
- name: Build
24+
run: cd core && make
25+

.gitmodules

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[submodule "third-party/ePass-xdp-tools"]
2+
path = third-party/ePass-xdp-tools
3+
url = git@github.com:OrderLab/ePass-xdp-tools.git
4+
[submodule "third-party/ePass-falcolib"]
5+
path = third-party/ePass-falcolib
6+
url = git@github.com:OrderLab/ePass-falcolib.git
7+
[submodule "ePass-kernel"]
8+
path = ePass-kernel
9+
url = git@github.com:OrderLab/ePass-kernel.git
10+
[submodule "third-party/ePass-libbpf"]
11+
path = third-party/ePass-libbpf
12+
url = git@github.com:OrderLab/ePass-libbpf.git
13+
[submodule "third-party/ePass-bpftool"]
14+
path = third-party/ePass-bpftool
15+
url = git@github.com:OrderLab/ePass-bpftool.git

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,68 @@
11
# ePass
2+
3+
[![Build ePass](https://github.com/OrderLab/ePass/actions/workflows/build.yml/badge.svg)](https://github.com/OrderLab/ePass/actions/workflows/build.yml)
4+
5+
ePass is an in-kernel LLVM-like compiler framework that introduces an SSA-based intermediate representation (IR) for eBPF programs. It provides a lifter that lifts eBPF bytecode to ePass IR, a pass runner that runs user-defined passes, and a code generator that compiles IR to eBPF bytecode. Users could write flexible passes using our LLVM-like APIs to analyze and manipulate the IR.
6+
ePass also provides an in-kernel supervisor that cooperates ePass core with the verifier to improve its flexibility (i.e. reduce false rejections) and safety (i.e. reduce false acceptance at runtime). It could also be used in userspace for testing.
7+
8+
## Key Features
9+
10+
- **IR-based compilation**: Converts BPF programs to an SSA-based intermediate representation for code rewriting
11+
- **Flexible passes**: ePass core provides various APIs to analyze and manipulate the IR, allowing users to write flexible passes including static analyzing, runtime checks, and optimization.
12+
- **Verifier aware**: ePass works with the existing verifier. The verifier is better for static verification while ePass focuses more on code rewriting and runtime verification.
13+
- **User-friendly debugging**: ePass supports compiling to both kernel and userspace for easier debugging.
14+
15+
> ⚠️ Warning: ePass is under active development and we are improving its usability and safety for production use. We welcome any suggestions and feedback. Feel free to open issues or [contact us](#contact-and-citation).
16+
17+
## Design Goals
18+
19+
- Flexible passes for diverse use cases
20+
- Working with existing verifier instead of replacing its
21+
- Keeping kernel safety
22+
- Support both userspace and kernel
23+
24+
## Prerequisites
25+
26+
- **clang >= 17**
27+
- **Ninja** (optional, for faster compilation)
28+
- **libbpf**
29+
30+
## Project Components
31+
32+
- `ePass core`: the core compiler framework, including a userspace CLI
33+
- `ePass kernel`: Linux kernel 6.5 with ePass core built-in, along with the kernel component and kernel passes
34+
- `ePass libbpf`: libbpf with ePass support for userspace ePass testing
35+
36+
There are some testing projects including `bpftool`, `xdp-tools`, `falcolib` in `third-party`. They depend on `ePass libbpf`.
37+
38+
### ePass Overview
39+
40+
![Overview](./docs/overview.png)
41+
42+
### ePass Core
43+
44+
![Core Architecture](./docs/core_design.png)
45+
46+
## Quick Start
47+
48+
There are two ways to use ePass. The first way is to build a linux kernel with ePass builtin, which is used for production. Users could specify ePass options when calling the `BPF` system call. See [Kernel Testing](docs/KERNEL_TESTING.md).
49+
50+
The second way is to build ePass in userspace and testing programs without changing the kernel, which is used mainly for testing. Users could specify ePass options via environment variable and use `ePass libbpf`. Programs will be modified in userspace before sending to the kernel. See [Userspace Testing](docs/USERSPACE_TESTING.md).
51+
52+
We recommend users trying ePass in userspace before switching to the ePass kernel version!
53+
54+
## Testing
55+
56+
See [Testing](./docs/TESTING.md).
57+
58+
## Development and Contribution
59+
60+
See [Development](./docs/CONTRIBUTION_GUIDE.md).
61+
62+
## Contact and Citation
63+
64+
Feel free to open an issue for question, bug report or feature request! You could also email <xiangyiming2002@gmail.com>.
65+
66+
## Acknowledgement
67+
68+
ePass is sponsored by [OrderLab](https://orderlab.io/) from University of Michigan.

core/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ configure:
2828
cmake -S . -B $(BUILD_DIR) -G Ninja; \
2929
fi
3030

31+
install: build
32+
sudo cmake --install $(BUILD_DIR)
33+
3134
buildobj:
3235
./scripts/buildobj.sh
3336

34-
.PHONY: build format kernel genctor test configure buildobj
37+
.PHONY: build format kernel genctor test configure buildobj install
3538
.DEFAULT_GOAL := build

core/Readme.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

core/TODO.md

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.

docs/CONTRIBUTION_GUIDE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contribution Guide
2+
3+
4+
## Project Structure
5+
6+
```
7+
ePass/
8+
├── core/ # Main compiler implementation
9+
│ ├── include/ # Header files
10+
│ ├── docs/ # Technical documentation
11+
│ ├── passes/ # Optimization passes
12+
│ ├── aux/ # Auxiliary utilities
13+
│ ├── epasstool/ # CLI tool
14+
│ └── tests/ # Simple BPF tests
15+
├── test/ # Integration tests and evaluation
16+
├── rejected/ # Collected rejected programs
17+
└── tools/ # Helper scripts and utilities
18+
```
19+
20+
## Common Development Patterns
21+
22+
### Iterating Through Instructions
23+
24+
```c
25+
struct ir_basic_block **pos;
26+
array_for(pos, fun->reachable_bbs)
27+
{
28+
struct ir_basic_block *bb = *pos;
29+
struct ir_insn *insn;
30+
list_for_each_entry(insn, &bb->ir_insn_head, list_ptr) {
31+
// Process instruction
32+
}
33+
}
34+
```

docs/CREATE_INSTRUCTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Create New Instruction
File renamed without changes.

0 commit comments

Comments
 (0)