Control: tags -1 unreproducible

On Mon, Jul 13, 2026 at 10:55:28AM +0300, Emre Uyguroğlu wrote:
> /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:

Sorry, but I can not reproduce this, please show a complete log, without
redactions.

| % cat foo.c 
| #include <linux/kernel.h>
| #include <linux/module.h>
| 
| static int __init foo_init(void)
| {
|         pr_info("foo initialised\n");
|         return 0;
| }
| module_init(foo_init);
| 
| static void __exit foo_exit(void)
| {
| }
| module_exit(foo_exit);
| 
| MODULE_LICENSE("GPL");
| MODULE_DESCRIPTION("");

| % cat Kbuild 
| obj-m += foo.o

| % make -C /lib/modules/7.1.3+deb14-amd64/build M=$(pwd) V=1
[…]
| # BTF [M] foo.ko
|   if [ ! -f /usr/src/linux-headers-7.1.3+deb14-amd64/vmlinux ]; then printf 
"Skipping BTF generation for %s due to unavailability of vmlinux
| " foo.ko 1>&2; else sh 
/usr/src/linux-headers-7.1.3+deb14-common/scripts/gen-btf.sh --btf_base 
/usr/src/linux-headers-7.1.3+deb14-amd64/vmlinux foo.ko; fi;
| + trap cleanup EXIT
| + BTFGEN_MODE=vmlinux
| + [ -n /usr/src/linux-headers-7.1.3+deb14-amd64/vmlinux ]
| + BTFGEN_MODE=module
| + gen_btf_data
| + btf1=foo.ko.BTF.1
| + pahole -J -j 
--btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
 --btf_features=attributes --btf_features=layout -j --lang_exclude=rust 
--btf_base /usr/src/linux-headers-7.1.3+deb14-amd64/vmlinux 
--btf_encode_detached=foo.ko.BTF.1 foo.ko
| + 
/usr/src/linux-headers-7.1.3+deb14-amd64/tools/bpf/resolve_btfids/resolve_btfids
 --distill_base --verbose --btf_base 
/usr/src/linux-headers-7.1.3+deb14-amd64/vmlinux --btf foo.ko.BTF.1 foo.ko
| Cannot find .BTF_ids or symbols sections, skip symbols resolution
| Dumped 8165 bytes of data to foo.ko.BTF
| Dumped 1626 bytes of data to foo.ko.BTF.base
| + embed_btf_data
| + x86_64-linux-gnu-objcopy --add-section .BTF=foo.ko.BTF foo.ko
| + btf_base=foo.ko.BTF.base
| + [ -f foo.ko.BTF.base ]
| + x86_64-linux-gnu-objcopy --add-section .BTF.base=foo.ko.BTF.base foo.ko
| + btf_ids=foo.ko.BTF_ids
| + [ -f foo.ko.BTF_ids ]
| + exit 0
| + cleanup
| + rm -f foo.ko.BTF.1
| + rm -f foo.ko.BTF
| + [ module = module ]
| + rm -f foo.ko.BTF.base
| + rm -f foo.ko.BTF_ids

As you see, it calls plain "pahole":
| + pahole -J -j […] foo.ko

And pahole is a real binary:
| % file $(command -v pahole)
| /usr/bin/pahole: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, 
BuildID[sha1]=da5fc94cd2e230bfc12d272357e681e8d4a505ad, for GNU/Linux 3.2.0, 
stripped

Bastian

-- 
A father doesn't destroy his children.
                -- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
                   stardate 3468.1.

Reply via email to