Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 664868 - www-client/chromium-69.0.3497.57 - Unable to copy EFLAGS physical register!
Summary: www-client/chromium-69.0.3497.57 - Unable to copy EFLAGS physical register!
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on: 674068
Blocks:
  Show dependency tree
 
Reported: 2018-08-30 00:21 UTC by Wil Reichert
Modified: 2019-07-13 21:12 UTC (History)
5 users (show)

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


Attachments
emerge --info (emerge-info.log,7.20 KB, text/x-log)
2018-08-30 00:21 UTC, Wil Reichert
Details
Build log (chromium-69.0.3497.57-build.log.xz,434.24 KB, application/x-xz)
2018-08-30 00:22 UTC, Wil Reichert
Details
tab.cpp (tab.cpp,251 bytes, text/x-c++src)
2018-09-01 20:59 UTC, Sergei Trofimovich (RETIRED)
Details
patch for llvm-7 (0001-X86-Stop-X86DomainReassignment-from-creating-copies-.patch,4.16 KB, patch)
2018-10-01 08:16 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wil Reichert 2018-08-30 00:21:25 UTC
Created attachment 545492 [details]
emerge --info

Chromium 69 & 70 builds fail with the following error

fatal error: error in backend: Unable to copy EFLAGS physical register!
x86_64-pc-linux-gnu-clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)


In addition to completely rebuilding my system I've tried number of toolchain version permutations:
gcc:7.3.0 & gcc:8.2.0
llvm:6, llvm:7, lvm:8
binutils:2.30 & binutils:2.31
march=native & march=skylake-avx512
ld.bfd, ld.gold & lld

Also tried  enabling & disabling the component-build & jumbo-build use flags

All the above fail with the same EFLAGS error.

using the exact output of cpuid2cpuflags in make.conf
CPU_FLAGS_X86="aes avx avx2 avx512f avx512dq avx512cd avx512bw avx512vl f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

Ultimately setting march=skylake made the build succeed which hints at improper behavior with the avx512 type instructions.
Comment 1 Wil Reichert 2018-08-30 00:22:37 UTC
Created attachment 545494 [details]
Build log
Comment 2 Mike Gilbert gentoo-dev 2018-08-30 20:20:46 UTC
(In reply to Wil Reichert from comment #0)
> Ultimately setting march=skylake made the build succeed which hints at
> improper behavior with the avx512 type instructions.

Sounds like a toolchain issue of some sort; giving this to the llvm people.
Comment 3 Mike Gilbert gentoo-dev 2018-08-30 20:27:13 UTC
From the build log:

********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
x86_64-pc-linux-gnu-clang++: note: diagnostic msg: /var/tmp/portage/www-client/chromium-69.0.3497.57/temp/tab-b2786a.cpp
x86_64-pc-linux-gnu-clang++: note: diagnostic msg: /var/tmp/portage/www-client/chromium-69.0.3497.57/temp/tab-b2786a.sh
x86_64-pc-linux-gnu-clang++: note: diagnostic msg:

********************
Comment 4 Mike Gilbert gentoo-dev 2018-08-30 20:29:53 UTC
Here's the failing source file.

https://chromium.googlesource.com/chromium/src/+/69.0.3497.57/chrome/browser/ui/views/tabs/tab.cc
Comment 5 Wil Reichert 2018-08-30 20:37:48 UTC
tab-b2786a.cpp & tab-b2786a.sh (too big to attach here)

https://www.dropbox.com/s/grewnfnm7u8iva2/tab-b2786a.tar.gz?dl=0
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-08-31 06:33:08 UTC
Thanks for the report.  I'm going to try to reproduce it, and hopefully I'll be able to take it from here without proxying between you and upstream ;-).
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-08-31 18:32:43 UTC
I'm afraid I won't be able to reproduce it since Chromium insists on running just-compiled executables and I don't have any system with AVX512.  I think the best thing to do right now would be to rebuild LLVM+Clang with '-Og -ggdb', and try getting a backtrace.  Would you like to report the bug upstream yourself or should I proxy for you?
Comment 8 Wil Reichert 2018-09-01 05:11:31 UTC
Rebuilt clang & llvm with '-Og -ggdb' but I'm not sure how to get a backtrace from the compile failure.

Might be better if you file the upstream bug as I'm not sure how to replicate this outside of a Gentoo build environment. I'm happy to provide debug logs & test patches as needed.
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-09-01 05:34:09 UTC
Could you attach the .cpp and .sh file listed in the build log?
Comment 10 Wil Reichert 2018-09-01 05:50:55 UTC
Too big to attach here - https://www.dropbox.com/s/936phn8mrh88urm/build-logs.tar.xz?dl=0
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-09-01 16:26:42 UTC
Thanks.  I can reproduce the problem with that file and I've already started reducing it.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2018-09-01 20:59:44 UTC
Created attachment 545746 [details]
tab.cpp

That should be enough to crash clang++:

  // $ clang++ -march=skylake-avx512 -O2 tab.cpp
  // fatal error: error in backend: Unable to copy EFLAGS physical register!
  bool a();
  int b, c;
  float d;

  float fn2() {
    int e = a();
    double f = e ? 0.75f : 0;
    if (c)
      d = e ? 0 : b;
    return f;
  }
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-09-01 21:01:18 UTC
Thanks.  I'll pass that on.
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-10-01 08:16:41 UTC
Created attachment 548572 [details, diff]
patch for llvm-7

Ok, so apparently upstream has patched the problem.  I'm attaching their patch, and it seems to clearly apply to release_70 branch.  Could you please user-patch it into sys-devel/llvm, rebuild it and test whether it solves the issue for you?  Clang rebuild shouldn't be necessary.
Comment 15 Anton Kuleshov 2018-10-02 08:26:49 UTC
Yes, its solved issue, thanks.
Comment 16 Larry the Git Cow gentoo-dev 2018-10-02 18:41:03 UTC
The bug has been referenced in the following commit(s):

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

commit cf5cbc3700bc996519f9c5273973f58e6ec3d580
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-10-02 17:56:57 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-10-02 18:40:55 +0000

    sys-devel/llvm: Backport X86 codegen bugfix for Chromium builds
    
    Backport the X86 codegen fix to 7.0.0 and 6.0.1, to ~arch.  Hopefully
    people will get this along with libffi-enforced rebuild.  We can
    stabilize 6.0.1-r2 either when stable users start hitting this, or when
    libffi gets stable.
    
    Bug: https://bugs.gentoo.org/664868
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 ...6DomainReassignment-from-creating-copies-.patch | 110 +++++++++
 sys-devel/llvm/llvm-6.0.1-r2.ebuild                | 270 +++++++++++++++++++++
 sys-devel/llvm/llvm-7.0.0-r1.ebuild                | 264 ++++++++++++++++++++
 3 files changed, 644 insertions(+)
Comment 17 Wil Reichert 2018-10-08 21:24:27 UTC
I've tested chromium 69.0.3497.100 & 70.0.3538.45, both compile successfully with the patch added to llvm-7.0.0-r1.
Comment 18 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-21 22:14:14 UTC
Let's rename the bug to make it clearer why it's not closed yet.
Comment 19 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-12-30 10:07:10 UTC
I guess we will likely stabilize 7.0.1 before libffi goes stable after all.
Comment 20 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-07-13 21:12:04 UTC
6.0.1-r2 is stable on all affected arches wrt bug #686028.