Преглед изворни кода

btf: wrap hermetic pahole to inject enum64/decl_tag/type_tag skips

Sublevels <=149 ship no scripts/pahole-flags.sh at all, so their
scripts/link-vmlinux.sh calls pahole -J with no skip flags. apt pahole 1.25
then emits newer BTF kinds (enum64/decl_tag/type_tag) that the old in-tree
libbpf in those sublevels (btf_type_size handles kinds 1-15 only) rejects,
aborting resolve_btfids with 'load BTF from vmlinux: Unknown error -22'
(EINVAL). Sublevels >149 inject --skip_encoding_btf_enum64 via
pahole-flags.sh (for pahole >=1.24) and have newer libbpf, hence they pass.

Replace the symlink repoint with a wrapper script at the hermetic-path pahole
that execs the apt binary and always injects the three skip flags. This is
sublevel-agnostic: old sublevels get the flags (which they lacked), new
sublevels get harmless duplicates of the enum64 flag they already pass.
TheWildJames пре 1 месец
родитељ
комит
4c25779a58
1 измењених фајлова са 19 додато и 6 уклоњено
  1. 19 6
      .github/actions/btf/action.yml

+ 19 - 6
.github/actions/btf/action.yml

@@ -56,15 +56,28 @@ runs:
         # DWARF types and DROPS symbols (e.g. xdp_buff) from the emitted BTF.
         # resolve_btfids then aborts with "FAILED unresolved symbol xdp_buff".
         # a13-5.10 ships prebuilt pahole v1.23 which works. The runner installs
-        # apt pahole 1.25 (/usr/bin/pahole). Repoint the hermetic-path symlink
-        # (first dir on PATH) to it. This is the same dir that dd lives in.
+        # apt pahole 1.25 (/usr/bin/pahole). Replace the hermetic-path pahole
+        # (first dir on PATH, same dir dd lives in) with a WRAPPER that execs
+        # the apt binary.
+        #
+        # The wrapper also always injects --skip_encoding_btf_enum64 /
+        # decl_tag / type_tag. Sublevels <=149 have no scripts/pahole-flags.sh
+        # at all, so their link-vmlinux.sh calls pahole with no skip flags; the
+        # old in-tree libbpf there only handles BTF kinds 1-15 and EINVALs on
+        # enum64/decl_tag/type_tag. Newer sublevels pass --skip_encoding_btf_enum64
+        # via pahole-flags.sh already; duplicate skip flags are harmless.
         HERMETIC_PAHOLE="build/build-tools/path/linux-x86/pahole"
-        if [ -L "$HERMETIC_PAHOLE" ]; then
-          ln -sf "$(command -v pahole)" "$HERMETIC_PAHOLE"
-          echo "Repointed $HERMETIC_PAHOLE -> $(readlink -f "$HERMETIC_PAHOLE")"
+        REAL_PAHOLE="$(command -v pahole)"
+        if [ -L "$HERMETIC_PAHOLE" ] || [ -f "$HERMETIC_PAHOLE" ]; then
+          cat > "$HERMETIC_PAHOLE" <<EOF
+        #!/bin/sh
+        exec "$REAL_PAHOLE" --skip_encoding_btf_enum64 --skip_encoding_btf_decl_tag --skip_encoding_btf_type_tag "\$@"
+        EOF
+          chmod +x "$HERMETIC_PAHOLE"
+          echo "Wrote wrapper $HERMETIC_PAHOLE -> $REAL_PAHOLE (skip enum64/decl_tag/type_tag)"
           "$HERMETIC_PAHOLE" --version
         else
-          echo "WARNING: $HERMETIC_PAHOLE not a symlink; leaving prebuilt pahole in place"
+          echo "WARNING: $HERMETIC_PAHOLE not found; leaving prebuilt pahole in place"
         fi
 
     - name: Enable BTF Config