# mytop segfault

## funkoolow

salve a tutti,

da qualche tempo il pacchetto mytop, una sorta di clone di top per controllare le query su db mysql, ha smesso di funzionare sul mio sistema, uscendo all'invocazione di avvio con il seguente output:

```
# mytop

Useless use of private variable in void context at /usr/bin/mytop line 1001.

"my" variable $data masks earlier declaration in same scope at /usr/bin/mytop line 1035.

Errore di segmentazione

```

da quel poco che arrivo a capire, essendo mytop uno script Perl (il file in /usr/bin/mytop si legge tranquillamente con vi), ho provato a lanciare questi due comandi presi da https://wiki.gentoo.org/wiki/Perl per vedere se il problema fosse imboscato in qualche specie di sottodipendenza

```
root # emerge -uDNav --with-bdeps=y --backtrack=100 --autounmask-keep-masks=y @world

root # perl-cleaner --all 
```

ma anche dopo le varie ricompilazioni del caso il problema persiste.

Lo sviluppo del pacchetto sul sito ufficiale http://jeremy.zawodny.com/mysql/mytop sembra essere fermo al 2007, nessun altro ha lo stesso problema? oppure esiste un tool alternativo simile più recente?

grazie a tutti

----------

## fedeliallalinea

Prova ad installare la versione 1.9.1 applicando questa patch di debian

----------

## funkoolow

grazie per la veloce risposta,

ho applicato la patch suggerita lanciando questo comando da dentro /usr/bin/ e mettendo la patch su /tmp/:

```
patch -p1 < /tmp/10_fix_perl_warnings.patch
```

In effetti i due warning delle prime righe sono scomparsi, però il segfault finale rimane.

Ho anche provato a usare innotop (che sembra essere un tool simile più recente), ma anche lui da segfault, a questo punto penso sia evidentemente un problema più legato a Perl che al tool stesso...

Come è meglio procedere per il debug in questo caso?

grazie ancora

----------

## fedeliallalinea

Puoi usare gdb

```
$ gdb /usr/bin/perl

(gdb) run /usr/bin/mytop

(gdb) bt
```

e poi posti quello che torna dopo che hai lanciato bt (backtrace)

----------

## funkoolow

grazie di nuovo,

avevo letto di gdb per il debug ma passandogli direttamente mytop usciva con l'output "not in executable format: File format not recognized", segnalando giustamente che non si trattava di un file in binario (da lì avevo provato ad aprire direttamente il file scoprendo che in realtà si tratta di uno script Perl)

posto di seguito l'output ricavato secondo il tuo suggerimento

```
# gdb /usr/bin/perl

GNU gdb (Gentoo 8.1 p1) 8.1

Copyright (C) 2018 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 "i686-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/perl...(no debugging symbols found)...done.

(gdb) run /usr/bin/mytop

Starting program: /usr/bin/perl /usr/bin/mytop

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/libthread_db.so.1".

Useless use of private variable in void context at /usr/bin/mytop line 1001.

"my" variable $data masks earlier declaration in same scope at /usr/bin/mytop line 1035.

Program received signal SIGSEGV, Segmentation fault.

0xb731511c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0

(gdb) bt

#0  0xb731511c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0

#1  0xb75563f6 in my_aes_decrypt () from /usr/lib/libmysqlclient.so.18

#2  0xb75521eb in ?? () from /usr/lib/libmysqlclient.so.18

#3  0xb75527c4 in ?? () from /usr/lib/libmysqlclient.so.18

#4  0xb75529ec in my_search_option_files () from /usr/lib/libmysqlclient.so.18

#5  0xb7553406 in my_load_defaults () from /usr/lib/libmysqlclient.so.18

#6  0xb7512e14 in mysql_read_default_options () from /usr/lib/libmysqlclient.so.18

#7  0xb751a56d in mysql_real_connect () from /usr/lib/libmysqlclient.so.18

#8  0xb78a013c in mysql_dr_connect () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#9  0xb78a25ea in ?? () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#10 0xb78a26c7 in mysql_db_login () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#11 0xb78ade8c in ?? () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#12 0xb7e92b04 in Perl_pp_entersub () from /usr/lib/libperl.so.5.24

#13 0xb7e8b043 in Perl_runops_standard () from /usr/lib/libperl.so.5.24

#14 0xb7e12a02 in Perl_call_sv () from /usr/lib/libperl.so.5.24

#15 0xb78cfd13 in XS_DBI_dispatch () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBI/DBI.so

#16 0xb7e92b04 in Perl_pp_entersub () from /usr/lib/libperl.so.5.24

#17 0xb7e8b043 in Perl_runops_standard () from /usr/lib/libperl.so.5.24

#18 0xb7e1a6cb in perl_run () from /usr/lib/libperl.so.5.24

#19 0x00400a67 in main ()

(gdb) 

```

come si capisce a questo punto dov'è il problema?  :Embarassed: 

----------

## fedeliallalinea

Puoi postare l'output del comando emerge -pvq openssl?

----------

## funkoolow

```
# emerge -pvq openssl

[ebuild   R   ] dev-libs/openssl-1.0.2p-r1  USE="asm sslv3 tls-heartbeat zlib -bindist -gmp -kerberos -rfc3779 -sctp -sslv2 -static-libs -test -vanilla" CPU_FLAGS_X86="sse2"
```

----------

## fedeliallalinea

Puoi postare anche il tuo emerge --info?

----------

## funkoolow

certo, eccolo di seguito

```
# emerge --info

Portage 2.3.51 (python 3.5.5-final-0, default/linux/x86/17.0, gcc-7.3.0, glibc-2.27-r6, 4.14.52-gentoo i686)

=================================================================

System uname: Linux-4.14.52-gentoo-i686-Intel_Core_i7_9xx_-Nehalem_Class_Core_i7-with-gentoo-2.6

KiB Mem:     3110656 total,   1367036 free

KiB Swap:          0 total,         0 free

Timestamp of repository gentoo: Tue, 18 Dec 2018 01:15:01 +0000

Head commit of repository gentoo: 30a4b1c7507d8a8ac4cdf740c17d4e10a51effa3

sh bash 4.4_p12

ld ld di GNU (Gentoo 2.30 p5) 2.30.0

distcc 3.2rc1 i686-pc-linux-gnu [disabled]

ccache version 3.3.4 [disabled]

app-shells/bash:          4.4_p12::gentoo

dev-java/java-config:     2.2.0-r4::gentoo

dev-lang/perl:            5.24.3-r1::gentoo

dev-lang/python:          2.7.15::gentoo, 3.5.5::gentoo, 3.6.5::gentoo

dev-util/ccache:          3.3.4-r1::gentoo

dev-util/cmake:           3.9.6::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.6-r1::gentoo

sys-apps/openrc:          0.38.3-r1::gentoo

sys-apps/sandbox:         2.13::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.11.6-r3::gentoo, 1.15.1-r2::gentoo

sys-devel/binutils:       2.30-r4::gentoo

sys-devel/gcc:            7.3.0-r3::gentoo

sys-devel/gcc-config:     2.0::gentoo

sys-devel/libtool:        2.4.6-r3::gentoo

sys-devel/make:           4.2.1-r4::gentoo

sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)

sys-libs/glibc:           2.27-r6::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-verify-metamanifest: yes

    sync-rsync-verify-jobs: 1

    sync-rsync-verify-max-age: 24

    sync-rsync-extra-opts: 

x-portage

    location: /usr/local/portage

    masters: gentoo

    priority: 0

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="*"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/apache2-php7.0/ext-active/ /etc/php/apache2-php7.1/ext-active/ /etc/php/apache2-php7.2/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 -march=i686 -pipe"

FEATURES="assume-digests binpkg-logs clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -march=i686 -pipe"

GENTOO_MIRRORS="http://ftp.twaren.net/Linux/Gentoo/ http://ftp.lecl.net/pub/gentoo/ ftp://ftp.lecl.net/pub/gentoo/"

LANG="it_IT.UTF-8"

LC_ALL="it_IT.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="it"

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 acl alsa apache2 bash-completion berkdb bzip2 cli crypt curl cxx dri dvdread dvdv encode ffmpeg flac fortran ftp gd gdbm gif iconv ipv6 jpeg libtirpc libwww mmx mozilla mp3 mpeg mysql mysqli ncurses nls nptl ntfsprogs ogg openmp pam pcre pdf perl php png readline samba screen seccomp sse sse2 ssl svg svga tcpd theora tiff tty-helpers unicode vhosts vorbis win32codecs x86 xattr xvid zip zlib" ABI_X86="32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_core authn_dbd authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif slotmem_shm so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 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" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" RUBY_TARGETS="ruby23 ruby24" USERLAND="GNU" VIDEO_CARDS="intel vesa vga" 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_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

grazie ancora per la dedizione  :Smile: 

----------

## fedeliallalinea

Puoi dirmi esattamente che processore hai (in emerge --info vedo solo Core_i7_9xx)? Puoi anche postare l'output del comando gcc -march=native -v -E - < /dev/null 2>&1 | grep cc1

----------

## funkoolow

certo eccotelo qui di seguito:

```
# gcc -march=native -v -E - < /dev/null 2>&1 | grep cc1

 /usr/libexec/gcc/i686-pc-linux-gnu/7.3.0/cc1 -E -quiet -v - -march=nehalem -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=16384 -mtune=nehalem
```

riguardo il processore, ti posto l'output di cpuinfo (del primo di 4 core):

```
funkserver /home/funkoolow # cat /proc/cpuinfo 

processor   : 0

vendor_id   : GenuineIntel

cpu family   : 6

model      : 26

model name   : Intel Core i7 9xx (Nehalem Class Core i7)

stepping   : 3

microcode   : 0x1

cpu MHz      : 2266.746

cache size   : 16384 KB

physical id   : 0

siblings   : 1

core id      : 0

cpu cores   : 1

apicid      : 0

initial apicid   : 0

fdiv_bug   : no

f00f_bug   : no

coma_bug   : no

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 mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc xtopology cpuid pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt hypervisor lahf_lm

bugs      : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass

bogomips   : 4533.49

clflush size   : 64

cache_alignment   : 64

address sizes   : 40 bits physical, 48 bits virtual

power management:

```

una cosa che finora ho omesso (pensando non fosse utile) è che la gentoo in questione è virtualizzata in kvm, posto quindi anche l'output di cpuinfo della macchina fisica (che è una debian, anche il questo caso solo il primo di 16 core totali):

```
root@debian-kvm:/# cat /proc/cpuinfo 

processor   : 0

vendor_id   : GenuineIntel

cpu family   : 6

model      : 26

model name   : Intel(R) Xeon(R) CPU           L5520  @ 2.27GHz

stepping   : 5

microcode   : 0x15

cpu MHz      : 1639.960

cache size   : 8192 KB

physical id   : 0

siblings   : 8

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 pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm kaiser tpr_shadow vnmi flexpriority ept vpid dtherm ida

bugs      : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf

bogomips   : 4533.30

clflush size   : 64

cache_alignment   : 64

address sizes   : 40 bits physical, 48 bits virtual

power management:

```

grazie ancora  :Smile: 

----------

## fedeliallalinea

Anche innotop da segfault nello stesso modo di mytop (intendo con gdb)?

(prova ricompilare openssl e il pacchetto che contiene /usr/lib/libmysqlclient.so.18 (puoi risalire a questo con il comando [color=blue]equery belongs /usr/lib/libmysqlclient.so.18[/color).

----------

## funkoolow

ti confermo, anche innotop da esattamente lo stesso errore:

```

# gdb /usr/bin/perl

GNU gdb (Gentoo 8.1 p1) 8.1

Copyright (C) 2018 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 "i686-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/perl...(no debugging symbols found)...done.

(gdb) run /usr/bin/innotop

Starting program: /usr/bin/perl /usr/bin/innotop

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.

0xb723211c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0

(gdb) bt

#0  0xb723211c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0

#1  0xb74733f6 in my_aes_decrypt () from /usr/lib/libmysqlclient.so.18

#2  0xb746f1eb in ?? () from /usr/lib/libmysqlclient.so.18

#3  0xb746f7c4 in ?? () from /usr/lib/libmysqlclient.so.18

#4  0xb746f9ec in my_search_option_files () from /usr/lib/libmysqlclient.so.18

#5  0xb7470406 in my_load_defaults () from /usr/lib/libmysqlclient.so.18

#6  0xb742fe14 in mysql_read_default_options () from /usr/lib/libmysqlclient.so.18

#7  0xb743756d in mysql_real_connect () from /usr/lib/libmysqlclient.so.18

#8  0xb77bd13c in mysql_dr_connect () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#9  0xb77bf5ea in ?? () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#10 0xb77bf6c7 in mysql_db_login () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#11 0xb77cae8c in ?? () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBD/mysql/mysql.so

#12 0xb7e92b04 in Perl_pp_entersub () from /usr/lib/libperl.so.5.24

#13 0xb7e8b043 in Perl_runops_standard () from /usr/lib/libperl.so.5.24

#14 0xb7e12a02 in Perl_call_sv () from /usr/lib/libperl.so.5.24

#15 0xb78cfd13 in XS_DBI_dispatch () from /usr/lib/perl5/vendor_perl/5.24.3/i686-linux/auto/DBI/DBI.so

#16 0xb7e92b04 in Perl_pp_entersub () from /usr/lib/libperl.so.5.24

#17 0xb7e8b043 in Perl_runops_standard () from /usr/lib/libperl.so.5.24

#18 0xb7e1a4a1 in perl_run () from /usr/lib/libperl.so.5.24

#19 0x00400a67 in main ()

```

secondo equery dovrei ricompilare mysql-connector-c

```
# equery belongs /usr/lib/libmysqlclient.so.18

 * Searching for /usr/lib/libmysqlclient.so.18 ... 

dev-db/mysql-connector-c-6.1.11-r1 (/usr/lib/libmysqlclient.so.18.4.0)

dev-db/mysql-connector-c-6.1.11-r1 (/usr/lib/libmysqlclient.so.18 -> libmysqlclient.so.18.4.0)
```

ma anche dopo la ricompilazione il problema non si risolve.

Mi permetto un paio di considerazioni da assoluto incompetente:

1) visto che l'errore subito dopo il segfault in gdb è riferito a libcrypto (0xb723211c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0), ho provato a passare quel riferimento ad equery come fatto con libmysqlclient ma non ho ottenuto pacchetti da ricompilare, può essere rilevante in qualche modo?

2) anche la ricompilazione di openssl non produce il risultato sperato: può valere la pena a questo punto ricompilare da zero perl, mysql e relative dipendenze?

----------

## fedeliallalinea

 *funkoolow wrote:*   

> Mi permetto un paio di considerazioni da assoluto incompetente:
> 
> 1) visto che l'errore subito dopo il segfault in gdb è riferito a libcrypto (0xb723211c in EVP_CIPHER_CTX_init () from /usr/lib/libcrypto.so.1.0.0), ho provato a passare quel riferimento ad equery come fatto con libmysqlclient ma non ho ottenuto pacchetti da ricompilare, può essere rilevante in qualche modo?

 

Sembra che su questo bisogna indagare visto che libcrypto.so.1.0.0 dovrebbe essere installato con openssl

```
$ equery b /usr/lib/libcrypto.so.1.0.0

 * Searching for /usr/lib/libcrypto.so.1.0.0 ... 

dev-libs/openssl-1.0.2p-r1 (/usr/lib64/libcrypto.so.1.0.0)
```

Cosa dice il comando equery b openssl (lista tutti i file installati dal pacchetto openssl)?

----------

## funkoolow

ecco l'output di equery:

 *Quote:*   

> # equery b openssl
> 
>  * Searching for openssl ... 
> 
> dev-lang/ruby-2.3.8-r1 (/usr/lib/ruby/2.3.0/openssl)
> ...

 

nel frattempo ho ricompilato tutto mysql e perl con un emerge -ev perl mysql (circa 126 pacchetti) ma nulla di nuovo

----------

## funkoolow

scusami, ho ricontrollato e libcrypto restituisce effettivamente l'output che avevi previsto tu, credo di aver omesso il suffisso .so nella precedente query

 *Quote:*   

> 
> 
> # equery b /usr/lib/libcrypto
> 
>  * Searching for /usr/lib/libcrypto ... 
> ...

 

----------

## fedeliallalinea

Sucsa, il comando era equery f openssl ma abbiamo capito comunque che libcrypto.so.1.0.0  e' installato da openssl.

 *Quote:*   

> 2) anche la ricompilazione di openssl non produce il risultato sperato: può valere la pena a questo punto ricompilare da zero perl, mysql e relative dipendenze?

 

A questo punto prova anche questa soluzione perche' non ho piu' idee. Ho anche provato sulla mia macchina virtuale gentoo x86 ma non riesco a riprodurre l'errore

----------

## funkoolow

niente, anche ricompilando perl, mysql e cryptography (pacchetto più pacchetto meno...) il problema non si risolve.

a questo punto se sul tuo sistema non si riproduce l'errore, è evidentemente un problema legato al mio ambiente, ma non saprei proprio come procedere oltre, se non imparando a comprendere meglio l'output di gdb e bt... hai qualche suggerimento particolare in questo senso?

grazie in ogni caso del tuo tempo  :Smile: 

----------

## fedeliallalinea

Scusa ma sono proprio a corto di idee (magari provare un emerge -e @world?)

----------

## funkoolow

a questo punto penso anche io che possa essere l'ultima strada percorribile...

potresti solo postarmi l'output delle use flag delle dipendenze richieste da mytop (stando alla man page) sulla tua gentoo dove avevi testato il pacchetto?

 *Quote:*   

> REQUIREMENTS
> 
>        In order for mytop to function properly, you must have the following:
> 
>          * Perl 5.005 or newer
> ...

 

le mie sono qui di seguito:

```
# emerge -pv dev-lang/perl dev-perl/DBI dev-perl/DBD-mysql virtual/perl-Getopt-Long dev-perl/TermReadKey mytop dev-db/mysql

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] dev-lang/perl-5.24.3-r1:0/5.24::gentoo  USE="berkdb gdbm -debug -doc -ithreads" 0 KiB

[ebuild   R    ] dev-perl/DBI-1.637.0::gentoo  USE="-examples -test" 0 KiB

[ebuild   R    ] dev-perl/TermReadKey-2.370.0::gentoo  USE="-examples" 0 KiB

[ebuild   R    ] virtual/perl-Getopt-Long-2.480.0-r1::gentoo  0 KiB

[ebuild   R    ] dev-perl/DBD-mysql-4.44.0::gentoo  USE="ssl -test" 0 KiB

[ebuild   R   ~] dev-db/mytop-1.9.1::gentoo  0 KiB

[ebuild   R    ] dev-db/mysql-5.7.24:0/18::gentoo  USE="perl server -cjk (-client-libs) -cracklib -debug -experimental -jemalloc -latin1 -libressl -numa -profiling (-selinux) -static -static-libs -systemtap -tcmalloc -test -yassl" 0 KiB

Total: 8 packages (8 reinstalls), Size of downloads: 0 KiB
```

```
# equery u dev-lang/perl dev-perl/DBI dev-perl/DBD-mysql virtual/perl-Getopt-Long dev-perl/TermReadKey mytop dev-db/mysql

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for dev-lang/perl-5.24.3-r1:

 U I

 + + berkdb   : Add support for sys-libs/db (Berkeley DB for MySQL)

 - - debug    : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces

 - - doc      : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally

 + + gdbm     : Add support for sys-libs/gdbm (GNU database libraries)

 - - ithreads : Enable Perl threads, has some compatibility problems

 * Found these USE flags for dev-perl/DBI-1.637.0:

 U I

 - - examples : Install examples, usually source code

 - - test     : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

 * Found these USE flags for dev-perl/DBD-mysql-4.44.0:

 U I

 + + ssl  : Compile in support for SSL connections via libmysqlclient

 - - test : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

!!! No USE flags found for virtual/perl-Getopt-Long-2.480.0-r1

 * Found these USE flags for dev-perl/TermReadKey-2.370.0:

 U I

 - - examples : Install examples, usually source code

!!! No USE flags found for dev-db/mytop-1.9.1

 * Found these USE flags for dev-db/mysql-5.7.24:

 U I

 - - cjk          : Add CJK support for InnoDB fulltext search using app-text/mecab

 - - cracklib     : Support for cracklib strong password checking

 - - debug        : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces

 - - experimental : Build experimental features aka "rapid" plugins

 - - jemalloc     : Use dev-libs/jemalloc for memory management

 - - latin1       : Use LATIN1 encoding instead of UTF8

 - - libressl     : Enable SSL connections and crypto functions using dev-libs/libressl

 - - numa         : Enable NUMA support using sys-process/numactl (NUMA kernel support is also required)

 + + perl         : Add optional support/bindings for the Perl language

 - - profiling    : Add support for statement profiling (requires USE=community).

 + + server       : Build the server program

 - - static       : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically

 - - static-libs  : Build static versions of dynamic libraries as well

 - - systemtap    : Build support for profiling and tracing using dev-util/systemtap

 - - tcmalloc     : Use the dev-util/google-perftools libraries to replace the malloc() implementation with a possibly faster one

 - - test         : Install upstream testsuites for end use.

 - - yassl        : Enable SSL connections and crypto functions using the bundled yaSSL

```

grazie per l'ennesima volta  :Smile: 

----------

## fedeliallalinea

Certo eccolo (ora ho disinstallato il programma e dipendenze)

```
# emerge -pvq dev-lang/perl dev-perl/DBI dev-perl/DBD-mysql virtual/perl-Getopt-Long dev-perl/TermReadKey mytop dev-db/mysql 

[ebuild  N    ] dev-libs/libaio-0.3.110  USE="-static-libs -test" 

[ebuild   R   ] dev-lang/perl-5.24.3-r1  USE="berkdb gdbm -debug -doc -ithreads" 

[ebuild  N    ] dev-libs/protobuf-3.6.1  USE="zlib -emacs -examples -static-libs -test" 

[ebuild  N    ] dev-libs/libevent-2.1.8  USE="ssl threads -debug -libressl -static-libs -test" 

[ebuild  N    ] app-crypt/rhash-1.3.6-r1  USE="nls ssl -debug -libressl -static-libs" 

[ebuild   R   ] virtual/perl-Getopt-Long-2.480.0-r1 

[ebuild   R   ] dev-perl/TermReadKey-2.370.0  USE="-examples" 

[ebuild  N    ] dev-db/mysql-init-scripts-2.2-r3 

[ebuild  N    ] app-arch/libarchive-3.3.1  USE="acl bzip2 e2fsprogs iconv lzma threads xattr zlib -expat -libressl -lz4 -lzo -nettle -static-libs" 

[ebuild  N    ] dev-perl/Net-Daemon-0.480.0-r2 

[ebuild  N    ] virtual/perl-Storable-2.560.100_rc-r4 

[ebuild  N    ] virtual/perl-Sys-Syslog-0.330.100_rc-r6 

[ebuild  N    ] virtual/perl-Time-HiRes-1.974.100-r2 

[ebuild  N    ] virtual/perl-Term-ANSIColor-4.40.0-r1 

[ebuild  N    ] dev-util/cmake-3.9.6  USE="ncurses -doc -emacs -qt5 -server -system-jsoncpp -test" 

[ebuild  N    ] dev-perl/PlRPC-0.202.0-r3 

[ebuild  N    ] dev-db/mysql-connector-c-6.1.11-r1  USE="-libressl -static-libs" 

[ebuild  N    ] dev-perl/DBI-1.637.0  USE="-examples -test" 

[ebuild  N    ] app-arch/lz4-1.8.2  USE="-static-libs" 

[ebuild  N    ] virtual/libmysqlclient-18  USE="-static-libs" 

[ebuild  N    ] dev-perl/DBD-mysql-4.44.0  USE="ssl -test" 

[ebuild  N    ] dev-db/mytop-1.6-r4 

[ebuild  N    ] dev-db/mysql-5.7.24  USE="perl server -cjk (-client-libs) -cracklib -debug -experimental -jemalloc -latin1 -libressl -numa -profiling (-selinux) -static -static-libs -systemtap -tcmalloc -test -yassl"  
```

```
# emerge -pvq mytop

[ebuild  N    ] dev-perl/Net-Daemon-0.480.0-r2 

[ebuild  N    ] virtual/perl-Storable-2.560.100_rc-r4 

[ebuild  N    ] virtual/perl-Sys-Syslog-0.330.100_rc-r6 

[ebuild  N    ] app-crypt/rhash-1.3.6-r1  USE="nls ssl -debug -libressl -static-libs" 

[ebuild  N    ] virtual/perl-Time-HiRes-1.974.100-r2 

[ebuild  N    ] virtual/perl-Term-ANSIColor-4.40.0-r1 

[ebuild  N    ] dev-perl/PlRPC-0.202.0-r3 

[ebuild  N    ] app-arch/libarchive-3.3.1  USE="acl bzip2 e2fsprogs iconv lzma threads xattr zlib -expat -libressl -lz4 -lzo -nettle -static-libs" 

[ebuild  N    ] dev-perl/DBI-1.637.0  USE="-examples -test" 

[ebuild  N    ] dev-util/cmake-3.9.6  USE="ncurses -doc -emacs -qt5 -server -system-jsoncpp -test" 

[ebuild  N    ] dev-db/mysql-connector-c-6.1.11-r1  USE="-libressl -static-libs" 

[ebuild  N    ] virtual/libmysqlclient-18  USE="-static-libs" 

[ebuild  N    ] dev-perl/DBD-mysql-4.44.0  USE="ssl -test" 

[ebuild  N    ] dev-db/mytop-1.6-r4 
```

----------

## funkoolow

a occhio le useflag mi sembrano uguali, nel dubbio ho provato a ricompilare da zero solo i pacchetti in causa ma non è servito... tento il tutto per tutto

```
# emerge -eav @world

...

...

Total: 890 packages (4 upgrades, 886 reinstalls), Size of downloads: 8518 KiB

```

se non va neanche così non so veramente più che fare nemmeno io  :Embarassed: 

----------

## funkoolow

nonostante la ricompilazione di 888 pacchetti, il problema continua a persistere. Durante la (lunga) attesa ho un pò googlato i vari output del mio errore, ad esempio cercando l'output del mio dmesg:

```
 # mytop

Errore di segmentazione

# dmesg -e

[dic24 11:52] mytop[20988]: segfault at 0 ip b72e211c sp bf9501d8 error 6 in libcrypto.so.1.0.0[b7220000+1e0000]
```

ho trovato un caso simile segnalato come bug su debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=665836

in quel caso si tratta di sshd, il segnalatore riporta che eseguendo un downgrade di openssl il problema sembra risolversi, il prossimo tentativo che farò dunque sarà mascherare la 1.0.2p-r1 di openssl in favore della 0.9.8z_p8-r1 ed eseguire un downgrade seguendo le istruzioni di questo post:

https://forums.gentoo.org/viewtopic-t-848055-highlight-libcrypto.html

potrebbe in ogni caso valere la pena segnalare anche questo come bug al mantainer dell'ebuild gentoo? come si deve procedere in caso (non ho mai avuto il piacere finora)?

----------

## fedeliallalinea

Dubito che il problema sia di openssl-1.0.x e anche il bug che hai trovato e' comunque di 6 anni fa.

Quello che ti consiglio di fare se hai un po' di dimestichezza con l'inglese e' aprire un thread nel forum internazionale.

----------

