Re: [RFC 08/11] security: Hornet LSM

From
Blaise Boscaccy <hidden>
Date
2025-12-16 21:01:44
Also in
bpf, linux-doc, lkml
Reply to
Fan Wu, 2025-12-12
Fan Wu [off-list ref] writes:
On Wed, Dec 10, 2025 at 6:18 PM Blaise Boscaccy
[off-list ref] wrote:
quoted
This adds the Hornet Linux Security Module which provides enhanced
signature verification and data validation for eBPF programs. This
allows users to continue to maintain an invariant that all code
running inside of the kernel has actually been signed and verified, by
the kernel.

This effort builds upon the currently excepted upstream solution. It
further hardens it by providing deterministic, in-kernel checking of
map hashes to solidify auditing along with preventing TOCTOU attacks
against lskel map hashes.

Target map hashes are passed in via PKCS#7 signed attributes. Hornet
determines the extent which the eBFP program is signed and defers to
other LSMs for policy decisions.

Signed-off-by: Blaise Boscaccy <redacted>
---
...
quoted
+
+int hornet_next_map(void *context, size_t hdrlen,
+                    unsigned char tag,
+                    const void *value, size_t vlen)
+{
+       struct hornet_parse_context *ctx = (struct hornet_parse_context *)value;
I think you wanted to cast context instead?
quoted
+
+       ctx->hash_count++;
+       return 0;
+}
+
+
+int hornet_map_index(void *context, size_t hdrlen,
+                    unsigned char tag,
+                    const void *value, size_t vlen)
+{
+       struct hornet_parse_context *ctx = (struct hornet_parse_context *)value;
Same above.
quoted
+
+       ctx->hashes[ctx->hash_count] = *(int *)value;
+       return 0;
+}
+
+int hornet_map_hash(void *context, size_t hdrlen,
+                   unsigned char tag,
+                   const void *value, size_t vlen)
+
+{
+       struct hornet_parse_context *ctx = (struct hornet_parse_context *)value;
Same above.

-Fan
Thanks Fan. Will get that fixed up.

-blaise
quoted
+
+       if (vlen != SHA256_DIGEST_SIZE && vlen != 0)
+               return -EINVAL;
+
+       if (vlen != 0) {
+               ctx->skips[ctx->hash_count] = false;
+               memcpy(&ctx->hashes[ctx->hash_count * SHA256_DIGEST_SIZE], value, vlen);
+       } else
+               ctx->skips[ctx->hash_count] = true;
+
+       return 0;
+}
+
Thread (23 messages) 23 messages, 8 authors, last reply 2025-12-18
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help