Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 927664 - dev-libs/glib-2.78.3: glib-compile-resources crashes on kernel 4.9.337
Summary: dev-libs/glib-2.78.3: glib-compile-resources crashes on kernel 4.9.337
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-24 09:30 UTC by Marcus Comstedt
Modified: 2024-03-24 09:36 UTC (History)
1 user (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 Marcus Comstedt 2024-03-24 09:30:50 UTC
When emerging software using glib resources, like x11-libs/vte, I get a crash in glib-compile-resources like the following:

[92/207] /usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                          
FAILED: src/app/resources-gtk3.cc.c                                             
/usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                                   
                                                                                
(glib-compile-resources:303): GLib-WARNING **: 09:46:19.731: ../glib-2.78.3/glib/gmain.c:5934: waitid(pid:304, pidfd=4) failed: Invalid argument (22). See documentation of g_child_watch_source_new() for possible causes.                   
../vte-0.74.2/src/app/app-gtk3.gresource.xml: Child process exited abnormally.  

When trying to build software using glib resources, like VTE, I get a crash in glib-compile-resources like the following:

[92/207] /usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                          
FAILED: src/app/resources-gtk3.cc.c                                             
/usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                                   
                                                                                
(glib-compile-resources:303): GLib-WARNING **: 09:46:19.731: ../glib-2.78.3/glib/gmain.c:5934: waitid(pid:304, pidfd=4) failed: Invalid argument (22). See documentation of g_child_watch_source_new() for possible causes.                   
../vte-0.74.2/src/app/app-gtk3.gresource.xml: Child process exited abnormally.  

When trying to build software using glib resources, like VTE, I get a crash in glib-compile-resources like the following:

[92/207] /usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                          
FAILED: src/app/resources-gtk3.cc.c                                             
/usr/bin/glib-compile-resources ../vte-0.74.2/src/app/app-gtk3.gresource.xml --sourcedir src/app --sourcedir ../vte-0.74.2/src/app --c-name app --internal --generate --target src/app/resources-gtk3.cc.c --dependency-file src/app/resources-gtk3.cc.c.d                                                                   
                                                                                
(glib-compile-resources:303): GLib-WARNING **: 09:46:19.731: ../glib-2.78.3/glib/gmain.c:5934: waitid(pid:304, pidfd=4) failed: Invalid argument (22). See documentation of g_child_watch_source_new() for possible causes.                   
../vte-0.74.2/src/app/app-gtk3.gresource.xml: Child process exited abnormally.  

If I downgrade to glib 2.76.4, then everything works fine.

I traced the issue to this commit:

https://gitlab.gnome.org/GNOME/glib/-/commit/f615eef4bafaa2fbe11530c0f66f7d28a28a58a9

Apparently this pidfd solution does not work on 4.9.337, which I suppose is expected since the commit message talks about >=5.3.  The problem is that the selection of implementation is done compile-time using the cpp symbol HAVE_PIDFD, which is set by the following meson.build code:

if cc.links('''#include <sys/syscall.h>                                         
               #include <sys/wait.h>                                            
               #include <linux/wait.h>                                          
               #include <unistd.h>                                              
               int main (int argc, char ** argv) {                              
                 siginfo_t child_info = { 0, };                                 
                 syscall (SYS_pidfd_open, 0, 0);                                
                 waitid (P_PIDFD, 0, &child_info, WEXITED | WNOHANG);           
                 return 0;                                                      
               }''', name : 'pidfd_open(2) system call')                        
  glib_conf.set('HAVE_PIDFD', 1)                                                
endif                                                                           

So this only checks that the code can be compiled, not that it actually works on the system.  And even if this was a cc.run, there would still be a problem with the choice being made compile time if the resulting binary was moved to a different system with a different kernel version.  For this to be portable between kernel versions there would have to be some sort of runtime check.

I verified that undefining HAVE_PIDFD made glib-compile-resources work again.

I created an upstreams issue:
https://gitlab.gnome.org/GNOME/glib/-/issues/3298

Reproducible: Always

Steps to Reproduce:
1.On a system running Linux 4.9, but with up-to-date sys-kernel/linux-headers
2.emerge =dev-libs/glib-2.78.3
3.emerge =x11-libs/vte-0.74.2
Actual Results:  
Compilation fails with a crash in glib-compile-resources

Expected Results:  
Compilation succeeds

Portage 3.0.61 (python 3.11.8-final-0, default/linux/arm64/17.0/desktop, gcc-13, glibc-2.38-r11, 4.9.337 aarch64)
=================================================================
System uname: Linux-4.9.337-aarch64-with-glibc2.38
KiB Mem:     8042768 total,    977672 free
KiB Swap:   16777212 total,  15367592 free
Timestamp of repository gentoo: Thu, 21 Mar 2024 13:30:00 +0000
Head commit of repository gentoo: ec798a13c2c5f5821c638f1438db0eb2cdae8f13
Timestamp of repository java: Mon, 12 Feb 2024 16:35:40 +0000
Head commit of repository java: 1859d79a80355c919a476d347fbea3480a261f2e

Head commit of repository sawfish: bd1ce62b0af2428c55d379e826d34e69745b60f9

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.41 p5) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.71-r6::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.3::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.1-r1::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           3.11.8_p1::gentoo, 3.12.2_p1::gentoo
dev-lang/rust:             1.74.1::gentoo
sys-apps/baselayout:       2.14-r2::gentoo
sys-apps/openrc:           0.53::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.41-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.6::gentoo
sys-devel/gcc:             13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             16.0.6::gentoo, 17.0.6::gentoo
sys-devel/llvm:            15.0.7-r3::gentoo, 16.0.6::gentoo, 17.0.6::gentoo
sys-kernel/linux-headers:  6.6::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r11::gentoo
Repositories:

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

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

zeldin
    location: /usr/local/portage
    masters: gentoo
    volatile: True

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10
    volatile: True

sawfish
    location: /var/db/repos/sawfish-overlay
    sync-type: git
    sync-uri: https://gitlab.com/teika-gentoo/sawfish-overlay.git
    masters: gentoo
    priority: 90
    volatile: False

ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask"
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"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles 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="-O2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="sv_SE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
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"
SHELL="/bin/tcsh"
USE="X a52 aac acl acpi alsa arm64 bluetooth branding bzip2 cairo cdda cdr cjk cli crypt css cups curl dbus dri dts dvb dvd dvdr elogind encode exif ffmpeg flac gdbm gif gmp gnutls gpm gtk gui iconv icu idn ipv6 jpeg lcms libffi libnotify libtirpc lua mad mng mp3 mp4 mpeg mule multitarget ncurses nis nls offensive ogg opengl openmp pam pango pcre pdf png policykit ppds qt5 readline sdl seamonkey seccomp smp sound spell split-usr ssl startup-notification svg test-rust theora threads tiff truetype udev udisks unicode upower usb vorbis vulkan wxwidgets x264 xattr xcb xemacs xft xml xmpp xv xvid zlib" ADA_TARGET="gcc_12" 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" 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="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="fbdev 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, 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, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-24 09:31:44 UTC
Yeah, sometimes upstreams will argue you should have a linux-headers which matches your running kernel, but this is a bad argument, as syscalls can fail for any reason (e.g. seccomp or other sandboxing).
Comment 2 Marcus Comstedt 2024-03-24 09:33:16 UTC
(Sorry about the tripple copy pasta from the upstream issue in the description, I 
 didn't notice it until after sending due to the small edit box...  :-/)