lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <960240908.630790.1748641210849@privateemail.com>
Date: Fri, 30 May 2025 23:40:10 +0200 (CEST)
From: Marco Bonelli <marco@...eim.net>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "terrelln@...com" <terrelln@...com>,
	"rostedt@...dmis.org" <rostedt@...dmis.org>,
	"mhiramat@...nel.org" <mhiramat@...nel.org>,
	"mark.rutland@....com" <mark.rutland@....com>,
	"linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>,
	"paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
	"palmer@...belt.com" <palmer@...belt.com>,
	"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
	"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
Subject: Broken 32-bit riscv debug build with ZSTD and FTRACE

I am building v6.15 for 32-bit riscv and I have noticed that modpost fails with
a ton of errors and warnings (tens of thousands). I am on a Debian 12 x86-64
host using the riscv32-linux-gcc from mirrors.edge.kernel.org [1]. I can
reproduce with different GCC versions (I tested with 10.1.0, 14.2.0, 15.1.0).
For whatever reason though, only when targeting riscv 32-bit.

Steps to reproduce:

    export ARCH=riscv CROSS_COMPILE=riscv32-linux-
    make distclean
    make defconfig
    make 32-bit.config
    ./scripts/config \
        -e DEBUG_KERNEL \
        -e DEBUG_INFO \
        -e DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT \
        -d DEBUG_INFO_NONE \
        -d DEBUG_INFO_REDUCED
    make olddefconfig
    make -j vmlinux

Build output:

    ...
    MODPOST vmlinux.symvers
    WARNING: modpost: vmlinux: section mismatch in reference: tcp_write_timer_handler+0xa4 (section: .text) -> register_kernel_offset_dumper (section: .init.text)
    ...
    ERROR: modpost: vmlinux: local symbol 'find_get_pid' was exported
    ...
    ERROR: modpost: __ex_table+0x17e8 references non-executable section '.debug_str'
    ...
    make[2]: *** [scripts/Makefile.modpost:147: vmlinux.symvers] Error 1
    make[1]: *** [/mnt/m2data/linux/Makefile:1958: modpost] Error 2
    make: *** [Makefile:248: __sub-make] Error 2

There are thousands of warnings/errors like the three above, complaining
about "section mismatch in reference", "local symbol xxx was exported" and
"references non-executable section".

I did a bisect run on torvalds/linux and narrowed it down to:

    e61f33273ca755b3e2ebee4520a76097199dc7a8 Merge tag 'zstd-linus-v6.15-rc1' of https://github.com/terrelln/linux

I was also able to reproduce on next/linux-next tag next-20250530. 
Looking at the merge from github.com/terrelln/linux it seems to be a single
commit [2].

Through trial and error I noticed that the build only seems to fail when
*all* the following conditions are met:

1. Building for 32-bit riscv (ARCH=riscv + defconfig + 32-bit.config)
2. FTRACE=y
3. ZSTD_COMPRESS=y
4. Debug info enabled

With ZSTD_COMPRESS=m (selecting SECURITY_APPARMOR_EXPORT_BINARY=n) or
ZSTD_COMPRESS=n (selecting also BTRFS_FS=n), modpost goes through fine.
With FTRACE=n or disabling debug info modpost also goes through fine.

So it seems to be a combination of factors, but I am unsure how exactly
these things can interact/interfere with each other. Any clue?

Full bisect run log:

    # bad: [0ff41df1cb268fc69e703a08a57ee14ae967d0ca] Linux 6.15
    # good: [38fec10eb60d687e30c8c6b5420d86e8149f7557] Linux 6.14
    git bisect start 'v6.15' 'v6.14'
    # bad: [390513642ee6763c7ada07f0a1470474986e6c1c] io_uring: always do atomic put from iowq
    git bisect bad 390513642ee6763c7ada07f0a1470474986e6c1c
    # good: [9b960d8cd6f712cb2c03e2bdd4d5ca058238037f] Merge tag 'for-6.15/block-20250322' of git://git.kernel.dk/linux
    git bisect good 9b960d8cd6f712cb2c03e2bdd4d5ca058238037f
    # good: [023b1e9d265ca0662111a9df23d22b4632717a8a] Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
    git bisect good 023b1e9d265ca0662111a9df23d22b4632717a8a
    # bad: [3a90a72aca0a98125f0c7350ffb7cc63665f8047] Merge tag 'asm-generic-6.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
    git bisect bad 3a90a72aca0a98125f0c7350ffb7cc63665f8047
    # good: [3ef47a0436219359a0838d74bb353caa6aad3fc0] Merge tag 'at91-dt-6.15' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into soc/dt
    git bisect good 3ef47a0436219359a0838d74bb353caa6aad3fc0
    # bad: [1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95] Merge tag 'net-next-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
    git bisect bad 1a9239bb4253f9076b5b4b2a1a4e8d7defd77a95
    # good: [ffd6c179286daf31ea0d6413228bbc2a3c7ee1de] Merge patch series "scsi: ufs: renesas: Add support for R-Car S4-8 ES1.2"
    git bisect good ffd6c179286daf31ea0d6413228bbc2a3c7ee1de
    # good: [22df63a23a9e53d06ff2c67f863e9ce1640b73cb] Merge branches 'apple/dart', 'arm/smmu/updates', 'arm/smmu/bindings', 'rockchip', 's390', 'core', 'intel/vt-d' and 'amd/amd-vi' into next
    git bisect good 22df63a23a9e53d06ff2c67f863e9ce1640b73cb
    # good: [29fa7d7934216e0a93102a930ef28e2a6ae852b1] selftests/sysctl: fix wording of help messages
    git bisect good 29fa7d7934216e0a93102a930ef28e2a6ae852b1
    # good: [22093997ac9220d3c606313efbf4ce564962d095] Merge tag 'ata-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
    git bisect good 22093997ac9220d3c606313efbf4ce564962d095
    # good: [a018d1cf990d0c339fe0e29b762ea5dc10567d67] scsi: st: Fix array overflow in st_setup()
    git bisect good a018d1cf990d0c339fe0e29b762ea5dc10567d67
    # good: [336b4dae6dfecc9aa53a3a68c71b9c1c1d466388] Merge tag 'iommu-updates-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
    git bisect good 336b4dae6dfecc9aa53a3a68c71b9c1c1d466388
    # good: [65d1f5507ed2c78c64fce40e44e5574a9419eb09] zstd: Import upstream v1.5.7
    git bisect good 65d1f5507ed2c78c64fce40e44e5574a9419eb09
    # bad: [e61f33273ca755b3e2ebee4520a76097199dc7a8] Merge tag 'zstd-linus-v6.15-rc1' of https://github.com/terrelln/linux
    git bisect bad e61f33273ca755b3e2ebee4520a76097199dc7a8
    # good: [592329e5e94e26080f4815c6cc6cd0f487a91064] Merge tag 'sysctl-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl
    git bisect good 592329e5e94e26080f4815c6cc6cd0f487a91064
    # first bad commit: [e61f33273ca755b3e2ebee4520a76097199dc7a8] Merge tag 'zstd-linus-v6.15-rc1' of https://github.com/terrelln/linux

[1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/14.2.0/
[2]: https://github.com/terrelln/linux/commit/65d1f5507ed2c78c64fce40e44e5574a9419eb09

--
Marco Bonelli

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ