kernel: 6.6: prevent garbage-cleanup of BPF kfuncs
authorTony Ambardar <itugrok@yahoo.com>
Mon, 10 Jun 2024 09:17:40 +0000 (02:17 -0700)
committerChristian Marangi <ansuelsmth@gmail.com>
Thu, 13 Jun 2024 12:16:34 +0000 (14:16 +0200)
commitce51f27fb0f8461e61966e01dcd3a91201b5b382
treec355ddec24b858d053c976eeaab7f6335a47a590
parent546559587f52628fc1e644ee8891f904601a9044
kernel: 6.6: prevent garbage-cleanup of BPF kfuncs

Backport an upstream Linux fix to prevent BPF kfunc functions from being
removed during linker optimization when building BTF-enabled vmlinux.

The telltale sign of this occurring is build log warnings (e.g. mips64el):

      BTFIDS  vmlinux
    WARN: resolve_btfids: unresolved symbol bpf_verify_pkcs7_signature
    WARN: resolve_btfids: unresolved symbol bpf_lookup_user_key
    WARN: resolve_btfids: unresolved symbol bpf_lookup_system_key
    WARN: resolve_btfids: unresolved symbol bpf_key_put
    WARN: resolve_btfids: unresolved symbol bpf_iter_task_next
    WARN: resolve_btfids: unresolved symbol bpf_iter_css_task_new
    WARN: resolve_btfids: unresolved symbol bpf_get_file_xattr
    WARN: resolve_btfids: unresolved symbol bpf_ct_insert_entry
      NM      System.map
      SORTTAB vmlinux

Link: https://lore.kernel.org/bpf/ZlkoM6%2FPSxVcGM6X@kodidev-ubuntu/
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/15697
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/generic/backport-6.6/065-v6.10-compiler_types.h-Define-__retain.patch [new file with mode: 0644]
target/linux/generic/backport-6.6/066-v6.10-bpf-Harden-__bpf_kfunc-against-linker-removal.patch [new file with mode: 0644]