Skip to content

RFC Reintroduce Hornet LSM

Blaise Boscaccy bpf linux-doc linux-security-module lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11lsm: framework for BPF integrity verificationinclude/linux/lsm_hook_defs.h include/linux/security.h security/security.c+102 -30 replies
2/11oid_registry: allow arbitrary size OIDslib/build_OID_registry+18 -80 replies
3/11certs: break out pkcs7 check into its own functioncerts/system_keyring.c include/linux/verification.h+47 -310 replies
4/11crypto: pkcs7: add flag for validated trust on a signed info blockcrypto/asymmetric_keys/pkcs7_parser.h crypto/asymmetric_keys/pkcs7_trust.c+2 -02 replies
5/11crypto: pkcs7: allow pkcs7_digest() to be called from pkcs7_trustcrypto/asymmetric_keys/pkcs7_parser.h crypto/asymmetric_keys/pkcs7_trust.c crypto/asymmetric_keys/pkcs7_verify.c+20 -40 replies
6/11crypto: pkcs7: add ability to extract signed attributes by OIDcrypto/asymmetric_keys/Makefile crypto/asymmetric_keys/pkcs7_aa.asn1 crypto/asymmetric_keys/pkcs7_parser.c +1 more+112 -11 reply
7/11crypto: pkcs7: add tests for pkcs7_get_authattrcrypto/asymmetric_keys/pkcs7_key_type.c+41 -10 replies
8/11security: Hornet LSMDocumentation/admin-guide/LSM/Hornet.rst Documentation/admin-guide/LSM/index.rst MAINTAINERS +8 more+287 -17 replies
9/11hornet: Introduce gen_sigscripts/Makefile scripts/hornet/Makefile scripts/hornet/gen_sig.c +1 more+425 -00 replies
10/11hornet: Add a light skeleton data extractor scriptsscripts/hornet/extract-insn.sh scripts/hornet/extract-map.sh scripts/hornet/extract-skel.sh+81 -00 replies
11/11selftests/hornet: Add a selftest for the Hornet LSMtools/testing/selftests/Makefile tools/testing/selftests/hornet/Makefile tools/testing/selftests/hornet/loader.c +1 more+118 -00 replies

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by.

PatchDavid Howells
1/11
2/11
3/11
4/11
5/11
6/11
7/11A-b
8/11
9/11
10/11
11/11

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

Read the v1 thread

Cover letter [RFC 00/11] Reintroduce Hornet LSM

This patch series introduces the next iteration of the Hornet LSM. Hornet’s goal is to provide a secure and extensible in-kernel signature verification mechanism for eBPF programs. The purpose of this RFC is to gather feedback on the LSM design and the newly added downstream LSM hooks, as well as gauge community sentiment. The userspace tooling still needs some refinement. The currently accepted loader-plus-map signature verification scheme, mandated by Alexei and KP, is simple to implement and generally acceptable if users and administrators are satisfied with it. However, verifying both the loader and the maps offers additional benefits beyond verifying the loader alone:

1. Security and Audit Integrity

A key advantage is that the LSM hook for authorizing BPF program loads can operate after signature verification. This ensures:

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

2. TOCTOU Attack Prevention

The current map hash implementation may be vulnerable to a TOCTOU attack because it allows unfrozen maps to cache a previously calculated hash. The accepted “trusted loader” scheme cannot detect this and may permit loading altered maps.

This approach addresses concerns from users who require strict audit trails and verification guarantees, especially in security-sensitive environments. Map hashes for extended verification are passed via the existing PKCS#7 UAPI and verified by the crypto subsystem. Hornet then calculates the program’s verification state (full, partial, bad, etc.) and invokes a new downstream LSM hook to delegate policy decisions.

Blaise Boscaccy (4):
security: Hornet LSM
hornet: Introduce gen_sig
hornet: Add a light skeleton data extractor scripts selftests/hornet: Add a selftest for the Hornet LSM

James Bottomley (6):
oid_registry: allow arbitrary size OIDs
certs: break out pkcs7 check into its own function
crypto: pkcs7: add flag for validated trust on a signed info block
crypto: pkcs7: allow pkcs7_digest() to be called from pkcs7_trust
crypto: pkcs7: add ability to extract signed attributes by OID
crypto: pkcs7: add tests for pkcs7_get_authattr

Paul Moore (1):
lsm: framework for BPF integrity verification

 Documentation/admin-guide/LSM/Hornet.rst     |  38 ++
 Documentation/admin-guide/LSM/index.rst      |   1 +
 MAINTAINERS                                  |   9 +
 certs/system_keyring.c                       |  76 ++--
 crypto/asymmetric_keys/Makefile              |   4 +-
 crypto/asymmetric_keys/pkcs7_aa.asn1         |  18 +
 crypto/asymmetric_keys/pkcs7_key_type.c      |  42 +-
 crypto/asymmetric_keys/pkcs7_parser.c        |  87 ++++
 crypto/asymmetric_keys/pkcs7_parser.h        |   4 +
 crypto/asymmetric_keys/pkcs7_trust.c         |   9 +
 crypto/asymmetric_keys/pkcs7_verify.c        |  13 +-
 include/crypto/pkcs7.h                       |   4 +
 include/linux/lsm_hook_defs.h                |   5 +
 include/linux/oid_registry.h                 |   3 +
 include/linux/security.h                     |  25 ++
 include/linux/verification.h                 |   2 +
 include/uapi/linux/lsm.h                     |   1 +
 lib/build_OID_registry                       |  26 +-
 scripts/Makefile                             |   1 +
 scripts/hornet/Makefile                      |   5 +
 scripts/hornet/extract-insn.sh               |  27 ++
 scripts/hornet/extract-map.sh                |  27 ++
 scripts/hornet/extract-skel.sh               |  27 ++
 scripts/hornet/gen_sig.c                     | 392 +++++++++++++++++++
 scripts/hornet/write-sig.sh                  |  27 ++
 security/Kconfig                             |   3 +-
 security/Makefile                            |   1 +
 security/hornet/Kconfig                      |  11 +
 security/hornet/Makefile                     |   7 +
 security/hornet/hornet.asn1                  |  13 +
 security/hornet/hornet_lsm.c                 | 201 ++++++++++
 security/security.c                          |  75 +++-
 tools/testing/selftests/Makefile             |   1 +
 tools/testing/selftests/hornet/Makefile      |  63 +++
 tools/testing/selftests/hornet/loader.c      |  21 +
 tools/testing/selftests/hornet/trivial.bpf.c |  33 ++
 36 files changed, 1253 insertions(+), 49 deletions(-)
 create mode 100644 Documentation/admin-guide/LSM/Hornet.rst
 create mode 100644 crypto/asymmetric_keys/pkcs7_aa.asn1
 create mode 100644 scripts/hornet/Makefile
 create mode 100755 scripts/hornet/extract-insn.sh
 create mode 100755 scripts/hornet/extract-map.sh
 create mode 100755 scripts/hornet/extract-skel.sh
 create mode 100644 scripts/hornet/gen_sig.c
 create mode 100755 scripts/hornet/write-sig.sh
 create mode 100644 security/hornet/Kconfig
 create mode 100644 security/hornet/Makefile
 create mode 100644 security/hornet/hornet.asn1
 create mode 100644 security/hornet/hornet_lsm.c
 create mode 100644 tools/testing/selftests/hornet/Makefile
 create mode 100644 tools/testing/selftests/hornet/loader.c
 create mode 100644 tools/testing/selftests/hornet/trivial.bpf.c
Signature · 1 line
2.52.0