Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #93336

Bug#1141979: gen-btf.sh: quoting in PAHOLE awk wrapper breaks BTF step for all out-of-tree modules

From Emre Uyguroğlu <uyguremre@hotmail.com>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1141979: gen-btf.sh: quoting in PAHOLE awk wrapper breaks BTF step for all out-of-tree modules
Date 2026-07-13 10:00 +0200
Message-ID <NgjK1-4sg4-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Package: linux-kbuild-7.1.3+deb14
Version: 7.1.3-1
Tags: patch
X-Debbugs-Cc: uyguremre@hotmail.com, 1136776@bugs.debian.org

Dear Maintainer,

/usr/lib/linux-kbuild-7.1.3+deb14/scripts/gen-btf.sh invokes pahole
via plain variable expansion:

        ${PAHOLE} -J ${PAHOLE_FLAGS}                    \
                ${BTF_BASE:+--btf_base ${BTF_BASE}}     \
                --btf_encode_detached=${btf1}           \
                "${ELF_FILE}"

On Debian, PAHOLE is set to an awk wrapper command containing embedded
single quotes (it appends ",c++,c++11" to any --lang_exclude argument).
POSIX shell does not re-parse quoting inside expanded variables, so awk
receives the literal token 'BEGIN as part of its program text and
aborts:

  awk: cmd. line:1: 'BEGIN
  awk: cmd. line:1: ^ invalid char ''' in expression

The script's cleanup trap then removes the intermediate BTF files, and
the module link fails at Makefile.modfinal:62:

  make[4]: *** [.../scripts/Makefile.modfinal:62: <module>.ko] Error 1
  make[4]: *** Deleting file '<module>.ko'

This breaks the final link of every out-of-tree module built against
the 7.1.3 headers on systems where PAHOLE is the awk wrapper. I hit it
with the nvidia DKMS modules while working on #1136776, but the failure
is independent of any particular module: all module code had compiled
successfully and only the BTF post-processing step failed. The script
ships in linux-kbuild and is reached during DKMS builds via the
scripts/ symlink in linux-headers-7.1.3+deb14-common, so the failure
surfaces as a headers/module problem despite originating here — easy to
misattribute to the module being built.

The failure only manifests when BTF generation actually runs, i.e. when
a vmlinux is available for --btf_base; the script skips gracefully
otherwise, which may be why this has gone unnoticed.

The attached patch wraps the pahole invocation in eval so the shell
re-parses the embedded quoting. All inputs to the evaluated string
originate from the kernel build system, not from user-controlled data.
The resolve_btfids invocation is left untouched, as RESOLVE_BTFIDS is a
plain program path.

Tested on 7.1.3+deb14-amd64: with the fix applied, nvidia.ko,
nvidia-modeset.ko, nvidia-drm.ko, nvidia-uvm.ko and nvidia-peermem.ko
all link successfully with BTF sections generated, and the modules
load and run.

Regards,
Emre Uyguroğlu


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.12.17-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages linux-kbuild-7.1.3+deb14 depends on:
ii  libc6       2.42-17
ii  libelf1t64  0.195-1
ii  libssl3t64  3.6.3-1
ii  pahole      1.31-2
ii  zlib1g      1:1.3.dfsg+really1.3.2-3

linux-kbuild-7.1.3+deb14 recommends no packages.

linux-kbuild-7.1.3+deb14 suggests no packages.

-- no debconf information

Back to linux.debian.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Bug#1141979: gen-btf.sh: quoting in PAHOLE awk wrapper breaks BTF step for all out-of-tree modules Emre Uyguroğlu <uyguremre@hotmail.com> - 2026-07-13 10:00 +0200
  Bug#1141979: gen-btf.sh: quoting in PAHOLE awk wrapper breaks BTF step for all out-of-tree modules Bastian Blank <waldi@debian.org> - 2026-07-13 13:50 +0200
    Bug#1141979: gen-btf.sh: quoting in PAHOLE awk wrapper breaks BTF step for all out-of-tree modules Bastian Blank <waldi@debian.org> - 2026-07-13 15:40 +0200
  Processed: Re: Bug#1141979: gen-btf.sh: quoting in PAHOLE awk  wrapper breaks BTF step for all out-of-tree modules "Debian Bug Tracking System" <owner@bugs.debian.org> - 2026-07-13 13:50 +0200
  Bug#1141979: marked as done (gen-btf.sh: quoting in PAHOLE awk  wrapper breaks BTF step for all out-of-tree modules) "Debian Bug Tracking System" <owner@bugs.debian.org> - 2026-07-13 13:50 +0200

csiph-web