Skip to content

Commit beb2aa4

Browse files
authored
Merge pull request #210 from ErenAri/feat/net-hook-dedup-v2
docs(bpf/net): document why the socket-hook deny tails are intentionally not de-duped
2 parents f3102ce + b164085 commit beb2aa4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

bpf/aegis_net.bpf.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@
1111
* - handle_socket_recvmsg (LSM)
1212
*/
1313

14+
/* ----------------------------------------------------------------------------
15+
* INTENTIONAL DUPLICATION — do not "de-dup" the per-hook deny tails.
16+
*
17+
* The six socket_* hooks below carry a near-identical address-parse + rule-match
18+
* + deny tail (reserve/fill/submit a net_block event, compute the enforce
19+
* signal). Centralizing that tail is tempting but REGRESSES kernel compat:
20+
* collapsing it into a single shared definition (whether an __always_inline
21+
* helper, as in reverted PR #207, or a function-like macro) changes the unified
22+
* tail's instruction layout enough that the 6.8 and 6.12 BPF verifiers reject
23+
* ALL six programs at load time (bpf_prog_load -EINVAL, func_info/line_info BTF
24+
* validation, no verifier-log output) — while 5.15/6.1/6.17 accept it. Verifier
25+
* acceptance is non-monotonic across versions; the hand-written per-hook tails
26+
* are the layout that loads everywhere. A real __noinline BPF-to-BPF subprogram
27+
* is not an option either (the emit helper needs 14 args > BPF's 5-register call
28+
* limit). Reproduced across three implementations on the cross-kernel bpfcompat
29+
* matrix; the de-dup buys only line count, with zero behavioral change.
30+
* See docs/KERNEL_COMPAT_MATRIX.md and the bpfcompat load-baseline gate
31+
* (tests/enforcement/bpfcompat_load_baseline.json). Keep the tails in sync BY
32+
* HAND when editing; the matrix gate catches a load regression pre-merge.
33+
* ----------------------------------------------------------------------------
34+
*/
35+
1436
/* ============================================================================
1537
* Network LSM Hooks
1638
* ============================================================================ */

0 commit comments

Comments
 (0)