Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920555 - dev-qt/qtwebengine-6.6.1 when built with gcc -march=armv8-a+pauth bytecode_builtins_list_generator/gen-regexp-special-case build tool crash
Summary: dev-qt/qtwebengine-6.6.1 when built with gcc -march=armv8-a+pauth bytecode_bu...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-22 21:37 UTC by Mart Raudsepp
Modified: 2023-12-25 21:22 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mart Raudsepp gentoo-dev 2023-12-22 21:37:46 UTC
When qtwebengine:6 is built with gcc with the "pauth" ARM64 feature enabled, the build tools bytecode_builtins_list_generator and gen-regexp-special-case crash when being called. Calling them manually without arguments prints usage, any argument hits further code paths that crash with a SIGSEGV.

The backtrace is useless with "Backtrace stopped: previous frame identical to this frame (corrupt stack?)"

This happens on a M2 Ultra CPU when built with the full support:
CXXFLAGS="-O2 pipe -march=armv8-a+crc+lse+rcpc+rdma+dotprod+aes+sha3+fp16fml+sb+ssbs+i8mm+bf16+flagm+pauth"

but also with minimized to only pauth:

CXXFLAGS="-O2 pipe -march=armv8-a+pauth"

or -march=native -mcpu=native:

CXXFLAGS="-O2 pipe -march=native -mcpu=native"

Only -march=native or only -mcpu=native works, but that's because of a different gcc bug where it doesn't end up with using any -march at all unless both are given (thus essentially compiling to lowest arm64 support possible).

clang+lld also works just fine with CXXFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches -flto=thin" (-fdebug-default-version=4 is filtered out by flag-o-matic calls in the ebuild).


A similar issue found by ionen looks like https://github.com/envoyproxy/envoy/issues/17100
but there the problem is different - with clang, and something about page sizes vs PT_LOAD.
I do not have 4kB page size, but 16kB, but:

# objdump -x ./bytecode_builtins_list_generator  |grep 'LOAD off' -A1
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**16
         filesz 0x000000000000fab0 memsz 0x000000000000fab0 flags r-x
    LOAD off    0x000000000001dda0 vaddr 0x000000000001dda0 paddr 0x000000000001dda0 align 2**16
         filesz 0x0000000000002270 memsz 0x0000000000002278 flags rw-


I do not know how widespread any pauth issues are, as clang is the main compiler and gcc is used only when clang support is broken for something. PAC is working fine with clang, if they are the same thing (are they?).
Comment 1 Mart Raudsepp gentoo-dev 2023-12-22 21:39:38 UTC
emerge --info, but as the gcc build is done via package.env stuff, it doesn't seem to reflect it here:


Portage 3.0.54 (python 3.11.6-final-0, default/linux/arm64/17.0/desktop/gnome/systemd/merged-usr, gcc-13, glibc-2.38-r7, 6.6.0-asahi+ aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.6.0-asahi+-aarch64-with-glibc2.38
KiB Mem:   198993872 total, 118671536 free
KiB Swap:          0 total,         0 free
Head commit of repository asahi: 2481f26b7b9bda59ee0cac78db013d974516ef9f

sh bash 5.2_p15-r7
ld GNU ld (Gentoo 2.41 p2) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r7::gentoo
dev-java/java-config:      2.3.1-r1::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.6::gentoo, 3.12.0_p1::gentoo
dev-lang/rust-bin:         1.74.1::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.2.3::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.5::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.71-r7::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo, 17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20231216::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo, 17.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo, 17.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r7::gentoo
Repositories:

gentoo
    location: /home/leio/gentoo/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes

asahi
    location: /var/db/repos/asahi
    sync-type: git
    sync-uri: https://github.com/chadmed/asahi-overlay.git
    masters: gentoo
    volatile: False

Binary Repositories:

gentoobinhost
    priority: 1
    sync-uri: https://gentoo.osuosl.org/releases/arm64/binpackages/17.0/arm64

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
AR="llvm-ar"
CBUILD="aarch64-unknown-linux-gnu"
CC="clang"
CFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches -flto=thin"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXX="clang++"
CXXFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches -flto=thin"
DISTDIR="/home/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-default-version=4 -gdwarf-4 -frecord-gcc-switches"
GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/ http://ftp.halifax.rwth-aachen.de/gentoo/"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-zpack-relative-relocs -flto=thin -Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="flex"
LINGUAS="en et et_EE pl de"
MAKEOPTS="-j26"
OBJCOPY="llvm-objcopy"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
RANLIB="llvm-ranlib"
RUSTFLAGS="-C linker-plugin-lto -C opt-level=3 -C target-cpu=apple-m2 -C link-arg=-Wl,-z,pack-relative-relocs"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa arm64 bluetooth branding brotli bzip2 cairo cdda cdr clang cli colord crypt cups dbus dri dts dvdr eds encode evo exif flac flatpak fortran gdbm gif gnome gnome-keyring gnome-online-accounts gnome-shell gpm gstreamer gtk gui iconv icu introspection ipv6 jpeg keyring lcms libnotify libtirpc mad mng mp3 mp4 mpeg nautilus ncurses networkmanager nls nptl ogg opengl openmp opus pam pango pcre pdf pipewire png policykit ppds pulseaudio readline screencast sdl seccomp sound spell ssl startup-notification svg sysprof systemd test-rust tiff tracker truetype udev udisks unicode upower usb vorbis vulkan wayland wxwidgets x264 xattr xcb xft xml xv zlib" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en et" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby32" VIDEO_CARDS="fbdev asahi dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, ARFLAGS, AS, ASFLAGS, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

dev-qt/qtwebengine-6.6.1::gentoo was built with the following:
USE="alsa jumbo-build opengl pdfium pulseaudio qml screencast system-icu test vulkan widgets -bindist -custom-cflags -designer -geolocation -kerberos -vaapi"
CFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -gdwarf-4 -frecord-gcc-switches"
CXXFLAGS="-mcpu=apple-m2 -O3 -pipe -mbranch-protection=standard -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -gdwarf-4 -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-zpack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0"
Comment 2 Ionen Wolkens gentoo-dev 2023-12-22 22:19:41 UTC
May wait a bit to see if more people can reproduce, but then odds are I'll just filter these for the time being when arm64+gcc+!custom-cflags. Likely not worth worrying about it from qtwebengine's end, albeit if the issue is on gcc's end it may hide a more widespread problem.

Note Qt5's webengine did not respect *FLAGS at all, so it *could* be affected too.

An optional thing to try could be qtwebengine-6.7.9999 (do `dev-qt/*:6/6.7.9999 **` for simple accept keywords, don't bother with 6.9999 it'll be half-broken), it's based on chromium-118 bringing it closer to chromium proper (6.6.1 is chromium-112).
Comment 3 Ionen Wolkens gentoo-dev 2023-12-22 22:28:13 UTC
(In reply to Ionen Wolkens from comment #2)
> Note Qt5's webengine did not respect *FLAGS at all, so it *could* be
> affected too.
On that note, Qt may ignore bugs regarding this because they intentionally go out of their way to ensure we don't use different flags as-is for webengine.

Albeit issues would likely be in v8 repo rather than Qt seeing how the segfaulting tools are from there.
Comment 4 Larry the Git Cow gentoo-dev 2023-12-24 08:28:07 UTC
The bug has been closed via the following commit(s):

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

commit 64afdb690871b92f6916abc03210662c43eb2d8f
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2023-12-22 20:52:48 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2023-12-24 08:27:32 +0000

    dev-qt/qtwebengine: filter -march on arm64 with gcc for now (qt6)
    
    Bit like Qt5's webengine which did not respect it either. Not ideal
    but given the complexity tend to be lucky if it builds at all.
    
    As noted in the comment, please report if this works again so can
    cleanup (can test with USE=custom-cflags), may get fixed either
    by >=qtwebengine-6.7 (chromium-118) or a new gcc version depending
    on where the real issue is, but not planning to pursue this further
    myself.
    
    Closes: https://bugs.gentoo.org/920555
    Closes: https://bugs.gentoo.org/920568
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 dev-qt/qtwebengine/qtwebengine-6.6.1.ebuild    | 6 ++++++
 dev-qt/qtwebengine/qtwebengine-6.6.9999.ebuild | 6 ++++++
 dev-qt/qtwebengine/qtwebengine-6.7.9999.ebuild | 6 ++++++
 dev-qt/qtwebengine/qtwebengine-6.9999.ebuild   | 6 ++++++
 4 files changed, 24 insertions(+)
Comment 5 Mart Raudsepp gentoo-dev 2023-12-24 08:52:00 UTC
This isn't really fixed, so lets not close it? Or rather, reassign to toolchain?
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-12-25 20:21:38 UTC
I'll reassign. Note that I don't have access to pauth hw yet though.
Comment 7 Mart Raudsepp gentoo-dev 2023-12-25 21:22:36 UTC
CXXFLAGS="-O2 pipe -march=armv8-a+pauth -fuse-ld=lld" crashes
CXXFLAGS=""-O2 -pipe -march=armv8-a -fuse-ld=lld -mbranch-protection=standard" works (pauth extension replaced with -mbranch-protection=standard)

This makes me wonder what the difference is.


If I spam "step" in gdb by running it once and then holding enter, this is where it ends:

(gdb) 
0x0000aaaaaaab2ddc in v8::internal::WriteHeader(char const*) ()
(gdb) 
Single stepping until exit from function _ZN2v88internal11WriteHeaderEPKc,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x007faaaaaaab2de4 in ?? ()
(gdb) 
Cannot find bounds of current function