Skip to content

BPF signature hash chains

Blaise Boscaccy bpf linux-security-module 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 30 repliesIn review
  2. v12 patches 2 repliesSuperseded

v2 -> v1 from the cover letter

- Fix regression found by syzkaller
- Add bash auto-complete support for new command line switch

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpf: Add hash chain signature support for arbitrary mapsinclude/uapi/linux/bpf.h kernel/bpf/syscall.c tools/include/uapi/linux/bpf.h+81 -40 replies
2/3selftests/bpf: Enable map verification for some lskel teststools/testing/selftests/bpf/Makefile+16 -20 replies
3/3bpftool: Add support for signing program and map hash chainstools/bpf/bpftool/Documentation/bpftool-gen.rst tools/bpf/bpftool/bash-completion/bpftool tools/bpf/bpftool/gen.c +5 more+62 -90 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

Patch[email protected]
1/3T-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/3] BPF signature hash chains

This patchset extends the currently proposed signature verification patchset
https://lore.kernel.org/linux-security-module/[email protected]/
with hash-chain functionality to verify the contents of arbitrary maps.

The currently proposed loader + map signature verification scheme—requested by Alexei and KP—is simple to implement and acceptable if users/admins are satisfied with it. However, verifying both the loader and the maps offers additional benefits beyond just verifying the loader:

1. Simplified Loader Logic: The lskel loader becomes simpler since it doesn’t need to verify program maps—this is already handled by bpf_check_signature().

2. Security and Audit Integrity: A key advantage is that the LSM (Linux Security Module) hook for authorizing BPF program loads can operate after signature verification. This ensures:

* Access control decisions can be based on verified signature
* status. Accurate system state measurement and logging. Log
* events claiming a verified signature are fully truthful, avoiding
* misleading entries that only the loader was verified while the
* actual BPF program verification happens later without logging.

This approach addresses concerns from users who require strict audit trails and verification guarantees, especially in security-sensitive environments.

A working tree with this patchset is being maintained at
https://github.com/blaiseboscaccy/linux/tree/bpf-hash-chains

bpf CI tests passed as well
https://github.com/kernel-patches/bpf/actions/runs/18110352925

v2 -> v1:
- Fix regression found by syzkaller
- Add bash auto-complete support for new command line switch

Blaise Boscaccy (3):
bpf: Add hash chain signature support for arbitrary maps selftests/bpf: Enable map verification for some lskel tests
bpftool: Add support for signing program and map hash chains

 include/uapi/linux/bpf.h                      |  6 ++
 kernel/bpf/syscall.c                          | 73 ++++++++++++++++++-
 .../bpf/bpftool/Documentation/bpftool-gen.rst |  7 +-
 tools/bpf/bpftool/bash-completion/bpftool     |  2 +-
 tools/bpf/bpftool/gen.c                       | 27 ++++++-
 tools/bpf/bpftool/main.c                      |  9 ++-
 tools/bpf/bpftool/main.h                      |  1 +
 tools/bpf/bpftool/sign.c                      | 16 +++-
 tools/include/uapi/linux/bpf.h                |  6 ++
 tools/lib/bpf/libbpf.h                        |  3 +-
 tools/lib/bpf/skel_internal.h                 |  6 +-
 tools/testing/selftests/bpf/Makefile          | 18 ++++-
 12 files changed, 159 insertions(+), 15 deletions(-)
Signature · 1 line
2.48.1