Re: Broken 32-bit riscv debug build with ZSTD and FTRACE

From: Alexandre Ghiti
Date: Thu Jun 12 2025 - 08:47:07 EST


Hi Marco,

On 6/6/25 21:42, Marco Bonelli wrote:
I was able to also reproduce without ZSTD (i.e. both ZSTD_COMPRESS=n
and ZSTD_DECOMPRESS=n) like this:

export ARCH=riscv CROSS_COMPILE=riscv32-linux-
make distclean
make defconfig
make 32-bit.config
./scripts/config \
-e FTRACE \
-e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
-d RD_ZSTD \
-d SECURITY_APPARMOR_INTROSPECT_POLICY \
-d BTRFS_FS
make olddefconfig
make -j vmlinux

Did another bisect run between v6.14 and v6.15 with the above commands
in a bash script and got:

494e7fe591bf834d57c6607cdc26ab8873708aa7 Merge tag 'bpf_res_spin_lock' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

This leaves me more puzzled than before honestly. Not sure whether it is
a real bug or a problem on my end at this point? The fact that I can repro
in a Docker makes me think of the former, but the fact that I was able to
bisect it down to two different commits depending on ZSTD vs no ZSTD is
weird.

Alex (or anyone else really): are you able to reproduce with my Dockerfile
or config I provided in my last mail by any chance?

I'm able to reproduce your issue with your Dockerfile and locally too now using your last instructions, with the rv32 toolchain you provided and my regular rv64 toolchain (13.1.0).

So, that's weird, let's take the following failure:

ERROR: modpost: vmlinux: local symbol 'riscv_cached_mvendorid' was exported

When attaching with gdb, I get this:

Breakpoint 2, check_export_symbol (sym=0x7fffcfc5aca8, secname=0x7ffff7b7e3aa ".debug_str", faddr=72, elf=0x7fffffffdec0, mod=0x55555556b2a0) at ../scripts/mod/modpost.c:1087
1087            error("%s: local symbol '%s' was exported\n", mod->name,
1: mod->name = 0x55555556b334 "vmlinux"
2: label_name = 0x7fffdfcd965f "__export_symbol_riscv_cached_mvendorid"
(gdb) p/x sym->st_info
$1 = 0x0
(gdb) p/x *sym
$2 = {st_name = 0x321ded, st_value = 0x3d9111, st_size = 0x0, st_info = 0x0,
  st_other = 0x0, st_shndx = 0xb6}

where st_info == 0 == STB_LOCAL.

On a working rv64 build with the same configs, I get:

Breakpoint 1, check_export_symbol (sym=0x7fffc56d94a8, secname=0x7ffff7ae9e54 ".text", faddr=120, elf=0x7fffffffded0, mod=0x55555556b2a0) at ../scripts/mod/modpost.c:1085
1085        if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL &&
(gdb) p/x *sym
$1 = {st_name = 0xe6aa, st_info = 0x12, st_other = 0x0, st_shndx = 0x2,
  st_value = 0x11ba, st_size = 0x2c}

The difference is that the symbol is not in the same section.

I'm still looking into it, just wanted to let you know that I can reproduce and hoping someone who knows could jump in :)

Thanks,

Alex



--
Marco Bonelli