You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-26Lines changed: 39 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,15 @@ KernelScript aims to become the programming language for Linux kernel customizat
17
17
18
18
Writing eBPF programs today is challenging and error-prone:
19
19
20
-
-**Raw C + libbpf**: Requires deep eBPF knowledge, verbose boilerplate, manual memory management, and complex build systems
21
-
-**Kernel development complexity**: Understanding verifier constraints, BPF helper functions, and kernel APIs
20
+
-**Raw C + libbpf**: Requires deep eBPF knowledge, extensive boilerplate code for multiple program types
21
+
-**Kernel development complexity**: Understanding eBPF verifier constraints, BPF helper functions, and kernel context
22
+
-**Kernel version compatibility**: Managing different kernel APIs, struct layouts, and available kfuncs across kernel versions
22
23
-**Complex tail call management**: Manual program array setup, explicit `bpf_tail_call()` invocation, and error handling for failed tail calls
23
24
-**Intricate dynptr APIs**: Manual management of `bpf_ringbuf_reserve_dynptr()`, `bpf_dynptr_data()`, `bpf_dynptr_write()`, and proper cleanup sequences
24
25
-**Complex struct_ops implementation**: Manual function pointer setup, intricate BTF type registration, kernel interface compliance, and lifecycle management
25
26
-**Complex kfunc implementation**: Manual kernel module creation, BTF symbol registration, export management, and module loading coordination
26
-
-**Userspace coordination**: Manually writing loaders, map management, and program lifecycle code
27
-
-**Multi-program systems**: No coordination between related eBPF programs sharing resources
27
+
-**Userspace coordination**: Manually writing loaders, map management, and program lifecycle management of different kinds
28
+
-**Multiple programming paradigms**: Developers must master userspace application development, eBPF kernel programming, and kernel module (kfunc) programming
28
29
29
30
### Why Not Existing Tools?
30
31
@@ -51,23 +52,40 @@ Writing eBPF programs today is challenging and error-prone:
51
52
52
53
KernelScript addresses these problems through revolutionary language features:
53
54
54
-
✅ **Single-file multi-target compilation** - Write userspace, eBPF, and kernel module code in one file. The compiler automatically targets each function correctly based on attributes (`@xdp`, `@helper`, regular functions)
55
+
✅ **Single-file multi-target compilation** - Write userspace, eBPF, and kernel module code in one file. The compiler automatically targets each function correctly based on attributes (`@xdp`, `@helper`, `@kfunc`, and regular userspace functions)
55
56
56
57
✅ **Automatic tail call orchestration** - Simply write `return other_xdp_func(ctx)` and the compiler handles program arrays, `bpf_tail_call()` generation, and error handling automatically
57
58
58
-
✅ **Transparent dynptr integration** - Use simple pointer operations (`event_log.reserve()`, `buffer[index]`) while the compiler automatically uses complex dynptr APIs (`bpf_ringbuf_reserve_dynptr`, `bpf_dynptr_write`) behind the scenes
59
+
✅ **Transparent dynptr integration** - Use simple pointer operations (`ringbuffer.reserve()`, `some_map[key]`) while the compiler automatically uses complex dynptr APIs (`bpf_ringbuf_reserve_dynptr`, `bpf_dynptr_write`) behind the scenes
59
60
60
61
✅ **First-class program lifecycle safety** - Programs are typed values with compile-time guarantees that prevent calling `attach()` before `load()` succeeds
61
62
62
-
✅ **Zero-boilerplate shared state** - Global maps and config blocks are automatically accessible across all programs without imports, exports, or coordination code
63
+
✅ **Zero-boilerplate shared state** - Maps are automatically accessible across all programs as regular global variables in a programming language
63
64
64
-
✅ **Custom kernel functions (@kfunc)** - Write full-privilege kernel functions that eBPF programs can call, automatically generating kernel modules and BTF registrations
65
+
✅ **Builtin kfunc support** - Define full-privilege kernel functions that eBPF programs can call directly, automatically generating kernel modules and BTF registrations
65
66
66
67
✅ **Unified error handling** - C-style integer throw/catch works seamlessly in both eBPF and userspace contexts, unlike complex Result types
67
68
68
69
✅ **Verifier-optimized type system** - Fixed-size arrays (`u8[64]`), simple type aliases, and no complex generics that confuse the eBPF verifier
69
70
70
-
✅ **Complete automated toolchain** - Generate ready-to-use projects with Makefiles, userspace loaders, and build systems from a single source file
71
+
✅ **Complete automated toolchain** - Generate ready-to-use projects with Makefiles, userspace loaders, kernel modules (if kfunc is defined) and build systems from a single source file
72
+
73
+
✅ **Automatic BTF extraction** - Seamlessly extract available kfuncs and kernel struct definitions from specified BTF files during project initialization
74
+
75
+
76
+
### Why Choose KernelScript?
77
+
78
+
| Feature | Raw C + libbpf | Rust eBPF | bpftrace |**KernelScript**|
|**Program Types**| All | Most | Tracing only | All |
87
+
88
+
KernelScript combines the power of low-level eBPF programming with the productivity of modern programming languages, making eBPF development accessible to a broader audience while maintaining the performance and flexibility that makes eBPF powerful.
71
89
72
90
## Language Overview
73
91
@@ -79,6 +97,8 @@ KernelScript supports all major eBPF program types with typed contexts:
|**Program Types**| All | Most | Tracing only | All |
391
-
392
-
KernelScript combines the power of low-level eBPF programming with the productivity of modern programming languages, making eBPF development accessible to a broader audience while maintaining the performance and flexibility that makes eBPF powerful.
0 commit comments