Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 942823 - sys-fs/cryptsetup-2.7.5[static] not so static and isLuks gets SIGFPE after glibc upgrade
Summary: sys-fs/cryptsetup-2.7.5[static] not so static and isLuks gets SIGFPE after gl...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-03 15:46 UTC by Jaak Ristioja
Modified: 2024-11-03 15:56 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 Jaak Ristioja 2024-11-03 15:46:18 UTC
See bug #942821 for a background.

After upgrading sys-libs/glibc from 2.39-r6 to 2.40-r5, the `isLuks` command of a statically built `cryptsetup` fails with SIGFPE:

    # cryptsetup isLuks /dev/nvme0n1; echo $?
    Floating point exception
    136

This has also happened in the past, but I didn't previously connect it with a glibc upgrade. I don't exactly remember what the exact signal was back then, but I have a vague remembrance that it might have been SIGBUS.

I could not get a good backtrace with gdb, which showed all frames as ??:

    # gdb /usr/bin/cryptsetup -batch -ex 'r isLuks /dev/nvme0n1' -ex 'thread apply all bt full'

    Program received signal SIGFPE, Arithmetic exception.
    0x00007ffff737a73e in ?? ()

    Thread 1 (process 7969 "cryptsetup"):
    #0  0x00007ffff737a73e in ?? ()
    No symbol table info available.
    #1  0x0000000000800000 in ?? ()
    No symbol table info available.
    #2  0x0000000080000002 in ?? ()
    No symbol table info available.
    #3  0x000000000073b669 in ?? ()
    No symbol table info available.
    #4  0x00007fffffffd4a8 in ?? ()
    No symbol table info available.
    #5  0x00000000009ff880 in ?? ()
    No symbol table info available.
    #6  0x0000000000000001 in ?? ()
    No symbol table info available.
    #7  0x00007fffffffcac0 in ?? ()
    No symbol table info available.
    #8  0x00007fffffffca80 in ?? ()
    No symbol table info available.
    #9  0x00007fffffffca78 in ?? ()
    No symbol table info available.
    #10 0x0000000000000001 in ?? ()
    No symbol table info available.
    #11 0x0000000000000000 in ?? ()
    No symbol table info available.

However, although cryptsetup should be statically linked, it seems to depend on external libraries. An API/ABI mismatch due to the glibc upgrade might perhaps explain the crash:

    # file $(which cryptsetup)
    /usr/bin/cryptsetup: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, stripped
    # strace -fe openat cryptsetup isLuks /dev/nvme0n1
    openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/dev/nvme0n1", O_RDONLY|O_DIRECT) = 3
    openat(AT_FDCWD, "/dev/urandom", O_RDONLY|O_CLOEXEC) = 3
    openat(AT_FDCWD, "/dev/random", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 4
    openat(AT_FDCWD, "/usr/lib64/ossl-modules/legacy.so", O_RDONLY|O_CLOEXEC) = 5
    openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 5
    openat(AT_FDCWD, "/usr/lib64/libcrypto.so.3", O_RDONLY|O_CLOEXEC) = 5
    openat(AT_FDCWD, "/usr/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 5
    openat(AT_FDCWD, "/usr/lib64/ld-linux-x86-64.so.2", O_RDONLY|O_CLOEXEC) = 5
    --- SIGFPE {si_signo=SIGFPE, si_code=FPE_INTDIV, si_addr=0x7fb60a37a73e} ---
    +++ killed by SIGFPE +++
    Floating point exception

Some `emerge --info`:

# emerge --info sys-fs/cryptsetup
Portage 3.0.66.1 (python 3.12.7-final-0, default/linux/amd64/23.0/no-multilib/hardened, gcc-13, glibc-2.40-r5, 6.11.6-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
sh bash 5.2_p37
ld GNU ld (Gentoo 2.42 p6) 2.42.0
distcc 3.4 x86_64-pc-linux-gnu [disabled]
ccache version 4.10.2 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.30.5::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.5.2::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.11.10_p1::gentoo, 3.12.7_p1::gentoo, 3.13.0::gentoo
dev-lang/rust:             1.81.0::gentoo
dev-util/ccache:           4.10.2-r1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.42-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/clang:           18.1.8::gentoo
sys-devel/gcc:             13.3.1_p20241025::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.8::gentoo
sys-devel/llvm:            18.1.8-r1::gentoo
sys-kernel/linux-headers:  6.11::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000
    volatile: False
    sync-git-verify-commit-signature: true

ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=x86-64-v3 -mtune=native -ggdb"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="-O2 -pipe -march=x86-64-v3 -mtune=native -ggdb"
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 -march=x86-64-v3 -mtune=native -ggdb"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live clean-logs collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait 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 -pipe -march=x86-64-v3 -mtune=native -ggdb"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
MAKEOPTS="-j132 -l132"
SHELL="/bin/bash"

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

sys-fs/cryptsetup-2.7.5::gentoo was built with the following:
USE="argon2 openssl static urandom -fips -gcrypt -kernel -nettle -nls -pwquality -ssh -static-libs -test -udev"

sys-libs/glibc-2.40-r5::gentoo was built with the following:
USE="caps cet doc multiarch profile (ssp) (static-libs) -audit -compile-locales (-custom-cflags) -gd -hash-sysv-compat -headers-only (-multilib) -multilib-bootstrap -nscd -perl (-selinux) (-stack-realign) -suid -systemd -systemtap -test (-vanilla)"

dev-libs/openssl-3.3.2-r1::gentoo was built with the following:
USE="asm static-libs verify-sig -fips -ktls -quic -rfc3779 -sctp -test -tls-compression -vanilla -weak-ssl-ciphers" CPU_FLAGS_X86="(sse2)"
CFLAGS="-O2 -pipe -march=x86-64-v3 -mtune=native -ggdb -fno-strict-aliasing -Wa,--noexecstack"
CXXFLAGS="-O2 -pipe -march=x86-64-v3 -mtune=native -ggdb -fno-strict-aliasing -Wa,--noexecstack"
Comment 1 Mike Gilbert gentoo-dev 2024-11-03 15:56:22 UTC
Based on the strace output, openssl is loading its legacy provider module, which causes a bunch of other shard objects to be loaded, including glibc.