Procházet zdrojové kódy

btf: build pahole 1.31 from source for android12-5.10 BTF

Root cause of 'FAILED unresolved symbol xdp_buff' on the 5.10.43 sublevel is
pahole failing to recode the DWARF and DROPPING types (xdp_buff) from the
emitted BTF. Confirmed by Google/kernelci (lore.kernel.org, 'kernelci failures
due to pahole missing', 2022): hundreds of MB of 'namespace__recode_dwarf_types:
couldn't find ...' warnings, resolved by using a correct pahole/dwarves version.
apt pahole 1.25 on ubuntu-latest still cannot fully recode the 5.10.43 DWARF
(5.10.66+ is fine), and neither BTF_TYPE_EMIT (0003) nor ELF_T_WORD (0004) helps.

Build pahole v1.31 from source (matches a verified working host) and wrap the
hermetic-path pahole to exec it, keeping the enum64/decl_tag/type_tag skip flags.
Requires -DCMAKE_BUILD_TYPE=Release because the default Debug sets -Wall -Werror,
which the bundled libbpf/btf_encoder fail under newer GCC.
TheWildJames před 1 měsícem
rodič
revize
096bcb22a6
1 změnil soubory, kde provedl 25 přidání a 6 odebrání
  1. 25 6
      .github/actions/btf/action.yml

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

@@ -85,7 +85,7 @@ runs:
         grep -q '^ADDITIONAL_HOST_TOOLS=' build.config.gki.aarch64 || \
           echo 'ADDITIONAL_HOST_TOOLS="${ADDITIONAL_HOST_TOOLS} dd"' >> build.config.gki.aarch64
 
-    - name: Use apt pahole (>=1.23) for hermetic BTF generation (android12-5.10)
+    - name: Build and use pahole >=1.26 for hermetic BTF generation (android12-5.10)
       shell: bash
       working-directory: ${{ github.workspace }}/kernel
       if: ${{ inputs.version == 'android12-5.10' }}
@@ -94,10 +94,13 @@ runs:
         # android12-5.10 pins prebuilt pahole v1.19, which fails to recode the
         # 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). Replace the hermetic-path pahole
-        # (first dir on PATH, same dir dd lives in) with a WRAPPER that execs
-        # the apt binary.
+        # This is the exact failure Google/kernelci hit (see lore.kernel.org,
+        # "kernelci failures due to pahole missing", Apr-Sep 2022): pahole emits
+        # hundreds of MB of "namespace__recode_dwarf_types: couldn't find ..."
+        # warnings and silently drops types. Even Ubuntu's apt pahole 1.25 still
+        # cannot fully recode the 5.10.43 sublevel DWARF (5.10.66+ is fine).
+        # Build the latest pahole from source (1.31, matching a working host)
+        # and wrap the hermetic-path pahole to exec it.
         #
         # The wrapper also always injects --skip_encoding_btf_enum64 /
         # decl_tag / type_tag. Sublevels <=149 have no scripts/pahole-flags.sh
@@ -105,7 +108,23 @@ runs:
         # 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"
+        sudo apt-get install -y -qq cmake gcc libdw-dev libelf-dev zlib1g-dev dwarves
+
+        # Build pahole 1.31 from source (acmel/dwarves). Deterministic, self-hosted.
+        # Release build type is required: the default Debug sets -Wall -Werror, and
+        # the bundled libbpf/btf_encoder fail under newer GCC as -Werror.
+        PAHOLE_SRC="$HOME/dwarves"
+        rm -rf "$PAHOLE_SRC"
+        git clone --depth 1 --branch v1.31 https://github.com/acmel/dwarves.git "$PAHOLE_SRC"
+        mkdir -p "$PAHOLE_SRC/build"
+        cd "$PAHOLE_SRC/build"
+        cmake -D__LIB=lib -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release .. >/dev/null
+        make -j"$(nproc)" pahole
+        sudo make install pahole
+        command -v pahole
+        pahole --version
+
+        HERMETIC_PAHOLE="${{ github.workspace }}/kernel/build/build-tools/path/linux-x86/pahole"
         REAL_PAHOLE="$(command -v pahole)"
         if [ -L "$HERMETIC_PAHOLE" ] || [ -f "$HERMETIC_PAHOLE" ]; then
           cat > "$HERMETIC_PAHOLE" <<EOF