Bug 16003 - patchelf issue causing qemu-img to segfault in ovmf recipe
Summary: patchelf issue causing qemu-img to segfault in ovmf recipe
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 0.0.0
Hardware: x86 Multiple
: High normal
Target Milestone: 5.3 M4
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-10-14 16:43 UTC by Richard Purdie
Modified: 2025-10-30 15:31 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Purdie 2025-10-14 16:43:51 UTC
https://autobuilder.yoctoproject.org/valkyrie/#/builders/37/builds/2714

This is a reproducibility build showing a segfault in the ovmf recipe in do_deploy.

It is enough to run the binary to see the segfault:

pokybuild@debian12-vk-3:~/yocto-worker/reproducible/build/build-st/reproducibleB-extended/tmp/sysroots-components/x86_64/qemu-system-native/usr/bin$ ./qemu-img 
Segmentation fault

Reproduction:

wget http://sstate.yoctoproject.org/all/universal/78/ea/sstate%3Aqemu-system-native%3Ax86_64-linux%3A10.1.1%3Ar0%3Ax86_64%3A14%3A78eaa8f4520be87b4afccd3eedea070dbedc5453219e96f16102bea454a964c8_populate_sysroot.tar.zst
zstd -d sstate\:qemu-system-native\:x86_64-linux\:10.1.1\:r0\:x86_64\:14\:78eaa8f4520be87b4afccd3eedea070dbedc5453219e96f16102bea454a964c8_populate_sysroot.tar.zst 
mv sstate\:qemu-system-native\:x86_64-linux\:10.1.1\:r0\:x86_64\:14\:78eaa8f4520be87b4afccd3eedea070dbedc5453219e96f16102bea454a964c8_populate_sysroot.tar sstate.tar
tar -xf sstate.tar
./recipe-sysroot-native/usr/bin/qemu-img 
qemu-img: Not enough arguments
Try './recipe-sysroot-native/usr/bin/qemu-img --help' for more information
$ ~/yocto-worker/reproducible/build/build-st/reproducibleB-extended/tmp/sysroots-uninative/x86_64-linux/usr/bin/patchelf-uninative --set-interpreter /home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB-extended/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 ./recipe-sysroot-native/usr/bin/qemu-img
pokybuild@debian12-vk-3:~/yocto-worker/reproducible/build/build-st/reproducibleB-extended/tmp/work/x86_64-linux/qemu-system-native/10.1.1/temp$ ./recipe-sysroot-native/usr/bin/qemu-img 
Segmentation fault

I was also able to reproduce this locally using my own local build.

So simply put:

Download the qemu sstate
Run patchelf-uninative from the uninative tarball on the binary to change the interpreter
It will segfault

Almost certainly due to a bug in patchelf.
Comment 1 Richard Purdie 2025-10-14 16:46:29 UTC
$ /media/build/poky/build/tmp/sysroots-uninative/x86_64-linux/usr/bin/patchelf-uninative --print-interpreter ./recipe-sysroot-native/usr/bin/qemu-img
/srv/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleA/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2

so the binary in sstate was produced by a reproducible build
Comment 2 Richard Purdie 2025-10-15 17:00:26 UTC
Upgrading patchelf appears to fix it. We need to merge the fix, then build and issue a new uninative.
Comment 3 Randy MacLeod 2025-10-16 14:50:55 UTC
We'll generate a new uninative for M4.
Comment 4 Michael Halstead 2025-10-16 22:31:29 UTC
Uninative 5.0rc1 is built and ready for testing. A patch is on the openembedded-core@lists.openembedded.org.
Comment 5 Richard Purdie 2025-10-30 15:31:31 UTC
This was merged and the issue is now hopefully resolved: https://git.yoctoproject.org/poky/commit/?id=cb478c6228f0654ded5ac19a8a8d2f8ba9a717af