Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917486 - sys-devel/gcc-14: miscompiles media-video/pipewire (fails pw-test-filter test)
Summary: sys-devel/gcc-14: miscompiles media-video/pipewire (fails pw-test-filter test)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard: fixed in 14.0.0_pre20231119
Keywords: TESTFAILURE
Depends on:
Blocks: gcc-14
  Show dependency tree
 
Reported: 2023-11-17 10:54 UTC by Sam James
Modified: 2024-11-01 18:25 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 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 10:54:23 UTC
Not reported upstream yet as not enough info.


$ LD_LIBRARY_PATH=/home/sam/git/pipewire/build/src/pipewire gdb --args ./ow
Reading symbols from ./ow...
(gdb) r
Starting program: /home/sam/git/pipewire/reduce2/ow
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
[New Thread 0xf7a90b40 (LWP 3314573)]
state unconnected
wait connect
state connecting
sync 1073741830
object: id:0 type:PipeWire:Interface:Core/4
object: id:1 type:PipeWire:Interface:Module/3
object: id:2 type:PipeWire:Interface:Module/3
object: id:3 type:PipeWire:Interface:Factory/3
object: id:4 type:PipeWire:Interface:Module/3
object: id:5 type:PipeWire:Interface:Factory/3
object: id:6 type:PipeWire:Interface:Module/3
object: id:7 type:PipeWire:Interface:Factory/3
object: id:8 type:PipeWire:Interface:Module/3
object: id:9 type:PipeWire:Interface:Factory/3
object: id:10 type:PipeWire:Interface:Module/3
object: id:11 type:PipeWire:Interface:Factory/3
object: id:12 type:PipeWire:Interface:Factory/3
object: id:13 type:PipeWire:Interface:Factory/3
object: id:14 type:PipeWire:Interface:Factory/3
object: id:15 type:PipeWire:Interface:Factory/3
object: id:16 type:PipeWire:Interface:Factory/3
object: id:17 type:PipeWire:Interface:Metadata/3
object: id:18 type:PipeWire:Interface:Client/3
done 1073741830
state connecting
sync 1073741832

Thread 1 "ow" received signal SIGSEGV, Segmentation fault.
0xf7f51f92 in pw_impl_node_set_driver (node=0x565a50a0, driver=<optimized out>) at ../src/pipewire/impl-node.c:873
873             spa_list_append(&driver->follower_list, &node->follower_link);
(gdb) bt
#0  0xf7f51f92 in pw_impl_node_set_driver (node=0x565a50a0, driver=<optimized out>) at ../src/pipewire/impl-node.c:873
#1  0xf7f1b665 in remove_from_driver (context=<optimized out>, nodes=<optimized out>) at ../src/pipewire/context.c:991
#2  pw_context_recalc_graph (context=<optimized out>, reason=<optimized out>) at ../src/pipewire/context.c:1312
#3  0xf7f56dd3 in pw_impl_node_register (this=<optimized out>, properties=<optimized out>) at ../src/pipewire/impl-node.c:811
#4  0xf7ec4a1c in complete_init (impl=0x565a57d8) at ../pipewire-0.3.84/src/modules/spa/spa-node.c:58
#5  spa_node_result (data=0x565a57d8, seq=1073741848, res=0, type=0, result=0x0) at ../pipewire-0.3.84/src/modules/spa/spa-node.c:70
#6  0xf7f4a43d in node_result (data=<optimized out>, seq=<optimized out>, res=<optimized out>, type=<optimized out>, result=<optimized out>) at ../src/pipewire/impl-node.c:1629
#7  0xf7eaaa5f in client_node_resource_pong (data=0x565a4ce0, seq=1073741848) at ../pipewire-0.3.84/src/modules/module-client-node/client-node.c:1198
#8  0xf7f0dc67 in core_pong (object=<optimized out>, id=<optimized out>, seq=<optimized out>) at ../src/pipewire/impl-core.c:209
#9  0xf7af7e9f in core_method_demarshal_pong (object=0x565a4140, msg=0x565a18b4) at ../pipewire-0.3.84/src/modules/module-protocol-native/protocol-native.c:645
#10 0xf7aec72f in process_messages (data=data@entry=0x5658f1cc) at ../pipewire-0.3.84/src/modules/module-protocol-native.c:383
#11 0xf7aecd27 in connection_data (data=0x5658f1cc, fd=10, mask=1) at ../pipewire-0.3.84/src/modules/module-protocol-native.c:454
#12 0xf7ee05e3 in source_io_func (source=0x5658f790) at ../pipewire-0.3.84/spa/plugins/support/loop.c:512
#13 0xf7ee4616 in loop_iterate (object=0x5655f338, timeout=-1) at ../pipewire-0.3.84/spa/plugins/support/loop.c:496
#14 0xf7f45e3e in pw_main_loop_run (loop=0x5655f260) at ../src/pipewire/main-loop.c:128
#15 0x56556401 in roundtrip (loop=0x5655f260, core=0x5657c4c0) at test-filter.c:50
#16 main (argc=<optimized out>, argv=<optimized out>) at test-filter.c:124
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 10:55:20 UTC
$ emerge --info
Portage 3.0.55_p18 (python 3.12.0-final-0, default/linux/amd64/17.1/hardened, gcc-14, glibc-2.38-r7, 6.6.1 x86_64)
=================================================================
System uname: Linux-6.6.1-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.38
KiB Mem:    65758028 total,   9935544 free
KiB Swap:   16662520 total,   8670172 free
Timestamp of repository gentoo: Fri, 17 Nov 2023 08:16:54 +0000
Head commit of repository gentoo: d8f0efbcddc3f6bd95a7027715b009460c26551b

Timestamp of repository kde: Wed, 15 Nov 2023 23:46:56 +0000
Head commit of repository kde: 8683703c30db12397c8c4b1a648f3bf3f51a49b4

Timestamp of repository qt: Mon, 13 Nov 2023 22:45:27 +0000
Head commit of repository qt: b29e6b20f1913274fbc786836c9cd351c21dd5e5

Timestamp of repository sam_c: Mon, 13 Nov 2023 22:45:44 +0000
Head commit of repository sam_c: fa85b1a7b4d7fd91178cd8f199bcc4f994597270

Timestamp of repository steam-overlay: Mon, 13 Nov 2023 22:45:28 +0000
Head commit of repository steam-overlay: d4702fbdcc7974b3b41efb8dfb38b8c10a4277fe

sh dash 0.5.12
ld GNU ld (Gentoo 2.41 p2) 2.41.0
ccache version 4.8.3 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p21::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.10.13::gentoo, 3.11.6::gentoo, 3.12.0_p1::gentoo
dev-lang/rust:             1.73.0::gentoo
dev-util/ccache:           4.8.3::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.3.0_rc3::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.6::gentoo
sys-devel/autoconf:        2.13-r8::gentoo, 2.69-r9::gentoo, 2.71-r7::gentoo, 9999::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.38-r2::gentoo, 2.39-r5::gentoo, 2.40-r9::gentoo, 2.41-r2::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.5::gentoo
sys-devel/gcc:             10.5.0::gentoo, 11.4.1_p20231116::gentoo, 12.3.1_p20231110::gentoo, 13.2.1_p20231111::gentoo, 14.0.0.9999::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             17.0.5::gentoo
sys-devel/llvm:            15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.5::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: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    eclass-overrides: sam_c
    volatile: False
    sync-git-verify-commit-signature: yes
    sync-git-clone-extra-opts: -b stable -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    eclass-overrides: sam_c
    volatile: True

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/kde.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

qt
    location: /var/db/repos/qt
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/qt.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

sam_c
    location: /var/db/repos/sam_c
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sam_c.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo
    eclass-overrides: sam_c
    volatile: False

Installed sets: @sam-emacs, @sam-fonts, @sam-fortune
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches  "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /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/php/apache2-php8.2/ext-active/ /etc/php/cgi-php8.2/ext-active/ /etc/php/cli-php8.2/ext-active/ /etc/php/fpm-php8.2/ext-active/ /etc/php/phpdbg-php8.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches  "
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --with-bdeps=y --complete-graph --deep --dynamic-deps=n --changed-deps=n --usepkg=y --implicit-system-deps=n --usepkg-exclude sys-fs/zfs --usepkg-exclude sys-fs/zfs-kmod --jobs=4 --load-average 32"
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="-O2 -march=native -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches  "
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg clean-logs compress-build-logs config-protect-if-modified distlocks fixlafiles ipc-sandbox mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native -pipe -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -frecord-gcc-switches  "
GENTOO_MIRRORS="https://mirrors.gethosted.online/gentoo/ https://www.mirrorservice.org/sites/distfiles.gentoo.org/ https://mirror.bytemark.co.uk/gentoo/ https://mirrors.soeasyto.com/distfiles.gentoo.org/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs"
LEX="reflex"
LINGUAS="en en_GB"
MAKEOPTS="-j32 --output-sync=line"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BUNZIP2_COMMAND="lbunzip2"
PORTAGE_COMPRESS="xz"
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="/var/tmp"
RUSTFLAGS="-C target-cpu=native -C link-arg=-Wl,-z,pack-relative-relocs"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities aes alsa amd64 avx avx2 bash-completion bluetooth branding bzip2 cairo caps cdda cdr cet clang cli crypt dbus declarative dist-kernel dri dts dvd dvdr editorconfig emacs encode exif f16c filecaps firewalld flac fma3 fortran freetype gdbm gif gmp gpm graphite gtk gui hardened harfbuzz hunspell iconv icu ipv6 jit jpeg kde kdesu kwallet lcms libnotify libtirpc lto mad mmx mmxext mng mp3 mp4 mpeg multilib ncurses nftables nls nptl ogg opengl openmp pam pango pclmul pcre pdf pgo pic pie pipewire plasma png policykit popcnt ppds pulseaudio qml qt5 rdrand readline screencast sdl seccomp semantic-desktop sha sound spell sse sse2 sse3 sse4_1 sse4_2 sse4a ssl ssp ssse3 startup-notification svg system-av1 system-binutils system-boost system-bootstrap system-cairo system-clang system-digest system-ffmpeg system-harfbuzz system-heimdal system-icu system-jpeg system-leveldb system-libevent system-libs system-libvpx system-libyaml system-llvm system-lz4 system-mitkrb5 system-sqlite system-ssl system-tbb system-uulib system-webp system-zlib systemd test-rust tiff truetype udev udisks unicode upower usb valgrind verify-sig vorbis vulkan wayland widgets x264 xattr xcb xft xml xtpax xv xvid zlib zsh-completion" ABI_X86="32 64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache 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_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AArch64 AMDGPU ARM AVR BPF Hexagon Lanai MSP430 Mips NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11 pypy3 python3_10 python3_12" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="aarch64 aarch64_be alpha armeb hppa i386 m68k ppc ppc64 ppc64le sparc sparc64 x86_64" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="amdgpu radeonsi radeon" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
YACC="byacc"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YFLAGS
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 13:21:13 UTC
I think this needs -march=native (znver2 here).
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 13:27:33 UTC
Just to dump a few more notes.

This suppresses the crash. Interestingly, if you replace it with anything referencing `driver`, it seems to suppress it, even something like:
if (&driver->follower_list == &node->follower_list) {
    __builtin_abort();
}

```
--- a/src/pipewire/impl-node.c
+++ b/src/pipewire/impl-node.c
@@ -868,6 +868,8 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv
                driver = node;

        spa_list_remove(&node->follower_link);
+       if (driver == NULL) /* Suppresses segfault on null-deref in spa_list_append */
+               driver = node;
        spa_list_append(&driver->follower_list, &node->follower_link);

        if (old == driver)
```

ASAN spews on the null deref in spa_list_append as well.

PW already builds with -fno-strict-aliasing. Could try -fno-delete-null-pointer-checks out of curiosity.

Need to bisect for bad object.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-18 14:16:13 UTC
Needs -fstack-protector-strong which we set by default but I was bisecting with --disable-default-ssp...
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-18 16:44:42 UTC
3cd3a09b3f91a1d023cb180763d40598d6bb274b is the first bad commit
commit 3cd3a09b3f91a1d023cb180763d40598d6bb274b
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Sat Nov 11 17:28:55 2023 +0000

    mode-switching: Add note problem

    optimize_mode_switching uses REG_DEAD notes to track register
    liveness, but it failed to tell DF to calculate up-to-date notes.

    Noticed by inspection.  I don't have a testcase that fails
    because of this.

    gcc/
            * mode-switching.cc (optimize_mode_switching): Call
            df_note_add_problem.

 gcc/mode-switching.cc | 1 +
 1 file changed, 1 insertion(+)
bisect found first bad commit

same as bug 917496 and the mesa one
Comment 6 Larry the Git Cow gentoo-dev 2023-11-19 11:04:09 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=fb2901cba5026337511402c7745b2eb317e9b35c

commit fb2901cba5026337511402c7745b2eb317e9b35c
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-19 11:03:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-19 11:03:52 +0000

    14.0.0: add 75_all_PR112572-missing-notes-update.patch
    
    Fixes LLVM, mesa, pipewire miscompilation.
    
    Bug: https://gcc.gnu.org/PR112568
    Bug: https://gcc.gnu.org/PR112572
    Bug: https://bugs.gentoo.org/917496
    Bug: https://bugs.gentoo.org/917486
    Signed-off-by: Sam James <sam@gentoo.org>

 14.0.0/gentoo/75_all_PR112572-missing-notes-update.patch | 14 ++++++++++++++
 14.0.0/gentoo/README.history                             |  4 ++++
 2 files changed, 18 insertions(+)
Comment 7 Larry the Git Cow gentoo-dev 2023-11-20 07:03:32 UTC
The bug has been closed via the following commit(s):

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

commit 8ba6e2ad8af5a359dcee52103e63635a75650a4a
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-20 07:02:22 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-20 07:02:29 +0000

    sys-devel/gcc: add 14.0.0_pre20231119
    
    Closes: https://bugs.gentoo.org/917486
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/gcc/Manifest                      |  2 +
 sys-devel/gcc/gcc-14.0.0_pre20231119.ebuild | 64 +++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)