Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 696854 - dev-libs/libffi-3.3_rc0 fails test in x86_32
Summary: dev-libs/libffi-3.3_rc0 fails test in x86_32
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks:
 
Reported: 2019-10-06 16:16 UTC by Alexey
Modified: 2019-11-06 00:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (file_696854.txt,19.32 KB, text/plain)
2019-10-06 16:16 UTC, Alexey
Details
build.log (build.log.bz2,47.89 KB, application/x-bzip)
2019-10-06 16:17 UTC, Alexey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey 2019-10-06 16:16:26 UTC
Created attachment 591984 [details]
emerge --info

=== libffi Summary ===

# of expected passes            6744
# of unexpected failures        712
Comment 1 Alexey 2019-10-06 16:17:10 UTC
Created attachment 591986 [details]
build.log
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-10-06 21:40:06 UTC
> CFLAGS="-O2 -pipe -march=bdver2 -ggdb3"

Do tests work if you use CFLAGS="-O2 -pipe -ggdb3"?

"""
Testing test-call.c, -W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL
__
options: {additional_flags=-W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FA
STCALL__ } {additional_flags=-I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/li
bffi-3.3-rc0/testsuite/../include  -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include/..} additional_flags=-L/mnt/portagetmp/portage/dev-
libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../.libs {libs= -lffi}
doing compile
pid is 3918 -3918
pid is -1
output is  status 0
PASS: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__ (test for excess errors)
spawning command ./test-call.exe
exp9 file6
close result is child killed: SIGABRT
FAIL: libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__ execution test
"""

The test fails with 'SIGABRT'. Can you get a backtrace from that particular failure?
Comment 3 Alexey 2019-10-07 19:53:43 UTC
Removing -march=bdver2 doesn't fix it.

Can you advise how to get a backtrace from it? I can't find the compiled test to run with gdb. So I tried to compile it manually via:
# i686-pc-linux-gnu-clang libffi.bhaible/test-call.c -W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__ -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/../include  -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include/.. -L/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../.libs -lffi
warning: unknown warning option '-Wno-psabi' [-Wunknown-warning-option]
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
2 warnings generated.
(I used clang instead of gcc since I couldn't find the right combination of flags to pass there)

# sudo -u nobody ./a.out
long long f(float,long long,int):(1.4,0x35c6f707fffffffa,0xe)->0x35c6f70800000009
long long f(float,long long,int):(1.4,0x35c6f707fffffffa,0x0)->0x35c6f707fffffffb
Аварийный останов

# sudo -u nobody gdb ./a.out                                                                                                                                                              
GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 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 ./a.out...
(gdb) run
Starting program: /mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/./a.out
During startup program exited with code 1.
(gdb) bt full
No stack.
(gdb)
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-10-20 09:16:16 UTC
If you use 'ulimit -c unlimited' in the shell you are running a.out you should get core file generated. gdb can load it as-is without the need to rerun the tool: 'gdb ./a.out core'.

I suggest trying to reproduce the failure using the same toolchain that causes the crash (both should work though).
Comment 5 Alexey 2019-10-20 09:19:36 UTC
The problem is that I found no a.out so I had to guess what was used to build it, by copypasting some random flags from logs to compiler. Do you know some way to preserve a.out run by emerge instead of compiling my own?
Comment 6 Alexey 2019-10-20 09:21:47 UTC
Or, rather, I found no ./test-call.exe to execute, since it uses a better name there than the default a.out
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2019-10-20 16:13:23 UTC
Testsuite runs all tests under a single executable and is very eager to clear it's output. I don't see an easy way to get existing binary.

But I found a way to extract exact build command: you can go to build dir (for me it's  /tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86)

and run
  $ make check RUNTESTFLAGS='-v -v'

That would print something like:

"""
Executing on host: x86_64-pc-linux-gnu-gcc -m32 /tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/libffi.bhaible/test-call.c   -W -Wall -Wno-psabi -DDGTEST=1 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -Os -DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__  -I/tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include -I/tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/../include  -I/tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include/.. -L/tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../.libs  -lffi -lm  -o ./test-call.exe    (timeout = 300)
"""

But be careful: to run that command against local libffi you need to pass LD_LIBRARY_PATH to it's directory:

in /tmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86
  $ LD_LIBRARY_PATH=./.libs ./test-call.exe
Comment 8 Alexey 2019-10-21 21:01:49 UTC
$ x86_64-pc-linux-gnu-gcc -m32 /mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/libffi.bhaible/test-call.c   -W -Wall -Wno-psabi -DDGTEST=27 -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-uninitialized -O0 -DA
BI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__  -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include -I/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0/testsuite/../include  -I/mnt/portagetmp/portage/dev-l
ibs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../include/.. -L/mnt/portagetmp/portage/dev-libs/libffi-3.3_rc0/work/libffi-3.3-rc0-abi_x86_32.x86/testsuite/../.libs  -lffi -lm  -o ./test-call.exe

$ LD_LIBRARY_PATH=./.libs ./test-call.exe                                                                                                                                                                                                                                   
long long f(float,long long,int):(1.4,0x35c6f707fffffffa,0xe)->0x35c6f70800000009                                                                                                                                                                                                 
long long f(float,long long,int):(1.4,0x35c6f707fffffffa,0x5659339a)->0x35c6f70856593395
Aborted (core dumped)

$ gdb ./test-call.exe core 
GNU gdb (Gentoo 8.3 vanilla) 8.3
Copyright (C) 2019 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 ./test-call.exe...
[New LWP 20604]
Core was generated by `./test-call.exe'.
Program terminated with signal SIGABRT, Aborted.
#0  0xf7f0fb59 in __kernel_vsyscall ()
(gdb) bt full
#0  0xf7f0fb59 in __kernel_vsyscall ()
No symbol table info available.
#1  0xf7c10a6a in __libc_signal_restore_set (set=0xffd6d53c) at ../sysdeps/unix/sysv/linux/internal-signals.h:84
        resultvar = <optimized out>
#2  __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:48
        set = {__val = {0, 0, 1448711272, 4292269768, 0, 4292269436, 1448727776, 4294967295, 1448727776, 4159941232, 1448711272, 4292269768, 1448727776, 0, 1, 4159940880, 4222451713, 1448727776, 4159807884, 4156506539, 1448686745, 1448727844, 4159807884, 4156506539, 
            1448686745, 0, 1448686665, 0, 0, 4292270008, 0, 4292269680}}
        pid = <optimized out>
        tid = <optimized out>
        ret = 0
#3  0xf7bf92b6 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0xffd6d7b8, sa_sigaction = 0xffd6d7b8}, sa_mask = {__val = {1, 0, 1448686665, 1448726540, 1, 0, 1448686621, 1448726576, 4159833464, 1448686621, 4159940880, 4292269908, 4159941324, 4159944992, 1, 1, 0, 4156817971, 
              1448726528, 4159938488, 1448686408, 4292270008, 4156751570, 4159833289, 4156450100, 4292270024, 902231816, 4159833289, 1448726528, 4292270024, 902231816, 4292270008}}, sa_flags = -135110016, sa_restorer = 0xfffffd28}
        sigs = {__val = {32, 0 <repeats 31 times>}}
#4  0x56594358 in _fprintf ()
No symbol table info available.
#5  0x56598000 in mixed_number_tests ()
No symbol table info available.
#6  0x56598186 in main ()
No symbol table info available.
(gdb)
Comment 9 Larry the Git Cow gentoo-dev 2019-11-06 00:03:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d857bd00624d0922c870136f5f5684bc8af6be79

commit d857bd00624d0922c870136f5f5684bc8af6be79
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2019-11-06 00:02:48 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2019-11-06 00:02:48 +0000

    dev-libs/libffi: bump up to 3.3_rc2
    
    Most interesting fix is x86 stack alignment fix.
    This decreases flakiness in test failures on 32-bit x86
    but does not eliminate all failures.
    
    While at it moved out most heavyweight tests to USE=test-bhaible.
    
    Reported-by: Alexey
    Reported-by: Toralf Förster
    Reported-by:  tka
    Closes: https://bugs.gentoo.org/696854
    Closes: https://bugs.gentoo.org/688466
    Closes: https://bugs.gentoo.org/698506
    Package-Manager: Portage-2.3.78, Repoman-2.3.17
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 dev-libs/libffi/Manifest              |  1 +
 dev-libs/libffi/libffi-3.3_rc2.ebuild | 70 +++++++++++++++++++++++++++++++++++
 dev-libs/libffi/metadata.xml          |  1 +
 3 files changed, 72 insertions(+)