Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 791073

Summary: dev-libs/opensc-0.21.0-r1 segfaults
Product: Gentoo Linux Reporter: Jan Krajdl <spm>
Component: Current packagesAssignee: Mikle Kolyada (RETIRED) <zlogene>
Status: RESOLVED WORKSFORME    
Severity: normal CC: alexander, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 843101    
Bug Blocks:    
Attachments: emerge --info output
build.log

Description Jan Krajdl 2021-05-19 10:36:39 UTC
Created attachment 709779 [details]
emerge --info output

Library opensc-pkcs11.so, contained in package opensc, segfaults when used on ~amd64 system. (As common browsers, mail clients and so on use it, when it's installed, it also prevent running these applications).

Steps to reproduce:
- install opensc
- run pkcs11-tool -t

In my case, running command return this:
spm-ntb /home/spm # pkcs11-tool -t
Neoprávněný přístup do paměti (SIGSEGV)

and in dmesg I can notice this:
[59239.001156] pkcs11-tool[10853]: segfault at 48 ip 00007f662fcf35e6 sp 00007fffa24f3440 error 6 in opensc-pkcs11.so[7f662fce0000+1d000]
Comment 1 Jonas Stein gentoo-dev 2021-05-20 22:29:43 UTC
Thank you for the report. 

Please use LANG=C so that we get the original (not translated) error messages.

We need to have all information at hand before ticket assignment. Please provide
* the complete build.log as attachment and
* paste the emerge info 
as described on https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket
Comment 2 Jan Krajdl 2021-05-21 08:33:04 UTC
Error message with LANG=C:

spm@spm-ntb ~ $ pkcs11-tool -t
Segmentation fault
Comment 3 Jan Krajdl 2021-05-21 08:33:34 UTC
emerge info:

Portage 3.0.18 (python 3.8.10-final-0, default/linux/amd64/17.1, gcc-11.1.0, glibc-2.33, 5.11.10-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.11.10-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i5-7200U_CPU_@_2.50GHz-with-glibc2.2.5
KiB Mem:    32765368 total,   6986916 free
KiB Swap:   20462932 total,  19287964 free
Timestamp of repository gentoo: Sat, 15 May 2021 05:00:01 +0000
Head commit of repository gentoo: a850cfd8129cce50b242576658f77a4b906d8ed3
sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p3) 2.36.1
distcc 3.4 x86_64-pc-linux-gnu [enabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.32.1::gentoo
dev-lang/python:          2.7.18_p10::gentoo, 3.6.13_p4::gentoo, 3.7.10_p4::gentoo, 3.8.10_p1::gentoo, 3.9.5_p1::gentoo, 3.10.0_beta1::gentoo
dev-lang/rust:            1.52.1::gentoo
dev-util/cmake:           3.20.2::gentoo
sys-apps/baselayout:      2.7-r2::gentoo
sys-apps/openrc:          0.43.3::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.36.1-r1::gentoo
sys-devel/gcc:            11.1.0::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.12::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33::gentoo
Repositories:

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

localrepo
    location: /var/db/repos/localrepo
    masters: gentoo

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 10

bombo82
    location: /var/lib/layman/bombo82
    masters: gentoo
    priority: 50

booboo
    location: /var/lib/layman/booboo
    masters: gentoo
    priority: 50

dev1990-overlay
    location: /var/lib/layman/dev1990-overlay
    masters: gentoo
    priority: 50

stefantalpalaru
    location: /var/lib/layman/stefantalpalaru
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=skylake"
CHOST="x86_64-pc-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 /etc/terminfo /etc/vmware-installer"
CXXFLAGS="-O2 -pipe -march=skylake"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY 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"
FCFLAGS="-O2 -pipe -march=skylake"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles getbinpkg ipc-sandbox keepwork 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 -march=skylake"
GENTOO_MIRRORS="http://ftp.fi.muni.cz/pub/linux/gentoo/"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j21 -l4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="ssh://binpkg@172.16.14.8/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"
USE="X acl amd64 berkdb bzip2 cli crypt cups dbus dri elogind fortran gdbm gtk iconv ipv6 kerberos libglvnd libtirpc multilib ncurses networkmanager nls nptl openmp pam pcre python readline seccomp split-usr ssl tcpd truetype unicode xattr xinerama zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 sse sse2 sse3 sse4_1 sse4_2 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" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="keyboard libinput mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_7 python3_8 python3_9" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby26 ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="i965" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 4 Jan Krajdl 2021-05-21 08:35:18 UTC
Created attachment 710067 [details]
build.log
Comment 5 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2021-05-27 09:44:34 UTC
Can't reproduce and build log is not helpful for sure. Please provide gdb strace.
Comment 6 Jan Krajdl 2021-06-03 16:46:43 UTC
Ok, could you advice to gdb virgin what to do with it? :-) I have successfully run command and got backtrace, but I'm not sure if it's what you want. Backtrace below...

(gdb) run -t
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/bin/pkcs11-tool -t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff78f25e6 in ?? () from /usr/lib64/opensc-pkcs11.so
(gdb) bt
#0  0x00007ffff78f25e6 in ?? () from /usr/lib64/opensc-pkcs11.so
#1  0x00007ffff78ec6de in ?? () from /usr/lib64/opensc-pkcs11.so
#2  0x00007ffff78f727a in ?? () from /usr/lib64/opensc-pkcs11.so
#3  0x00007ffff78e6bea in ?? () from /usr/lib64/opensc-pkcs11.so
#4  0x00007ffff78e7198 in ?? () from /usr/lib64/opensc-pkcs11.so
#5  0x00007ffff78e1254 in C_Initialize () from /usr/lib64/opensc-pkcs11.so
#6  0x000055555555b3eb in ?? ()
#7  0x00007ffff79527fd in __libc_start_main () from /lib64/libc.so.6
#8  0x000055555555da3a in ?? ()
Comment 7 Alexander Tsoy 2022-05-06 17:29:19 UTC
I also had 100% reproducible segfaults in opensc-pkcs11.so and onepin-opensc-pkcs11.so when dev-libs/opensc-0.21.0-r1 was built with gcc-11. That prevented running firefox and evolution. Had no such problem with gcc-10. Updating to dev-libs/opensc-0.22.0 fixed this issue as well.