RFC bpf: sign bpf programs
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: add signature to eBPF instructionsinclude/ kernel/ | +34 | 0 replies | |
| 2/2 | bpftool: add signature in skeletontools/ tools/ tools/ +4 more | +302 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC bpf-next 0/2] bpf: sign bpf programs
From: Matteo Croce <[email protected]>
Add a field in bpf_attr which contains a signature for the eBPF instructions. The signature is validated bpf_prog_load() in a similar way as kernel modules are checked in load_module().
This only works with CO-RE programs.
The signature is generated by bpftool and embedded into the light skeleton along with the instructions.
The bpftool crypto code is based on sign-file, supports the same interface, and is compiled only if libcrypto is available, to avoid potential breaks.
Possible improvements:
- Add a knob which makes the signature check mandatory, similarly to CONFIG_MODULE_SIG_FORCE
- Add a dedicate key_being_used_for type instead of using VERIFYING_MODULE_SIGNATURE, e.g. VERIFYING_BPF_SIGNATURE
This depends on the kernel side co-re relocation[1].
[1] https://lore.kernel.org/bpf/[email protected]/
Matteo Croce (2):
bpf: add signature to eBPF instructions
bpftool: add signature in skeleton
include/uapi/linux/bpf.h | 2 + kernel/bpf/syscall.c | 33 ++++- tools/bpf/bpftool/Makefile | 14 ++- tools/bpf/bpftool/gen.c | 33 +++++ tools/bpf/bpftool/main.c | 28 +++++ tools/bpf/bpftool/main.h | 7 ++ tools/bpf/bpftool/sign.c | 217 +++++++++++++++++++++++++++++++++ tools/include/uapi/linux/bpf.h | 2 + tools/lib/bpf/skel_internal.h | 4 + 9 files changed, 336 insertions(+), 4 deletions(-) create mode 100644 tools/bpf/bpftool/sign.c
Signature · 1 line
2.33.0