[pkg-gnupg-maint] Bug#824901: Bug#824901: gnupg: gpg segfaults

Christoph Egger christoph at christoph-egger.org
Sat May 21 17:48:42 UTC 2016


Hi!

Werner Koch <wk at gnupg.org> writes:
> however, we don't have debug symbols for Libgcrypt.  I'd suggest to try
> this patch for debugging:

Actually unstable-debug has. Anyway (can give full log if that's needed
as well

> diff --git a/g10/seskey.c b/g10/seskey.c
> index c41a145..d0e6b6f 100644
> --- a/g10/seskey.c
> +++ b/g10/seskey.c
> @@ -347,6 +347,9 @@ encode_md_value (PKT_public_key *pk, gcry_md_hd_t md, int hash_algo)
>          return NULL;
>        if ( gcry_md_algo_info (hash_algo, GCRYCTL_GET_ASNOID, asn, &asnlen) )
>          BUG();
> +      log_debug ("%s: hash_algo=%d pk=%p\n", __func__, hash_algo, pk);
> +      log_debug ("%s: pk->pkey[0]=%p\n", __func__, pk->pkey[0]);
> +      gcry_log_debugmpi ("pkey[0]", pk->pkey[0]);
>        frame = do_encode_md (md, hash_algo, gcry_md_get_algo_dlen (hash_algo),
>                              gcry_mpi_get_nbits (pk->pkey[0]), asn, asnlen);
>        xfree (asn);

% gdb --args gpg --debug-all --list-sigs 0x3B78A32D98BAD5B0
[...]
gpg: DBG: keydb_search   0: LONG_KID: '28AD32B218CCB8FE'
gpg: DBG: keydb: kid_not_found_p (28ad32b218ccb8fe) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '28AD32B218CCB8FE'
gpg: DBG: keydb: kid_not_found_p (28ad32b218ccb8fe) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '0C70557B5A06513E'
gpg: DBG: keydb: kid_not_found_p (0c70557b5a06513e) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '0C70557B5A06513E'
gpg: DBG: keydb: kid_not_found_p (0c70557b5a06513e) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '0C70557B5A06513E'
gpg: DBG: keydb: kid_not_found_p (0c70557b5a06513e) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '104B1AF0BFFBFFFF'
gpg: DBG: keydb: kid_not_found_p (104b1af0bffbffff) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '104B1AF0BFFBFFFF'
gpg: DBG: keydb: kid_not_found_p (104b1af0bffbffff) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '104B1AF0BFFBFFFF'
gpg: DBG: keydb: kid_not_found_p (104b1af0bffbffff) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '3966A24BEC4D79E7'
gpg: DBG: keydb: kid_not_found_p (3966a24bec4d79e7) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '957952D7CF3401A9'
gpg: DBG: keydb: kid_not_found_p (957952d7cf3401a9) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '957952D7CF3401A9'
gpg: DBG: keydb: kid_not_found_p (957952d7cf3401a9) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '957952D7CF3401A9'
gpg: DBG: keydb: kid_not_found_p (957952d7cf3401a9) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: [not enabled in the source] keydb_new
gpg: DBG: [not enabled in the source] keydb_search enter
gpg: DBG: keydb_search: 1 search descriptions:
gpg: DBG: keydb_search   0: LONG_KID: '957952D7CF3401A9'
gpg: DBG: keydb: kid_not_found_p (957952d7cf3401a9) => not in DB
gpg: DBG: [not enabled in the source] keydb_search leave (not found, cached)
gpg: DBG: encode_md_value: hash_algo=8 pk=0x0000555555c34390
gpg: DBG: encode_md_value: pk->pkey[0]=0x0000003e67726f2e

Program received signal SIGSEGV, Segmentation fault.
_gcry_log_printmpi (text=text at entry=0x555555606606 "pkey[0]", mpi=0x3e67726f2e) at ../../src/misc.c:337
337	../../src/misc.c: No such file or directory.
(gdb) bt full
#0  _gcry_log_printmpi (text=text at entry=0x555555606606 "pkey[0]", mpi=0x3e67726f2e) at ../../src/misc.c:337
        rawmpi = <optimized out>
        rawmpilen = 4294954896
        sign = 32767
#1  0x00007ffff73b4815 in gcry_log_debugmpi (text=text at entry=0x555555606606 "pkey[0]", mpi=<optimized out>) at ../../src/visibility.c:1421
No locals.
#2  0x00005555555853c7 in encode_md_value (pk=pk at entry=0x555555c34390, md=md at entry=0x55555592dac0, hash_algo=8) at ../../g10/seskey.c:352
        rc = <optimized out>
        asn = 0x555555b79de0 "010\r\006\t`\206H\001e\003\004\002\001\005"
        asnlen = 19
        frame = <optimized out>
        mdlen = <optimized out>
        __FUNCTION__ = "encode_md_value"
        __func__ = "encode_md_value"
#3  0x000055555559bcd6 in check_signature_end_simple (pk=0x555555c34390, sig=0x555555c41e90, digest=0x55555592dac0) at ../../g10/sig-check.c:461
        result = <optimized out>
        rc = <optimized out>
        digest = 0x55555592dac0
        sig = 0x555555c41e90
        pk = 0x555555c34390
        weak = <optimized out>
#4  0x000055555559c8bf in check_signature_over_key_or_uid (signer=0x555555c34390, sig=sig at entry=0x555555c41e90, kb=kb at entry=0x555555d0f280, packet=packet at entry=0x55555592a650, is_selfsig=is_selfsig at entry=0x0, ret_pk=ret_pk at entry=0x0) at ../../g10/sig-check.c:892
        rc = <optimized out>
        pripk = 0x555555c5a500
        md = 0x55555592dac0
        signer_alloced = 0
        __FUNCTION__ = "check_signature_over_key_or_uid"
#5  0x000055555559cfe2 in check_key_signature2 (root=0x555555d0f280, node=node at entry=0x555555898b80, check_pk=check_pk at entry=0x0, ret_pk=ret_pk at entry=0x0, is_selfsig=is_selfsig at entry=0x0, r_expiredate=r_expiredate at entry=0x0, r_expired=0x0) at ../../g10/sig-check.c:1075
        unode = <optimized out>
        pk = 0x555555c5a500
        sig = 0x555555c41e90
        algo = <optimized out>
        rc = <optimized out>
        __FUNCTION__ = "check_key_signature2"
#6  0x000055555559d085 in check_key_signature (root=<optimized out>, node=node at entry=0x555555898b80, is_selfsig=is_selfsig at entry=0x0) at ../../g10/sig-check.c:686
No locals.
#7  0x0000555555584b92 in keyring_rebuild_cache (token=<optimized out>, noisy=noisy at entry=0) at ../../g10/keyring.c:1554
        sig = <optimized out>
        hd = 0x55555584d250
        desc = {mode = KEYDB_SEARCH_MODE_NEXT, skipfnc = 0x0, skipfncvalue = 0x0, sn = 0x0, snlen = 0, u = {name = 0x0, fpr = '\000' <repeats 23 times>, kid = {0, 0}, grip = '\000' <repeats 19 times>}, exact = 0}
        keyblock = 0x555555d0f280
        node = 0x555555898b80
        lastresname = 0x5555558438c0 "/home/christoph/.gnupg/pubring.gpg"
        tmpfp = 0x55555584f470
        tmpfilename = 0x55555584f440 "/home/christoph/.gnupg/pubring.gpg.tmp"
        bakfilename = 0x55555584f560 "/home/christoph/.gnupg/pubring.gpg~"
        rc = <optimized out>
        count = 19
        sigcount = 19500
#8  0x00005555555815bc in keydb_rebuild_caches (noisy=noisy at entry=0) at ../../g10/keydb.c:1775
        i = 0
        rc = <optimized out>
#9  0x00005555555ceb4f in validate_keys (interactive=interactive at entry=0) at ../../g10/trustdb.c:1904
        rc = 0
        quit = 0
        klist = 0x0
        k = <optimized out>
        keys = 0x0
        kar = <optimized out>
        kdb = 0x0
        node = <optimized out>
        depth = <optimized out>
        ot_unknown = <optimized out>
        ot_undefined = <optimized out>
        ot_never = <optimized out>
        ot_marginal = <optimized out>
        ot_full = <optimized out>
        ot_ultimate = <optimized out>
        start_time = <optimized out>
        next_expire = 0
#10 0x00005555555d08c2 in tdb_check_trustdb_stale () at ../../g10/trustdb.c:971
        scheduled = <optimized out>
        did_nextcheck = 1
#11 0x00005555555cce75 in check_trustdb_stale () at ../../g10/trust.c:280
No locals.
#12 0x00005555555a1898 in public_key_list (ctrl=0x5555558491c0, list=0x555555843790, locate_mode=0) at ../../g10/keylist.c:133
No locals.
#13 0x0000555555565859 in main (argc=0, argv=0x7fffffffdbc8) at ../../g10/gpg.c:4087
        pargs = {argc = 0x7fffffffd6dc, argv = 0x7fffffffd6d0, flags = 32769, err = 0, r_opt = 0, r_type = 0, r = {ret_int = 0, ret_long = 0, ret_ulong = 0, ret_str = 0x0}, internal = {idx = 3, inarg = 0, stopped = 1, last = 0x7fffffffdf07 "0x3B78A32D98BAD5B0", aliases = 0x0, cur_alias = 0x0, iio_list = 0x0}}
        a = <optimized out>
        rc = <optimized out>
        orig_argc = <optimized out>
        orig_argv = <optimized out>
        fname = <optimized out>
        username = <optimized out>
        may_coredump = 0
        sl = 0x555555843790
        remusr = 0x555555849200
        locusr = 0x0
        nrings = 0x0
        afx = 0x0
        detached_sig = 0
        configfp = <optimized out>
        configname = 0x0
        save_configname = <optimized out>
        default_configname = 0x555555843790 ""
        configlineno = 12
        parse_debug = 1
        default_config = <optimized out>
        default_keyring = 1
        greeting = 0
        nogreeting = 0
        logfile = 0x0
        use_random_seed = 1
        cmd = aListSigs
        debug_level = 0x0
        trustdb_name = 0x0
        def_cipher_string = <optimized out>
        def_digest_string = <optimized out>
        compress_algo_string = <optimized out>
        cert_digest_string = <optimized out>
        s2k_cipher_string = <optimized out>
        s2k_digest_string = <optimized out>
        pers_cipher_list = 0x0
        pers_digest_list = 0x5555558490c0 "SHA256"
        pers_compress_list = 0x0
        eyes_only = 0
        multifile = 0
        pwfd = -1
        fpr_maybe_cmd = 0
        any_explicit_recipient = 0
        require_secmem = 0
        got_secmem = 1
        malloc_hooks = {malloc = 0x7ffff73b48d0 <gcry_malloc>, realloc = 0x7ffff73b4910 <gcry_realloc>, free = 0x7ffff73b4990 <gcry_free>}
        ctrl = 0x5555558491c0


-- 
9FED 5C6C E206 B70A 5857  70CA 9655 22B9 D49A E731
Debian Developer | Lisp Hacker | CaCert Assurer



More information about the pkg-gnupg-maint mailing list