Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916567 - net-vpn/strongswan: General Protection Fault when started, crashes in sys-apps/systemd (fill_iovec_sprintf->malloc_sizeof_safe)
Summary: net-vpn/strongswan: General Protection Fault when started, crashes in sys-app...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal critical (vote)
Assignee: Dennis Eisele
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2023-10-31 07:21 UTC by Steve Moyes
Modified: 2023-12-20 14:58 UTC (History)
4 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 Steve Moyes 2023-10-31 07:21:39 UTC
When starting the service (systemctl start strongswan), the services instantly dies.

Reproducible: Always

Steps to Reproduce:
1. systemctl start strongswan
Actual Results:  
systemd[1]: strongswan.service: Main process exited, code=dumped, status=11/SEGV
systemd[1]: strongswan.service: Failed with result 'core-dump'.
systemd[1]: Failed to start strongswan.service.
kernel: traps: charon-systemd[2059813] general protection fault ip:7f4cdfc36ac9 sp:7ffdc7d4c868 error:0 in libc.so.6[7f4cdfbc4000+14f000]

Expected Results:  
Services running and waiting for connections

Portage 3.0.51 (python 3.11.5-final-0, !../../usr/portage/profiles/default/linux/amd64/17.1/no-multilib/systemd/merged-usr, gcc-13, glibc-2.37-r7, 6.5.9-gentoo x86_64)
=================================================================
System uname: Linux-6.5.9-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-glibc2.37
KiB Mem:    32691488 total,  10304820 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 31 Oct 2023 04:30:01 +0000
Head commit of repository gentoo: 18782c21fd41876d7784170ea7e2ccb1919a5520
Head commit of repository grub2-themes: 32fa98beaeef0c0056fa5ef9f600598a32d3aca4

Timestamp of repository guru: Mon, 30 Oct 2023 19:02:06 +0000
Head commit of repository guru: 682a1dd636d0987f0a9937376c8b143b0f0fb8f7

Timestamp of repository salfter: Mon, 30 Oct 2023 19:02:12 +0000
Head commit of repository salfter: 6fee88fad5501cedb35cc72467e65f059079f098

Head commit of repository steam-overlay: e6ea1449bcfc7c9157fc23be050ae15534992f22

Head commit of repository x11: 00109758b71fe651b0c367b3eeb9bcbac24dc533

Timestamp of repository zugaina: Fri, 16 Jun 2023 08:32:15 +0000
Head commit of repository zugaina: a31fcec20b159a13ccd069d4e13b92d18bc0ffec

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-java/java-config:      2.3.1-r1::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.5::gentoo
dev-lang/rust:             1.71.1::gentoo
dev-util/cmake:            3.26.5-r2::gentoo
dev-util/meson:            1.2.1-r1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.5::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             13.2.1_p20230826::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/llvm:            15.0.7-r3::gentoo, 16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.5::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

grub2-themes
    location: /var/db/repos/grub2-themes
    sync-type: git
    sync-uri: https://gitweb.gentoo.org/repo/proj/grub2-themes.git
    masters: gentoo
    volatile: False

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

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

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

x11
    location: /var/db/repos/x11
    sync-type: git
    sync-uri: https://cgit.gentoo.org/proj/x11.git
    masters: gentoo
    volatile: False

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
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.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/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="-O2 -pipe"
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 preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://rsync.mirrorservice.org/distfiles.gentoo.org/ ftp://mirror.bytemark.co.uk/gentoo/ http://mirror.bytemark.co.uk/gentoo/ rsync://mirror.bytemark.co.uk/gentoo/ http://mirror.qubenet.net/mirror/gentoo/ ftp://ftp.mirrorservice.org/sites/distfiles.gentoo.org/ http://www.mirrorservice.org/sites/distfiles.gentoo.org/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
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="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aacs accept_license_* accept_license_=@EULA acl acpi alsa amd64 aptx bash-completion bdplus bluetooth bluez bluray branding bzip2 cacert cairo ccache cdparanoia cli config_protect_/var/www/roundcube/htdocs/roundcube/config/db.inc.php config_protect_/var/www/roundcube/htdocs/roundcube/config/main.inc.php config_protect_/var/www/wordpress/htdocs/wordpress/wp-config.php config_protect_/var/www/wordpress/htdocs/wordpress/wp-content/themes/twentyten/style.css consolekit corefonts cron crypt cuda cups dbus dhcp dkim dlv dmarc dri dri3 dvdr eap eds exif fat fdk ffmpeg flac fontconfig fortran gdbm gif gimp gnome gnome-keyring gnome-online-accounts gtk gtk3 hpcups http2 iconv introspection ipv6 jpeg jpeg2k ldac libinput libnotify libtirpc linguas_en linguas_en_GB monolithic mp3 nautilus ncurses networkmanager nfsidmap nfsv4 nfsv41 nls nptl offensive office ogg openmp pam pcre pcre2 pkcs11 playlist png policykit pulseaudio qt5 raw readline seccomp sna spf ssl svg systemd sysv-utils test-rust themes theora tiff tracker truetype udev udisks unicode usb usbredir user-session uxa vala vhosts vim-syntax virtualbox vorbis webapp_manual_slot_yes webp x11extras x264 x265 xattr xft xv xvid zlib" ABI_X86="64" 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 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 auth_digest authn_dbd dbd http2 ident imagemap mng opengl proxy proxy_ajp proxy_balancer proxy_connect proxy_html proxy_http proxy_http2 proxy_scgi proxy_wstunnel slotmem_shm socache_memcache xml2enc" APACHE2_MPMS="worker" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="canon ptp2" COLLECTD_PLUGINS="df interface load memory rrdtool swap apache apcups battery bind conntrack cpu cpufreq csv curl disk dns email ethstat hddtemp iptables mysql network nfs python sensors smart" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 fma3 popcnt sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" 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" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="libinput wacom" 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="NVPTX X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby31" SANE_BACKENDS="canon epson epson2 hp lexmark" VIDEO_CARDS="intel nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account dnetmap echo gradm"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 07:25:11 UTC
Could you try get a backtrace via coredumpctl? Thanks.

(May need to follow https://wiki.gentoo.org/wiki/Debugging#Per-package to get more useful output.0
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 07:25:53 UTC
>!../../usr/portage/profiles/default/linux/amd64/17.1/no-multilib/systemd/merged-usr

By the way, you should fix your profile, as your repo now seems to be in /var/db/repos/gentoo.
Comment 3 Steve Moyes 2023-10-31 18:24:50 UTC
(In reply to Sam James from comment #1)
> Could you try get a backtrace via coredumpctl? Thanks.
> 
> (May need to follow https://wiki.gentoo.org/wiki/Debugging#Per-package to
> get more useful output.0

# coredumpctl gdb
           PID: 2461753 (charon-systemd)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Tue 2023-10-31 18:16:23 GMT (5min ago)
  Command Line: /usr/sbin/charon-systemd
    Executable: /usr/bin/charon-systemd
 Control Group: /user.slice/user-1001.slice/user@1004.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-8e0bdda3-8a5f-45a7-9e71-8cd0780d2915.scope
          Unit: user@1001.service
     User Unit: vte-spawn-8e0bdda3-8a5f-45a7-9e71-8cd0780d2915.scope
         Slice: user-1001.slice
     Owner UID: 1001 (me)
       Boot ID: c05309a31de341309ab0e80026a58827
    Machine ID: 0d72cbc666e91c5fd93656c956a23fb0
      Hostname: test.example.com
       Storage: /var/lib/systemd/coredump/core.charon-systemd.0.c05309a31de341309ab0e80026a58827.2461753.1698776183000000.zst (present)
  Size on Disk: 113.5K
       Message: Process 2461753 (charon-systemd) of user 0 dumped core.

GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/charon-systemd...
(No debugging symbols found in /usr/bin/charon-systemd)
[New LWP 2461753]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/charon-systemd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f3247e25ac9 in malloc_usable_size () from /usr/lib64/libc.so.6
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 18:27:04 UTC
In gdb, run "bt"?
Comment 5 Steve Moyes 2023-10-31 18:32:48 UTC
(In reply to Sam James from comment #4)
> In gdb, run "bt"?

Reading symbols from /usr/sbin/charon-systemd...
(No debugging symbols found in /usr/sbin/charon-systemd)
(gdb) run
Starting program: /usr/bin/charon-systemd 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
00[DMN] Starting charon-systemd IKE daemon (strongSwan 5.9.11, Linux 6.5.9-gentoo, x86_64)

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7c4bac9 in malloc_usable_size () from /usr/lib64/libc.so.6
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 18:35:24 UTC
You should be able to run "bt" once it segfaults to get an untruncated backtrace
Comment 7 Steve Moyes 2023-10-31 18:57:17 UTC
(In reply to Sam James from comment #6)
> You should be able to run "bt" once it segfaults to get an untruncated
> backtrace

Sorry I pasted the wrong text.. that would make sense :facepalm:

#0  0x00007f3247e25ac9 in malloc_usable_size () from /usr/lib64/libc.so.6
#1  0x00007f3247fee565 in ?? () from /usr/lib64/libsystemd.so.0
#2  0x00007f3247fccd99 in ?? () from /usr/lib64/libsystemd.so.0
#3  0x00007f3247fcd889 in sd_journal_send () from /usr/lib64/libsystemd.so.0
#4  0x0000563f35d5dbf7 in ?? ()
#5  0x00007f3248095033 in _cb_vlog_cb (entry=<optimized out>, args=<optimized out>) at bus/bus.c:358
#6  0x00007f324814008e in invoke_function (this=<optimized out>, fn=0x7f3248094f80 <_cb_vlog_cb>) at collections/linked_list.c:443
#7  0x00007f32480953aa in vlog (this=0x563f36a5b1d0, group=<optimized out>, level=LEVEL_CTRL, 
    format=0x563f35d5e248 "Starting charon-systemd IKE daemon (strongSwan 5.9.11, %s %s, %s)", args=args@entry=0x7ffc94d1ed10)
    at bus/bus.c:427
#8  0x00007f32480954aa in log_ (this=<optimized out>, group=<optimized out>, level=<optimized out>, format=<optimized out>)
    at bus/bus.c:440
#9  0x0000563f35d5d44a in ?? ()
#10 0x00007f3247db478a in ?? () from /usr/lib64/libc.so.6
#11 0x00007f3247db4845 in __libc_start_main () from /usr/lib64/libc.so.6
#12 0x0000563f35d5d7e1 in ?? ()
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-31 18:58:36 UTC
No worries!

Could you build systemd + glibc with debug symbols too like you did for strongswan then get a new backtrace?

That place it's dying is quite suspicious...
Comment 9 Steve Moyes 2023-10-31 20:15:15 UTC
(In reply to Sam James from comment #8)
> No worries!
> 
> Could you build systemd + glibc with debug symbols too like you did for
> strongswan then get a new backtrace?
> 
> That place it's dying is quite suspicious...

I don't get anything.  It just comes back with "no stack"?
Comment 10 Steve Moyes 2023-11-01 06:10:34 UTC
(In reply to Steve Moyes from comment #9)
> (In reply to Sam James from comment #8)
> > No worries!
> > 
> > Could you build systemd + glibc with debug symbols too like you did for
> > strongswan then get a new backtrace?
> > 
> > That place it's dying is quite suspicious...
> 
> I don't get anything.  It just comes back with "no stack"?

Ignore my last comment :)

# coredumpctl gdb
           PID: 3317096 (charon-systemd)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 11 (SEGV)
     Timestamp: Wed 2023-11-01 06:09:11 GMT (14s ago)
  Command Line: /usr/sbin/charon-systemd
    Executable: /usr/bin/charon-systemd
 Control Group: /system.slice/strongswan.service
          Unit: strongswan.service
         Slice: system.slice
       Boot ID: c05309a31de341309ab0e80026a58827
    Machine ID: 0d72cbc666e91c5fd93656c956a23fb0
      Hostname: mail.cdstealer.com
       Storage: /var/lib/systemd/coredump/core.charon-systemd.0.c05309a31de341309ab0e80026a58827.3317096.1698818951000000.zst (present)
  Size on Disk: 111.8K
       Message: Process 3317096 (charon-systemd) of user 0 dumped core.

GNU gdb (Gentoo 13.2 vanilla) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/charon-systemd...
(No debugging symbols found in /usr/bin/charon-systemd)
[New LWP 3317096]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/charon-systemd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f541f825ac9 in malloc_usable_size () from /usr/lib64/libc.so.6
(gdb) bt
#0  0x00007f541f825ac9 in malloc_usable_size () from /usr/lib64/libc.so.6
#1  0x00007f541f9ee565 in malloc_sizeof_safe (xp=0x7ffc5b7c3c88) at ../systemd-stable-254.5/src/basic/alloc-util.h:204
#2  greedy_realloc (p=p@entry=0x7ffc5b7c3c88, need=need@entry=2, size=size@entry=16)
    at ../systemd-stable-254.5/src/basic/alloc-util.c:56
#3  0x00007f541f9ccd99 in fill_iovec_sprintf (format=<optimized out>, ap=ap@entry=0x7ffc5b7c3f10, extra=extra@entry=0, 
    ret_iov=ret_iov@entry=0x7ffc5b7c3f00, ret_n_iov=ret_n_iov@entry=0x7ffc5b7c3f08)
    at ../systemd-stable-254.5/src/libsystemd/sd-journal/journal-send.c:189
#4  0x00007f541f9cd889 in sd_journal_send (format=<optimized out>)
    at ../systemd-stable-254.5/src/libsystemd/sd-journal/journal-send.c:210
#5  0x000055905f78ebf7 in ?? ()
#6  0x00007f541fa95033 in _cb_vlog_cb (entry=<optimized out>, args=<optimized out>) at bus/bus.c:358
#7  0x00007f541fb4008e in invoke_function (this=<optimized out>, fn=0x7f541fa94f80 <_cb_vlog_cb>) at collections/linked_list.c:443
#8  0x00007f541fa953aa in vlog (this=0x5590614fa1d0, group=<optimized out>, level=LEVEL_CTRL, 
    format=0x55905f78f248 "Starting charon-systemd IKE daemon (strongSwan 5.9.11, %s %s, %s)", args=args@entry=0x7ffc5b7c5800)
    at bus/bus.c:427
#9  0x00007f541fa954aa in log_ (this=<optimized out>, group=<optimized out>, level=<optimized out>, format=<optimized out>)
    at bus/bus.c:440
#10 0x000055905f78e44a in ?? ()
#11 0x00007f541f7b478a in ?? () from /usr/lib64/libc.so.6
#12 0x00007f541f7b4845 in __libc_start_main () from /usr/lib64/libc.so.6
#13 0x000055905f78e7e1 in ?? ()
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-01 11:30:39 UTC
Thanks. Did you definitely build glibc with debug symbols + installsource too?
Comment 12 Steve Moyes 2023-11-01 12:47:52 UTC
(In reply to Sam James from comment #11)
> Thanks. Did you definitely build glibc with debug symbols + installsource
> too?

Yup, followed the process as instructed.
Comment 13 Steve Moyes 2023-11-01 18:42:47 UTC
(In reply to Steve Moyes from comment #12)
> (In reply to Sam James from comment #11)
> > Thanks. Did you definitely build glibc with debug symbols + installsource
> > too?
> 
> Yup, followed the process as instructed.

Sorry, back home now.

# cat /etc/portage/package.env/glibc
sys-libs/glibc debugsyms installsources

# cat /etc/portage/package.env/systemd
sys-apps/systemd debugsyms

# cat /etc/portage/package.env/strongswan
net-vpn/strongswan debugsyms

# cat /etc/portage/env/debugsyms
CFLAGS="${CFLAGS} -ggdb3"
CXXFLAGS="${CXXFLAGS} -ggdb3"
# nostrip is disabled here because it negates splitdebug
FEATURES="${FEATURES} splitdebug compressdebug -nostrip"
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-12 07:26:01 UTC
It dying in malloc_sizeof_safe is suspicious given some of the shenanigans in the past there...
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-12 07:28:21 UTC
It's possible strongswan is just passing an invalid format string or similar.
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-12 07:51:05 UTC
The message is pretty new, added in https://github.com/strongswan/strongswan/commit/d12e6c9e551587099e81bcb32b2df9abc1040216.

FWIW, if I just build and start strongswan with 0 configuration, I do see that log message w/ no crash.
Comment 17 Steve Moyes 2023-11-12 10:01:55 UTC
(In reply to Sam James from comment #16)
> The message is pretty new, added in
> https://github.com/strongswan/strongswan/commit/
> d12e6c9e551587099e81bcb32b2df9abc1040216.
> 
> FWIW, if I just build and start strongswan with 0 configuration, I do see
> that log message w/ no crash.

yeah.  I found a VM that I hadn't updated in a few months, installed strongswan and worked just fine.  I guess it could be possible that my glib libraries are too new?  One or two of those packages are blocked from downgrading.
I've even done an emerge -qe @system && emerge -qe @world.
I'll keep digging.
Comment 18 Steve Moyes 2023-11-18 04:40:02 UTC
Hi, I found this command which produced this output.

# ipsec start --attach-gdb
Starting strongSwan 5.9.11 IPsec [starter]...
can't execv(/usr/bin/gdb,...): No such file or directory
24 bytes total, 1 allocations, 24 bytes average:
 dumping 7 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__tsearch+0x14a) [0x7ff521310e2a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff5212496ac]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee9c1f0]
    -> ??:0
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee99335]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
16 bytes total, 1 allocations, 16 bytes average:
 dumping 6 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52124963f]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee9c1f0]
    -> ??:0
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee99335]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
512 bytes total, 1 allocations, 512 bytes average:
 dumping 6 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff521249557]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee9c1f0]
    -> ??:0
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee99335]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
56 bytes total, 1 allocations, 56 bytes average:
 dumping 5 stack frame addresses:
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee9a912]
    -> ??:0
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee98bd2]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
24 bytes total, 1 allocations, 24 bytes average:
 dumping 6 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff5212859d8]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__asprintf_chk+0x9f) [0x7ff52131ee8f]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee98778]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
16 bytes total, 1 allocations, 16 bytes average:
 dumping 6 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff5212859d8]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__asprintf_chk+0x9f) [0x7ff52131ee8f]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee98745]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
26 bytes total, 1 allocations, 26 bytes average:
 dumping 6 stack frame addresses:
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff5212859d8]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__asprintf_chk+0x9f) [0x7ff52131ee8f]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee98712]
    -> ??:0
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 [0x7ff52122ec8a]
    -> ??:?
  /usr/lib64/libc.so.6 @ 0x7ff52120b000 (__libc_start_main+0x85) [0x7ff52122ed45]
    -> ??:?
  /usr/libexec/ipsec/starter @ 0x56407ee94000 [0x56407ee993f1]
    -> ??:0
7 leaks detected, 674 bytes, 3 suppressed by whitelist
charon has died -- restart scheduled (5sec)
Comment 19 Steve Moyes 2023-11-18 16:36:11 UTC
oh interesting.. I booted the VM and the exact same thing is happening after upgrading to gcc 13.  I'll downgrade to 12 and see what happens.
Comment 20 Steve Moyes 2023-11-18 18:45:18 UTC
So I tracked down a glibc-2.37.r3 ebuild (last working version) and downgraded.  No change, so I rolled back to the last working version of systemd (systemd-253.6) and boom, strongswan starts again.

updated glibc back to version 2.37-r7 and strongswan still works. :)

Thanks for you time and patience.
Comment 21 Alex Fan archtester 2023-12-20 14:58:44 UTC
Can reproduce this with --enable-leak-detective (via USE=debug), but runs okay without it even with latest glibc and systemd. I had this issue for another package also that hooks their own realloc and malloc.