|
11 | 11 | * - handle_socket_recvmsg (LSM) |
12 | 12 | */ |
13 | 13 |
|
| 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 | + |
14 | 36 | /* ============================================================================ |
15 | 37 | * Network LSM Hooks |
16 | 38 | * ============================================================================ */ |
|
0 commit comments