emerge -pv dev-libs/libgcrypt [ebuild R ] dev-libs/libgcrypt-1.7.8:0/20::gentoo USE="-doc -static-libs" ABI_X86="32 (64) (-x32)" 0 KiB emerge --info Portage 2.3.6 (python 2.7.12-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-5.4.0, glibc-2.23-r4, 4.9.34-gentoo x86_64) ================================================================= System uname: Linux-4.9.34-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_750_@_2.67GHz-with-gentoo-2.3 KiB Mem: 12300084 total, 2774112 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Tue, 29 Aug 2017 15:30:01 +0000 sh bash 4.3_p48-r1 ld GNU ld (Gentoo 2.28 p1.2) 2.28 app-shells/bash: 4.3_p48-r1::gentoo dev-java/java-config: 2.2.0-r3::gentoo dev-lang/perl: 5.24.1-r2::gentoo dev-lang/python: 2.7.12::gentoo, 3.4.5::gentoo dev-util/cmake: 3.7.2::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.3::gentoo sys-apps/openrc: 0.28::gentoo sys-apps/sandbox: 2.10-r3::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo sys-devel/automake: 1.11.6-r1::gentoo, 1.15-r2::gentoo sys-devel/binutils: 2.28-r2::gentoo sys-devel/gcc: 5.4.0-r3::gentoo sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6-r3::gentoo sys-devel/make: 4.2.1::gentoo sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers) sys-libs/glibc: 2.23-r4::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 x-portage location: /usr/local/portage masters: gentoo priority: 0 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=corei7 -funroll-loops -pipe" 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/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -march=corei7 -funroll-loops -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/" LANG="ru_RU.utf8" LC_ALL="ru_RU.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" 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" USE="X a52 aac acl acpi activities alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm iconv jack jpeg kde kipi kwallet lcms ldap libnotify mad mng modules mp3 mp4 mpeg multilib nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl phonon plasma png policykit ppds pulseaudio python qml qt3support qt4 qt5 readline samba sdl seccomp semantic-desktop session slang spell ssl startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb vorbis widgets wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" QEMU_SOFTMMU_TARGETS="i386 x86_64" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia nv noveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS ------------------- Simple test code. ------------------- #include <stdio.h> #include <gcrypt.h> void main(void){ gcry_error_t gcryError; gcryError = gcry_control(GCRYCTL_PRINT_CONFIG,stdout); gcry_control(GCRYCTL_SET_VERBOSITY, 10); printf("--\n\n"); gcryError = gcry_control(GCRYCTL_SELFTEST); printf("----\n\n"); if (gcryError){ printf("gcry_control failed: %s/%s\n", gcry_strsource(gcryError), gcry_strerror(gcryError)); } } ------------------ Result of execution with library built with CFLAGS="O2 ...": -- version:1.7.8: ciphers:arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia:idea:salsa20:gost28147:chacha20: pubkeys:dsa:elgamal:rsa:ecc: digests:crc:gostr3411-94::md4:md5:rmd160:sha1:sha256:sha512:sha3:tiger:whirlpool:stribog: rnd-mod:linux: cpu-arch:x86: mpi-asm:amd64/mpih-add1.S:amd64/mpih-sub1.S:amd64/mpih-mul1.S:amd64/mpih-mul2.S:amd64/mpih-mul3.S:amd64/mpih-lshift.S:amd64/mpih-rshift.S: hwflist: fips-mode:y:n: rng-type:fips:2: -- libgcrypt selftest: cipher 3DES (2): Okay selftest for CTR failed - see syslog for details Segmentation fault -------- Syslog entry: Aug 29 18:45:42 xxx self.out[8920]: Libgcrypt warning: AES-CTR-128 test failed (plaintext mismatch) -------- Result of execution with library optimization CFLAGS="O1 ..." or CFLAGS="O0 ...": -- version:1.7.8: ciphers:arcfour:blowfish:cast5:des:aes:twofish:serpent:rfc2268:seed:camellia:idea:salsa20:gost28147:chacha20: pubkeys:dsa:elgamal:rsa:ecc: digests:crc:gostr3411-94::md4:md5:rmd160:sha1:sha256:sha512:sha3:tiger:whirlpool:stribog: rnd-mod:linux: cpu-arch:x86: mpi-asm:amd64/mpih-add1.S:amd64/mpih-sub1.S:amd64/mpih-mul1.S:amd64/mpih-mul2.S:amd64/mpih-mul3.S:amd64/mpih-lshift.S:amd64/mpih-rshift.S: hwflist: fips-mode:y:n: rng-type:fips:2: -- libgcrypt selftest: cipher 3DES (2): Okay libgcrypt selftest: cipher AES (7): Okay libgcrypt selftest: cipher AES192 (8): Okay libgcrypt selftest: cipher AES256 (9): Okay libgcrypt selftest: digest SHA1 (2): Okay libgcrypt selftest: digest SHA224 (11): Okay libgcrypt selftest: digest SHA256 (8): Okay libgcrypt selftest: digest SHA384 (9): Okay libgcrypt selftest: digest SHA512 (10): Okay libgcrypt selftest: digest HMAC-SHA1 (2): Okay libgcrypt selftest: digest HMAC-SHA224 (11): Okay libgcrypt selftest: digest HMAC-SHA256 (8): Okay libgcrypt selftest: digest HMAC-SHA384 (9): Okay libgcrypt selftest: digest HMAC-SHA512 (10): Okay libgcrypt selftest: digest HMAC-SHA3-224 (312): Okay libgcrypt selftest: digest HMAC-SHA3-256 (313): Okay libgcrypt selftest: digest HMAC-SHA3-384 (314): Okay libgcrypt selftest: digest HMAC-SHA3-512 (315): Okay libgcrypt selftest: random (0): Okay libgcrypt selftest: pubkey RSA (1): Okay libgcrypt selftest: pubkey DSA (17): Okay libgcrypt selftest: pubkey ECC (18): Okay ----
This issue belongs upstream, please report it on https://dev.gnupg.org
Incidentally, CFLAGS="-O2 -pipe -march=native" works fine here, so -O2 itself is likely not the cause, please investigate other CFLAG combinations(In reply to Kristian Fiskerstrand from comment #1) > This issue belongs upstream, please report it on https://dev.gnupg.org I've just tried building various various versions of libgcrypt on amd64 using CFLAGS including -funroll-loops and -O2 and not reproducing it. Could you get a core dump and a gdb backtrace of the segfault reported to see whats going on? Also, before reporting upstream, please verify if the issue still persists in 1.8.1
(In reply to Kristian Fiskerstrand from comment #2) > Incidentally, CFLAGS="-O2 -pipe -march=native" works fine here, so -O2 > itself is likely not the cause, please investigate other CFLAG > combinations(In reply to Kristian Fiskerstrand from comment #1) > > This issue belongs upstream, please report it on https://dev.gnupg.org > > I've just tried building various various versions of libgcrypt on amd64 > using CFLAGS including -funroll-loops and -O2 and not reproducing it. Could > you get a core dump and a gdb backtrace of the segfault reported to see > whats going on? > > Also, before reporting upstream, please verify if the issue still persists > in 1.8.1 While at it, might also want to try latest libgpg-error just to rule out any issues there
Created attachment 491140 [details] dev-libs/libgcrypt self_test segfault coredump
(In reply to Kristian Fiskerstrand from comment #2) > Incidentally, CFLAGS="-O2 -pipe -march=native" works fine here, so -O2 > itself is likely not the cause, please investigate other CFLAG > combinations(In reply to Kristian Fiskerstrand from comment #1) > > This issue belongs upstream, please report it on https://dev.gnupg.org > > I've just tried building various various versions of libgcrypt on amd64 > using CFLAGS including -funroll-loops and -O2 and not reproducing it. Could > you get a core dump and a gdb backtrace of the segfault reported to see > whats going on? Results for versioni 1.7.8 CFLAGS="-O2 -march=corei7 -funroll-loops -pipe -g" - segfault CFLAGS="-O2 -funroll-loops -pipe -g" - segfault CFLAGS="-O2 -march=native -funroll-loops -pipe -g" - segfault CFLAGS="-O2 -march=corei7 -pipe -g" - ok CFLAGS="-O2 -march=native -pipe -g" - ok CFLAGS="-O1 -march=corei7 -funroll-loops -pipe -g" - ok CFLAGS="-O0 -march=corei7 -funroll-loops -pipe -g" - ok --------- Backtrace for CFLAGS="-O2 -march=corei7 -funroll-loops -pipe -g": libgcrypt selftest: cipher 3DES (2): Okay selftest for CTR failed - see syslog for details Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007ffff7ad7c62 in rijndael_encrypt ( a=0x7ffff7b9d200 <plaintext_128> "\001K\257\"x\246\235\063\035Q\200\020\066C\351\232\350\351\352\353\355\356\357\360\362\363\364\365\367\370\371\372\001", b=0x7fffffffd870 "\177\353\273\367\377\177", context=0x6025d0) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/cipher/rijndael.c:775 #2 selftest_basic_128 () at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/cipher/rijndael.c:1526 #3 0x00007ffff7ad7f29 in selftest_fips_128 (report=0x7ffff7a9d190 <reporter>, extended=1) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/cipher/rijndael.c:1842 #4 run_selftests (algo=<optimized out>, extended=1, report=0x7ffff7a9d190 <reporter>) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/cipher/rijndael.c:1924 #5 0x00007ffff7aa188e in _gcry_cipher_selftest (algo=algo@entry=7, extended=extended@entry=1, report=report@entry=0x7ffff7a9d190 <reporter>) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/cipher/cipher.c:1587 #6 0x00007ffff7a9d94b in run_cipher_selftests (extended=<optimized out>) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/src/fips.c:470 #7 _gcry_fips_run_selftests (extended=extended@entry=1) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/src/fips.c:689 #8 0x00007ffff7a9533b in _gcry_vcontrol (cmd=<optimized out>, arg_ptr=arg_ptr@entry=0x7fffffffd960) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/src/global.c:575 #9 0x00007ffff7a91469 in gcry_control (cmd=<optimized out>) at /var/tmp/portage/dev-libs/libgcrypt-1.7.8/work/libgcrypt-1.7.8/src/visibility.c:79 #10 0x0000000000400708 in main () at self_tests.c:13 ---------- coredump in previous message ---------- > Also, before reporting upstream, please verify if the issue still persists > in 1.8.1 Works fine with CFLAGS="-O2 -march=corei7 -funroll-loops -pipe -g"
(In reply to tek from comment #5) > coredump in previous message Thanks for the details > ---------- > > Also, before reporting upstream, please verify if the issue still persists > > in 1.8.1 > Works fine with CFLAGS="-O2 -march=corei7 -funroll-loops -pipe -g" 1.8.1 is going stable in bug 629160 already so that mitigates issue somehow in Gentoo. But does this mean that CFLAGS="-O2 -funroll-loops -pipe -g" CFLAGS="-O2 -march=native -funroll-loops -pipe -g" .. still segfault for 1.8.1? I'm wondering, are you using any new/special CPU? Could it be a matter of the supported set of features provided not matching etc?
(In reply to Kristian Fiskerstrand from comment #6) > (In reply to tek from comment #5) > > coredump in previous message > > Thanks for the details > > > ---------- > > > Also, before reporting upstream, please verify if the issue still persists > > > in 1.8.1 > > Works fine with CFLAGS="-O2 -march=corei7 -funroll-loops -pipe -g" > > 1.8.1 is going stable in bug 629160 already so that mitigates issue somehow > in Gentoo. But does this mean that > CFLAGS="-O2 -funroll-loops -pipe -g" > CFLAGS="-O2 -march=native -funroll-loops -pipe -g" > > .. still segfault for 1.8.1? > > I'm wondering, are you using any new/special CPU? Could it be a matter of > the supported set of features provided not matching etc? Version 1.8.1 works fine with all combinations of optimization flags: CFLAGS="-O2 -march=native -funroll-loops -pipe -g" - ok CFLAGS="-O2 -funroll-loops -pipe -g" - ok CPU is rather old i5: cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 30 model name : Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz stepping : 5 microcode : 0x3 cpu MHz : 2668.000 cache size : 8192 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept vpid dtherm ida bugs : bogomips : 5355.25 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management:
(In reply to tek from comment #7) > Version 1.8.1 works fine with all combinations of optimization flags: Ok, then I'm closing the bug as this is already going stable > CPU is rather old i5: > cat /proc/cpuinfo Isn't -march=corei7 anyways wrong and can expose features the CPU doesn't handle in this case?