rpmlint+readelf corrupted interpreter on generated binaries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

I found out that rpmlint errors out without producing any meaningful result when the analyzed RPMs contain binaries:

<mock-chroot> sh-5.2# strace -f -e trace=execve -s 65536 rpmlint build/RPMS/aerc-*.rpm
...
[pid   107] execve("/usr/bin/readelf", ["readelf", "-W", "-l", "/tmp/rpmlint.aerc-debuginfo-0.19.0-1.fc42.x86_64.rpm.5obt7_7n/usr/lib/debug/usr/bin/aerc-0.19.0-1.fc42.x86_64.debug", "--debug-dump=no-follow-links"], 0x7fe85e1a3590 /* 27 vars */) = 0
...
E: fatal error while reading aerc-debuginfo-0.19.0-1.fc42.x86_64.rpm: 'utf-8' codec can't decode byte 0xe4 in position 455: invalid continuation byte

Running rpmlint in an interactive python shell shows that it indeed outputs non UTF-8 stuff:

<mock-chroot> sh-5.2# python3
Python 3.13.1 (main, Dec  9 2024, 00:00:00) [GCC 14.2.1 20241104 (Red Hat 14.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> proc = subprocess.run(["readelf", "-W", "-l", "build/BUILD/aerc-0.19.0-build/BUILDROOT/usr/lib/debug/usr/bin/aerc-0.19.0-1.fc42.x86_64.debug"], capture_output=True)
>>> proc.stdout[400:500]
b'0x1\n      [Requesting program interpreter: ~e\x06K\x06$\x067\x04\x12\x06\x03\xe4\x01\x82\x06_\x06$\x06A\x06\x03\\e\x06U\x06]\n  LOAD           0x000000 0'
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The same interpreter info also makes it when running file $debuginfo:

<mock-chroot> sh-5.2# cd build/BUILD/aerc-0.19.0-build/BUILDROOT/
<mock-chroot> sh-5.2# file usr/lib/debug/usr/libexec/aerc/filters/* usr/lib/debug/usr/bin/*
usr/lib/debug/usr/libexec/aerc/filters/colorize-0.19.0-1.fc42.x86_64.debug: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter \003\024\005\012, BuildID[sha1]=93c4455be153c524f766741cbc80714a84516181, for GNU/Linux 3.2.0, with debug_info, not stripped
usr/lib/debug/usr/libexec/aerc/filters/wrap-0.19.0-1.fc42.x86_64.debug:     ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter ., BuildID[sha1]=45977cd4f36f77daf2ab473bbbe7bc5409fb14b8, for GNU/Linux 3.2.0, with debug_info, not stripped
usr/lib/debug/usr/bin/aerc-0.19.0-1.fc42.x86_64.debug:                      ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter ~e\006K\006$\0067\004\022\006\003\344\001\202\006_\006$\006A\006\003\e\006U, BuildID[sha1]=8977e2bd51567ca840be72431a1086147fb1e9f9, for GNU/Linux 3.2.0, with debug_info, not stripped

I originally suspected that it was related to %_lto_cflags, but disabling it does not fix the issue.

Relevant compilation commands:

gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -o wrap filters/wrap.c

gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  -o colorize filters/colorize.c

go build -buildmode pie -compiler gc -tags="rpm_crashtraceback notmuch" -a -v -x  -ldflags "-X main.Version=0.19.0 -X main.Date=2025-01-15 -X git.sr.ht/~rjarry/aerc/config.shareDir=/usr/share/aerc -X git.sr.ht/~rjarry/aerc/config.libexecDir=/usr/libexec/aerc -X git.sr.ht/~rjarry/aerc/version=0.19.0 -B 0xb45e09773c2af91095e6148bbe9fbdd10de9a756 -compressdwarf=false -linkmode=external -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '" -o aerc

Relevant package versions:

binutils-2.43.50-9.fc42.x86_64
file-5.45-8.fc42.x86_64
gcc-14.2.1-6.fc42.x86_64
rpmlint-2.5.0-10.fc42.x86_64

I suspect this is a bug in binutils/files which should not print binary code in lieu of the interpreter name. But maybe the culprit is in gcc.

If anyone has an idea, I'd like some help.

Cheers.

-- 
Robin

-- 
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux