Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 677052 - =www-client/firefox-65.0 USE="lto pgo" - Program received signal SIGILL, Illegal instruction. 0x00007fffea258669 in ?? () from /usr/lib64/firefox/libxul.so
Summary: =www-client/firefox-65.0 USE="lto pgo" - Program received signal SIGILL, Ille...
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:
 
Reported: 2019-02-01 14:52 UTC by Alexander
Modified: 2019-05-22 04:48 UTC (History)
7 users (show)

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


Attachments
emerge --info (emerge--info.txt,8.02 KB, text/plain)
2019-02-01 14:52 UTC, Alexander
Details
Run in GDB (file_677052.txt,262 bytes, text/plain)
2019-02-01 14:55 UTC, Alexander
Details
Strace (strace_firefox.txt,117.73 KB, text/plain)
2019-02-01 14:58 UTC, Alexander
Details
Firefox build settings (file_677052.txt,1.01 KB, text/plain)
2019-02-01 15:00 UTC, Alexander
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander 2019-02-01 14:52:51 UTC
Created attachment 563424 [details]
emerge --info

After build Firefox 65 with flags pgo and lto, FF crash with error "invalid instruction".
Comment 1 Alexander 2019-02-01 14:55:00 UTC
Created attachment 563426 [details]
Run in GDB
Comment 2 Alexander 2019-02-01 14:58:25 UTC
Created attachment 563428 [details]
Strace
Comment 3 Alexander 2019-02-01 15:00:50 UTC
Created attachment 563430 [details]
Firefox build settings
Comment 4 Alexander 2019-02-01 15:12:03 UTC
Forgot to add - Firefox build with GCC 8.2.0-r6
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2019-02-01 19:48:27 UTC
I have the same on one of my boxes but at the moment it looks like it is caused by a somehow broken toolchain (rust, llvm...). I am not conviced yet that this caused by firefox itself.
Comment 6 Alexander 2019-02-03 08:05:03 UTC
With USE="lto -pgo" same error
Program received signal SIGILL, Illegal instruction.
0x00007fffe68e967a in ?? () from /usr/lib64/firefox/libxul.so
Comment 7 Larry the Git Cow gentoo-dev 2019-02-10 21:50:16 UTC
The bug has been referenced in the following commit(s):

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

commit da3675965824a307cd16ffc48193929ba8125d98
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-02-10 00:50:26 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-02-10 21:49:56 +0000

    www-client/firefox: USE=pgo when using GCC will require AVX2 support
    
    Bug: https://bugs.gentoo.org/677052
    Package-Manager: Portage-2.3.59, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 www-client/firefox/firefox-65.0-r1.ebuild | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Comment 8 tt_1 2019-02-10 23:04:20 UTC
I think its this one? 

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88561
Comment 9 Larry the Git Cow gentoo-dev 2019-02-11 15:22:17 UTC
The bug has been referenced in the following commit(s):

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

commit 28ae5ce2652cc4e1d5488034a6dd1c3d1cf26781
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-02-11 15:21:32 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-02-11 15:21:53 +0000

    www-client/firefox: use -fdisable-ipa-cdtor workaround when AVX2 is not available
    
    This commit changes commit da3675965824a307cd16ffc48193929ba8125d98.
    
    Bug: https://bugs.gentoo.org/677052
    Package-Manager: Portage-2.3.59, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 www-client/firefox/firefox-65.0-r1.ebuild | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Comment 10 Thomas Deutschmann (RETIRED) gentoo-dev 2019-02-11 15:26:45 UTC
(In reply to tt_1 from comment #8)
> I think its this one? 
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88561

No. We are carrying a patch for this one (6012_fix-pgo-gcc-bug-in-spellchecker.patch).

The problem from this bug is, that GCC will produce AVX2 instructions even when AVX2 is not available. E.g. when you copy the binaries which are crashing with "invalid instructions" to a system with AVX2 support, they will work...
Comment 11 4nykey 2019-02-11 15:55:18 UTC
Just so you know, firefox[pgo] is possible even on non-avx2-capable system.

www-client/firefox-65.0-r1::local
USE="custom-cflags custom-optimization dbus eme-free hardened hwaccel jack lto pgo pulseaudio screenshot system-harfbuzz system-jpeg system-sqlite wayland -bindist -clang -debug -geckodriver (-gmp-autoupdate) (-neon) (-selinux) -startup-notification -system-icu -system-libevent -system-libvpx -system-webp -test -wifi"

sys-devel/gcc-8.2.0-r6::gentoo
USE="cxx fortran go graphite hardened mpx (multilib) nls nptl objc objc++ objc-gc openmp pgo (pie) (ssp) vtv (-altivec) -debug -doc (-fixed-point) (-jit) (-libssp) (-pch) -regression-test (-sanitize) -systemtap -vanilla" ABI_X86="(64)"

dev-lang/rust-1.31.1::gentoo
USE="clippy jemalloc rls rustfmt system-llvm -debug -doc -libressl -wasm" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="sse2" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore"

> grep -q avx2 /proc/cpuinfo || echo nosuchthing
> nosuchthing
firefox builds and runs fine
Comment 12 4nykey 2019-02-11 16:46:45 UTC
Forgot to mention that's locally edited ebuild without the '!clang? ( cpu_flags_x86_avx2 )' restriction
Comment 13 Thomas Deutschmann (RETIRED) gentoo-dev 2019-02-11 17:03:01 UTC
(In reply to ak from comment #12)
> Forgot to mention that's locally edited ebuild without the '!clang? (
> cpu_flags_x86_avx2 )' restriction

Comments like this doesn't help. Maybe you haven't set CPU USE flags but maybe your processor supports AVX2. In the end the GCC bug is well known and upstream fixed the problem. So yes, it is confirmed that current released GCC versions will produce AVX2 instructions when building firefox with USE=pgo...

But it doesn't matter anymore. Restriction was removed and we are now using a workaround for systems without AVX2.
Comment 14 4nykey 2019-02-11 21:04:41 UTC
(In reply to Thomas Deutschmann from comment #13)
> (In reply to ak from comment #12)
> > Forgot to mention that's locally edited ebuild without the '!clang? (
> > cpu_flags_x86_avx2 )' restriction
> 
> Comments like this doesn't help. Maybe you haven't set CPU USE flags but
> maybe your processor supports AVX2. In the end the GCC bug is well known and
> upstream fixed the problem. So yes, it is confirmed that current released
> GCC versions will produce AVX2 instructions when building firefox with
> USE=pgo...

Thank you for very helpful comment. Yes I do realise that not setting CPU flag make my CPU support avx2.

> But it doesn't matter anymore. Restriction was removed and we are now using
> a workaround for systems without AVX2.

Good news. Less burden to my local overlay. Cheers.
Comment 15 Alexander 2019-02-15 08:21:54 UTC
(In reply to Thomas Deutschmann from comment #13)
> (In reply to ak from comment #12)
> > Forgot to mention that's locally edited ebuild without the '!clang? (
> > cpu_flags_x86_avx2 )' restriction
> 
> Comments like this doesn't help. Maybe you haven't set CPU USE flags but
> maybe your processor supports AVX2. In the end the GCC bug is well known and
> upstream fixed the problem. So yes, it is confirmed that current released
> GCC versions will produce AVX2 instructions when building firefox with
> USE=pgo...
> 
> But it doesn't matter anymore. Restriction was removed and we are now using
> a workaround for systems without AVX2.


Hello. As I understand it, Firefox did not start because GCC forcibly builds Firefox with AVX2 instructions, and ebuild Firefox-65.0.1 had to fix this with the -fdisable-ipa-cdtor option. If this is the case, Firefox still does not start, the error is the same "Illegal instruction".
Comment 16 tt_1 2019-02-15 18:21:42 UTC
May I ask, did you use dev-lang/rust-1.32.0 to compile, with system-llvm?
Comment 17 Alexander 2019-02-19 12:16:28 UTC
(In reply to tt_1 from comment #16)
> May I ask, did you use dev-lang/rust-1.32.0 to compile, with system-llvm?

No, this flag disabled.
Comment 18 Ervin Peters 2019-02-28 07:19:42 UTC
I ran into this issue on my old MSI GX700 Laptop with CoreDuo T7500:

illegal instruction in ... libxul.so

It seems indeed to be a compiler issue. After upgrading to unstable gcc-8.3.0 and rebuilding Firefox, it runs fine.

ervin
Comment 19 Alexander 2019-02-28 12:13:42 UTC
OK, now I’ll compile gcc 8.3.0 and then Firefox.
Comment 20 Alexander 2019-03-01 06:33:09 UTC
With GCC 8.3.0

0x00007fffe8980f13 in ?? () from /usr/lib64/firefox/libxul.so
Segmentation fault

I will try as Ervin Peters to build Firefox on an old laptop with a CoreDuo T2250 processor.
Comment 21 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-03 03:09:48 UTC
Just saw bug 672946, could you please add the two patches from bug 672946 comment #42, rebuild gcc and retry?
Comment 22 Alexander 2019-03-04 10:40:11 UTC
(In reply to Thomas Deutschmann from comment #21)
> Just saw bug 672946, could you please add the two patches from bug 672946
> comment #42, rebuild gcc and retry?

All the same error as without patches

Thread 1 "firefox" received signal SIGSEGV, Segmentation fault.
0x00007fffe8980f13 in ?? () from /usr/lib64/firefox/libxul.so
Comment 23 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-13 02:49:40 UTC
Can you please compile without USE="lto pgo" so we can be sure that FF itself works for you and this is lto/pgo related?
Comment 25 Alexander 2019-03-20 16:14:28 UTC
(In reply to Thomas Deutschmann from comment #23)
> Can you please compile without USE="lto pgo" so we can be sure that FF
> itself works for you and this is lto/pgo related?

Yes, without these flags, Firefox runs.
Comment 26 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-20 16:32:54 UTC
@ Alec:

1) We have a workaround for cdtor problem (https://gitweb.gentoo.org/repo/gentoo.git/log/?qt=grep&q=cdtor)

2) Alexander said that he still gets the same error with gcc-8.3.0.



@ Alexander:
1) You are building on your own local machine for the same system, right?

2) No distcc, ccache or other things like that involved, right?

Please test FF66 again. If you still end up with "Illegal Instructions" please share the created image with us (quickpkg). I have to analyze the binary...
Comment 27 Alec Ari 2019-03-20 18:20:15 UTC
It works for Ervin Peters and myself. BDVER2 here, CPU supports AVX but no AVX2.
Comment 28 Will Simoneau 2019-03-20 19:55:46 UTC
On a Core2 system (Xeon X7460; Penryn derivative):
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1"

Kernel-reported flags (from /proc/cpuinfo):
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm tpr_shadow vnmi flexpriority dtherm

FF65.0.2, GCC7.3.0, USE="lto pgo"                         => SIGILL
FF65.0.2, GCC7.3.0, USE="lto pgo",   -fdisable-ipa-cdtor  => SIGILL
FF65.0.2, GCC7.3.0, USE="-lto -pgo"                       => works
FF65.0.2, GCC8.2.0, USE="lto pgo"                         => SIGILL
FF65.0.2, GCC8.2.0, USE="lto pgo",   -fdisable-ipa-cdtor  => SIGILL
FF65.0.2, GCC8.2.0, USE="lto -pgo",  -fdisable-ipa-cdtor  => SIGILL
FF65.0.2, GCC8.2.0, USE="-lto -pgo", -fdisable-ipa-cdtor  => works

The missing combinations are currently unknowns. Hopefully I didn't make any mistakes while creating the above table. No distcc or ccache in use here.

Apparently LTO is the problem, at least on my system...?

########
@Thomas: I have a couple .xpaks that you might be interested in...

These were not built by the X7460 system above, but the system that built them has a near-identical portage config & depgraph. They have CFLAGS="-march=nocona -mtune=core2" and CPU_FLAGS_X86="mmx mmxext sse sse2". I think they were both built with GCC8.2, but I'm not seeing the compiler version in the xpak metadata so I'm not completely certain of that.

firefox-65.0.2-2.xpak #USE="lto pgo"  => SIGILL on X7460
firefox-65.0.2-3.xpak #USE="lto -pgo" => SIGILL on X7460
Comment 29 Alexander 2019-03-21 14:05:17 UTC
> 1) You are building on your own local machine for the same system, right?
Yes. 
> 2) No distcc, ccache or other things like that involved, right?
Yes.
> Please test FF66 again. If you still end up with "Illegal Instructions"
> please share the created image with us (quickpkg). I have to analyze the
> binary...

OK.
Comment 30 Alexander 2019-03-21 14:09:16 UTC
(In reply to Will Simoneau from comment #28)

> Apparently LTO is the problem, at least on my system...?

No, I have the same problem. By the way, my processor also does not support AVX2 and AVX instructions (AMD Phenom II x6).
Comment 31 Alexander 2019-03-21 18:09:11 UTC
Build FF 66 fails at:

69:53.50 JARLOG_FILE=jarlog/en-US.log /var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/ff/_virtualenvs/init/bin/python /var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/build/pgo/profileserver.py
69:53.50 Running Firefox as root in a regular user's session is not supported.  ($HOME is /var/calculate/tmp/portage/www-client/firefox-66.0-r1/homedir which is owned by portage.)
69:53.51 Firefox exited with code 1 during profile initialization
69:53.51 gmake[1]: *** [Makefile:199: profiledbuild] Error 1
69:53.51 gmake[1]: Leaving directory '/var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/ff'
69:53.51 gmake: *** [client.mk:125: build] Error 2
69:53.53 110 compiler warnings present.
Comment 32 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-22 00:48:46 UTC
(In reply to Will Simoneau from comment #28)
> @Thomas: I have a couple .xpaks that you might be interested in...

Not exactly sure what you mean with xpaks but I need the install image. Using quickpkg would create an complete package file when you already have a non-working firefox installed.

(In reply to Alexander from comment #31)
> Build FF 66 fails at:
> 
> 69:53.50 JARLOG_FILE=jarlog/en-US.log
> /var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/ff/
> _virtualenvs/init/bin/python
> /var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/
> build/pgo/profileserver.py
> 69:53.50 Running Firefox as root in a regular user's session is not
> supported.  ($HOME is
> /var/calculate/tmp/portage/www-client/firefox-66.0-r1/homedir which is owned
> by portage.)
> 69:53.51 Firefox exited with code 1 during profile initialization
> 69:53.51 gmake[1]: *** [Makefile:199: profiledbuild] Error 1
> 69:53.51 gmake[1]: Leaving directory
> '/var/calculate/tmp/portage/www-client/firefox-66.0-r1/work/firefox-66.0/ff'
> 69:53.51 gmake: *** [client.mk:125: build] Error 2
> 69:53.53 110 compiler warnings present.

If building FF66 is failing for you, this is a different issue (build issue). Your excerpt doesn't help because it doesn't contain the failure reason (error).
Comment 33 Alexander 2019-03-22 03:51:46 UTC
(In reply to Thomas Deutschmann from comment #32)
> If building FF66 is failing for you, this is a different issue (build
> issue). Your excerpt doesn't help because it doesn't contain the failure
> reason (error).
I should create a new FF-66 build error report, or just put the build log here, maybe the reason for the crash is pretty simple, I just can't find it in the log?
Comment 34 Alexander 2019-05-22 04:48:03 UTC
It was necessary to add FEATURES = "userpriv", then there will be no problems with the rights to the directory. Firefox builds with pgo and lto, so the bug is fixed.