Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916259 - www-client/firefox-119.0: segfault if built with ld.mold
Summary: www-client/firefox-119.0: segfault if built with ld.mold
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-mold
  Show dependency tree
 
Reported: 2023-10-25 08:53 UTC by Michelangelo Scopelliti
Modified: 2023-10-28 04:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.xz,3.39 KB, application/x-xz)
2023-10-25 08:53 UTC, Michelangelo Scopelliti
Details
backtrace: firefox-119.0 + mold-2.3.1 (f-119+m-2.3.1.txt,2.68 KB, text/plain)
2023-10-25 14:27 UTC, Michelangelo Scopelliti
Details
backtrace: firefox-119.0 + mold-2.2.0 (f-119+m-2.2.0.txt,2.37 KB, text/plain)
2023-10-25 14:28 UTC, Michelangelo Scopelliti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo Scopelliti 2023-10-25 08:53:39 UTC
Created attachment 873423 [details]
emerge --info

When built wit mold linker (LDFLAGS="-fuse-ld=mold -Wl,-O2 -Wl,--as-needed"), firefox 119.0 build fine, but when executed it fails at start, from dmesg:

firefox[30782]: segfault at 7f317aab0000 ip 00007f317aab0000 sp 00007ffc4ba76628 error 15 in libmozsqlite3.so[7f317aab0000+2f000] likely on CPU 5 (core 5, socket 0)

This happens both on an Intel and on an AMD systems. Results of emerge --info are attached; firefox runs fine if '-fule-ld=mold' is removed from LDFLAGS.

emerge -pqv firefox

[ebuild   R   ] www-client/firefox-119.0  USE="X clang dbus gmp-autoupdate hwaccel jumbo-build libproxy lto openh264 pulseaudio system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-webp -debug -eme-free -geckodriver -hardened -jack -pgo -screencast (-selinux) -sndio -system-png (-system-python-libs) -telemetry (-valgrind) -wayland -wifi" L10N="it -ach -af -an -ar -ast -az -be -bg -bn -br -bs -ca -ca-valencia -cak -cs -cy -da -de -dsb -el -en-CA -en-GB -eo -es-AR -es-CL -es-ES -es-MX -et -eu -fa -ff -fi -fr -fur -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -ia -id -is -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mk -mr -ms -my -nb -ne -nl -nn -oc -pa -pl -pt-BR -pt-PT -rm -ro -ru -sc -sco -si -sk -sl -son -sq -sr -sv -szl -ta -te -th -tl -tr -trs -uk -ur -uz -vi -xh -zh-CN -zh-TW"
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-25 08:57:10 UTC
Please grab a backtrace using gdb (https://wiki.gentoo.org/wiki/Debugging#Per-package).

It would also be helpful if you could try older mold versions.
Comment 2 Michelangelo Scopelliti 2023-10-25 14:27:42 UTC
Created attachment 873432 [details]
backtrace: firefox-119.0 + mold-2.3.1
Comment 3 Michelangelo Scopelliti 2023-10-25 14:28:16 UTC
Created attachment 873433 [details]
backtrace: firefox-119.0 + mold-2.2.0
Comment 4 Michelangelo Scopelliti 2023-10-25 14:31:49 UTC
I hope the backtraces are OK, I'm not really a gdb user. I've followed the instructions from the link; gdb was used with the sequence "r", segfault, "bt" and then "q".

The segfault, in dmesg, is error 15 in libmozsqlite3.so for both builds.
Comment 5 Joonas Niilola gentoo-dev 2023-10-25 17:21:30 UTC
It's probably related to the new elf-hack. Mold may not be able to do it. Should probably be reported upstream as mold and --enable-elf-hack=relr being broken together.

for now the ebuild should be patched to --disable-elf-hack if mold is detected.
Comment 6 Larry the Git Cow gentoo-dev 2023-10-27 09:12:46 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb1bf7319d22a2a4fb9c7c300f092154922f98b9

commit cb1bf7319d22a2a4fb9c7c300f092154922f98b9
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2023-10-27 09:10:33 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-10-27 09:12:43 +0000

    www-client/firefox: disable elf-hack again with mold linker (119.0)
    
     - the new relr-elfhack doesn't work with mold.
    
    Closes: https://bugs.gentoo.org/916259
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/firefox-119.0.ebuild | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
Comment 7 Joonas Niilola gentoo-dev 2023-10-27 12:46:24 UTC
I think someone should regardless report this to mold upstream, as lld works fine.