[pkg-gnupg-maint] Bug#858400: gnupg2 2.1.19-3 fails to build on s390x with segfault in xcheck

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Mar 22 03:47:03 UTC 2017


Control: retitle 858400 gpgscm fails on s390x due to new vector representation
Control: tags 858400 + upstream

On Tue 2017-03-21 19:10:53 -0400, Daniel Kahn Gillmor wrote:
> On Tue 2017-03-21 17:32:27 -0400, Daniel Kahn Gillmor wrote:
>> but since the upgrade to 2.1.19-3 in experimental, we're seeing the the
>> segfault on s390x.

I've just done git bisect on the upstream git history from within the
sid chroot on zelenka.

gnupg-2.1.18 runs the test suite fine on this arch, and 2.1.19 has
intermittent failures.

git bisect identifies the "first bad commit" as:

commit 49e2ae65e892f93be7f87cfaae3392b50a99e4b1
Author: Justus Winter <justus at g10code.com>
Date:   Mon Jan 30 15:51:19 2017 +0100

    gpgscm: Use a compact vector representation.
    
    * tests/gpgscm/scheme-private.h (struct cell): Add a compact vector
    representation.
    * tests/gpgscm/scheme.c (vector_length): Use new representation.
    (vector_size): New macro.
    (get_vector_object): Use the new representation.
    (fill_vector): Likewise.
    (vector_elem): Likewise.
    (set_vector_elem): Likewise.
    (mark): Likewise.
    (gc): Likewise.  Be careful not to confuse immediate values for type
    flags.
    (finalize_cell): Vectors now require finalization.
    --
    
    Previously, vectors were represented using consecutive cons cells,
    wasting one word per cell for the type information.  Fix that by using
    a flat array.
    
    Previously, a vector of size N required 1 + (n + 1) / 2 cells.  Now it
    uses 1 + (n - 1 + 2) / 3 cells.
    
    Signed-off-by: Justus Winter <justus at g10code.com>



To test it during each step of the bisect, i did:

 (cd build && make -j2)
 (cd build/tests/gpgscm && for x in $(seq 1 100); do
    EXEEXT= GPGSCM_PATH=../../../tests/gpgscm  ./gpgscm ../../../tests/gpgscm/t-child.scm
    ret=$?
    if [ "$ret" != 0 ]; then
       printf 'failed %d\n' "$ret"
       exit "$ret"
    fi
   done)

At this commit, i used gdb to get a backtrace:

0 (sid_s390x-dchroot)dkg at zelenka:~/src/gnupg2/gnupg2/build/tests/gpgscm$ EXEEXT= GPGSCM_PATH=../../../tests/gpgscm gdb ./gpgscm
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 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 "s390x-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 ./gpgscm...done.
(gdb) run ../../../tests/gpgscm/t-child.scm
Starting program: /home/dkg/src/gnupg2/gnupg2/build/tests/gpgscm/gpgscm ../../../tests/gpgscm/t-child.scm

Program received signal SIGSEGV, Segmentation fault.
oblist_find_by_name (name=name at entry=0x2aaaaaef930 "if", sc=<optimized out>, sc=<optimized out>) at ../../../tests/gpgscm/scheme.c:1132
1132        if(stricmp(name, s) == 0) {
(gdb) bt
#0  oblist_find_by_name (name=name at entry=0x2aaaaaef930 "if", sc=<optimized out>, sc=<optimized out>) at ../../../tests/gpgscm/scheme.c:1132
#1  0x000002aaaaabd7b4 in mk_symbol (sc=sc at entry=0x2aaaaaed6f0, name=0x2aaaaaef930 "if") at ../../../tests/gpgscm/scheme.c:1372
#2  0x000002aaaaabe7e2 in mk_atom (sc=sc at entry=0x2aaaaaed6f0, q=<optimized out>) at ../../../tests/gpgscm/scheme.c:1483
#3  0x000002aaaaac0610 in opexe_5 (sc=0x2aaaaaed6f0, op=<optimized out>) at ../../../tests/gpgscm/scheme.c:4948
#4  0x000002aaaaabe168 in Eval_Cycle (sc=sc at entry=0x2aaaaaed6f0, op=op at entry=OP_T0LVL) at ../../../tests/gpgscm/scheme.c:5331
#5  0x000002aaaaac5eee in scheme_load_named_file (sc=0x2aaaaaed6f0, fin=0x2aaaab48d70, filename=0x2aaaab48b60 "../../../tests/gpgscm/init.scm") at ../../../tests/gpgscm/scheme.c:5723
#6  0x000002aaaaab1dd2 in load (sc=0x2aaaaaed6f0, file_name=0x2aaaaad432c "init.scm", lookup_in_cwd=<optimized out>, lookup_in_path=1) at ../../../tests/gpgscm/main.c:180
#7  0x000002aaaaab181a in main (argc=<optimized out>, argv=<optimized out>) at ../../../tests/gpgscm/main.c:266
(gdb) 


updating to the current upstream master
(fde885bbc47a4bf14a8570ac62e68adc8cf47a6e) it's much less likely to see
the segfault, but i did manage to get this version of gpgscm to dump
core in the same way.  the backtrace from this corefile is:

0 (sid_s390x-dchroot)dkg at zelenka:~/src/gnupg2/gnupg2/build/tests/gpgscm$ gdb -c core ./gpgscm
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
Copyright (C) 2016 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 "s390x-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 ./gpgscm...done.
[New LWP 7346]
Core was generated by `./gpgscm ../../../tests/gpgscm/t-child.scm'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  is_vector (p=<optimized out>) at ../../../tests/gpgscm/scheme.c:220
220     INTERFACE INLINE int is_vector(pointer p)    { return (type(p)==T_VECTOR); }
(gdb) bt
#0  is_vector (p=<optimized out>) at ../../../tests/gpgscm/scheme.c:220
#1  vector_elem (vec=0xf05e508, ielem=7) at ../../../tests/gpgscm/scheme.c:1349
#2  0x000002aaea3deb8e in tailstack_flatten (acc=0x2ab0f053838, n=7, i=8, tailstack=0xf05e508, sc=0x2ab0f0536f0) at ../../../tests/gpgscm/scheme.c:3117
#3  callstack_flatten (acc=<optimized out>, n=<optimized out>, i=<optimized out>, sc=0x2ab0f0536f0) at ../../../tests/gpgscm/scheme.c:3155
#4  history_flatten (sc=sc at entry=0x2ab0f0536f0) at ../../../tests/gpgscm/scheme.c:3173
#5  0x000002aaea3dee62 in _Error_1 (sc=sc at entry=0x2ab0f0536f0, s=s at entry=0x2aaea3f7bb2 "eval: unbound variable:", a=0x2ab0f055dd8) at ../../../tests/gpgscm/scheme.c:2777
#6  0x000002aaea3e39d6 in opexe_0 (sc=0x2ab0f0536f0, op=<optimized out>) at ../../../tests/gpgscm/scheme.c:3298
#7  0x000002aaea3df418 in Eval_Cycle (sc=sc at entry=0x2ab0f0536f0, op=op at entry=OP_T0LVL) at ../../../tests/gpgscm/scheme.c:5358
#8  0x000002aaea3e717e in scheme_load_named_file (sc=0x2ab0f0536f0, fin=0x2ab0f0aef90, filename=0x2ab0f0aed80 "../../../tests/gpgscm/init.scm") at ../../../tests/gpgscm/scheme.c:5748
#9  0x000002aaea3d2e02 in load (sc=0x2ab0f0536f0, file_name=0x2aaea3f5724 "init.scm", lookup_in_cwd=<optimized out>, lookup_in_path=1) at ../../../tests/gpgscm/main.c:180
#10 0x000002aaea3d284a in main (argc=<optimized out>, argv=<optimized out>) at ../../../tests/gpgscm/main.c:266
(gdb)


I'm happy to provide more debugging info from this platform if that
would be useful.

Regards,

        --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnupg-maint/attachments/20170321/4da9c425/attachment-0001.sig>


More information about the pkg-gnupg-maint mailing list