Closed Bug 1664111 Opened 4 years ago Closed 4 years ago

78.2.{1,2} crashes deep within librnp when generating a new openpgp key (OpenBSD)

Categories

(MailNews Core :: Security: OpenPGP, defect)

All
OpenBSD
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: gaston, Unassigned)

References

Details

(Keywords: crash)

Attachments

(2 files)

Context: testing the openpgp integration on OpenBSD for the first time with 78.2.1rc1 (then 78.2.2rc1), going to the openpgp key manager and trying to generate a new keypair crashes thunderbird - no dialog/ui displayed to choose the key type/size. Tried with bundled botan or external botan, same result.

the (partial) trace is the following:

#5  0x000008f197a85f24 in rnp_password_cb_bounce (ctx=0x7f7ffffd9b78, password=0x7f7ffffd9a20 "", password_size=256, userdata_void=0x8f0b72b4d80)
    at /tmp/pobj/thunderbird-78.2.1/thunderbird-78.2.1/comm/third_party/rnp/src/lib/rnp.cpp:613
#6  0x000008f197a69fd8 in pgp_request_password (provider=0x8f0b72b4dd8, ctx=0x7f7ffffd9b78, password=0x7f7ffffd9a20 "", password_size=256)
    at /tmp/pobj/thunderbird-78.2.1/thunderbird-78.2.1/comm/third_party/rnp/src/lib/pass-provider.cpp:55
#7  0x000008f197a6cc0d in pgp_decrypt_seckey (key=0x8f0dc007010, provider=0x8f0b72b4dd8, ctx=0x7f7ffffd9b78)
    at /tmp/pobj/thunderbird-78.2.1/thunderbird-78.2.1/comm/third_party/rnp/src/lib/pgp-key.cpp:595
#8  0x000008f197a71061 in pgp_key_unlock (key=0x8f0dc007010, provider=0x8f0b72b4dd8)
    at /tmp/pobj/thunderbird-78.2.1/thunderbird-78.2.1/comm/third_party/rnp/src/lib/pgp-key.cpp:1407
#9  0x000008f197a9c7ed in rnp_key_get_revocation (ffi=0x8f0b72b4d80, key=0x8f10a8ac010, revoker=0x8f0dc007010, hash=0x8f197a18511 "SHA256", code=0x0,-
     reason=0x0, sig=0x7f7ffffd9d50) at /tmp/pobj/thunderbird-78.2.1/thunderbird-78.2.1/comm/third_party/rnp/src/lib/rnp.cpp:3765
#10 0x000008f197a9c08f in rnp_key_export_revocation (key=0x8f12fff0a00, output=0x8f10c6d8000, flags=0, hash=0x0, code=0x0, reason=0x0)

upon kaie's request, i locally checked out librnp at the same commit thunderbird has, and librnp itself builds fine, and all its tests passes, so librnp standalone seems out of the equation.

To me this smells like memory corruption somewhere in the codepaths leading to librnp from javascript to C via libffi. I have a hard time getting a debug build (my builder has llvm crashes on OOM with debug syms) so im not sure i'll be able to do step by step debugging via gdb, as its unreliable on OpenBSD with huge programs..

actually, of all the librnp tests, one seems to fail but i dunno how to get more details:

        Start 194: cli_tests-Keystore                                                                                                                                                                                                          
Generating a new key...                                                                                                
Generating a new key...                                                                                                                                                                                                                        
Generating a new key...                                                                                                
Generating a new key...                                                                                                                                                                                                                        
Generating a new key...                                                                                                
Generating a new key...                                                                                                                                                                                                                        
Generating a new key...                                                                                                                                                                                                                        
Generating a new key...                                                                                                                                                                                                                        
Generating a new key...                                                                                                                                                                                                                        
                                                                                                                                                                                                                                               
pub   255/EdDSA 0451409669ffde3c 2019-12-26 [SC] [REVOKED]                                                                                                                                                                                     
      73edcc9119afc8e2dbbdcde50451409669ffde3c
uid           Alice <alice@rnp>
sub   256/ECDH dd23ceb7febeff17 2019-12-27 [E]
      a4bbb77370217bca2307ad0ddd23ceb7febeff17

pub   255/EdDSA 0451409669ffde3c 2019-12-26 [SC] [REVOKED]
      73edcc9119afc8e2dbbdcde50451409669ffde3c
uid           Alice <alice@rnp>
sub   256/ECDH dd23ceb7febeff17 2019-12-27 [E]
      a4bbb77370217bca2307ad0ddd23ceb7febeff17

pub   255/EdDSA 0451409669ffde3c 2019-12-26 [SC] [REVOKED]
      73edcc9119afc8e2dbbdcde50451409669ffde3c
uid           Alice <alice@rnp>
sub   256/ECDH dd23ceb7febeff17 2019-12-27 [E] [REVOKED]
      a4bbb77370217bca2307ad0ddd23ceb7febeff17

pub   255/EdDSA 0451409669ffde3c 2019-12-26 [SC] [REVOKED]
      73edcc9119afc8e2dbbdcde50451409669ffde3c
uid           Alice <alice@rnp>
sub   256/ECDH dd23ceb7febeff17 2019-12-27 [E] [REVOKED]
      a4bbb77370217bca2307ad0ddd23ceb7febeff17
Generating a new key...
Generating a new key...
194/199 Test #194: cli_tests-Keystore ............................................................***Failed   24.24 sec 

and given the codepath used in tb, dunno if that can be related.

Attached file test_cli-Keystore.log

ok, here's the output of the failing test, ran with

env RNP_TESTS_RNP_PATH=/home/landry/src/rnp/build/src/rnp/rnp RNP_TESTS_RNPKEYS_PATH=/home/landry/src/rnp/build/src/rnpkeys/rnpkeys RNP_TESTS_GPG_PATH=/usr/local/bin/gpg2 RNP_TESTS_GPGCONF_PATH=/usr/local/bin/gpgconf python3.8 /home/landry/src/rnp/src/tests/cli_tests.py -v -d Keystore

(seems to be more or less what ctest runs)

ofc this is all voodoo to me, but im not sure that relates to the crash we're seeing in thunderbird.

Summary: 78.2.{1,2} crashes deep within librnp when generating a new openpgp key → 78.2.{1,2} crashes deep within librnp when generating a new openpgp key (OpenBSD)

after retesting with a debug build of 78.2.2rc1, i have the dialogs to select the key type/size, and the confirmation dialog after that. TB crashes after clicking on 'confirm'. the complete stacktrace is below:

Core was generated by `thunderbird'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  thrkill () at /tmp/-:3
3       /tmp/-: No such file or directory.
[Current thread is 1 (process 161866)]
(gdb) bt
#0  thrkill () at /tmp/-:3
#1  0x000007c98ea1134e in nsProfileLock::FatalSignalHandler (signo=11, info=0x7f7ffffea3b0, context=0x7f7ffffea2c0) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/toolkit/profile/nsProfileLock.cpp:168
#2  0x000007c98f458047 in WasmTrapHandler (signum=11, info=0x7f7ffffea3b0, context=0x7f7ffffea2c0) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/wasm/WasmSignalHandlers.cpp:963
#3  <signal handler called>
#4  0x000007c939723040 in ?? ()
#5  0x000007c93326d4d4 in rnp_password_cb_bounce (ctx=0x7f7ffffeab08, password=0x7f7ffffea9b0 "", password_size=256, userdata_void=0x7c928c9d700)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:627
#6  0x000007c9332542f8 in pgp_request_password (provider=0x7c928c9d758, ctx=0x7f7ffffeab08, password=0x7f7ffffea9b0 "", password_size=256)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp:55
#7  0x000007c933255d7d in pgp_decrypt_seckey (key=0x7c8f5210010, provider=0x7c928c9d758, ctx=0x7f7ffffeab08) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:484
#8  0x000007c93325a071 in pgp_key_unlock (key=0x7c8f5210010, provider=0x7c928c9d758) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:1296
#9  0x000007c933283f8a in rnp_key_get_revocation (ffi=0x7c928c9d700, key=0x7c99d15b010, revoker=0x7c8f5210010, hash=0x7c9330bf91c "SHA256", code=0x0, reason=0x0, sig=0x7f7ffffeace0)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:3802
#10 0x000007c93328382f in rnp_key_export_revocation (key=0x7c896481d00, output=0x7c8a7d9e000, flags=0, hash=0x0, code=0x0, reason=0x0) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:3844
#11 0x000007c98f4b6ee0 in ffi_call_unix64 () at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/libffi/src/x86/unix64.S:76
#12 0x000007c98f4b63bd in ffi_call (cif=<optimized out>, fn=0x7c9332834c0 <rnp_key_export_revocation(rnp_key_handle_t, rnp_output_t, uint32_t, char const*, char const*, char const*)>, rvalue=0x7c9330cf1ee, avalue=0x7f7ffffeaef8)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/libffi/src/x86/ffi64.c:535
#13 0x000007c98eb52a39 in js::ctypes::FunctionType::Call (cx=0x7c88e5e47f0, argc=<optimized out>, vp=0x7c9431ae498) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/CTypes.cpp:7078
#14 0x000007c98eb6355f in CallJSNative (cx=0x7c88e5e47f0, native=0x7c98eb52040 <js::ctypes::FunctionType::Call(JSContext*, unsigned int, JS::Value*)>, reason=js::Call, args=...)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:493
#15 js::InternalCallOrConstruct (cx=0x7c88e5e47f0, args=..., construct=<optimized out>, reason=js::Call) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:565
#16 0x000007c98eb6002d in InternalCall (cx=0x7c88e5e47f0, args=..., reason=<error reading variable: Cannot access memory at address 0x0>) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:648
#17 js::CallFromStack (cx=0x7c88e5e47f0, args=...) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:652
#18 Interpret (cx=0x7c88e5e47f0, state=...) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:3312
#19 0x000007c98eb5602b in js::RunScript (cx=0x7c88e5e47f0, state=...) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:465
#20 0x000007c98eb63232 in js::InternalCallOrConstruct (cx=0x7c88e5e47f0, args=..., construct=<optimized out>, reason=<optimized out>) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:620
#21 0x000007c98eb63809 in InternalCall (cx=<optimized out>, args=..., reason=<optimized out>) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:648
#22 js::Call (cx=0x7c88e5e47f0, fval=..., thisv=..., args=..., rval=..., reason=js::Call) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:665
#23 0x000007c98edabe95 in js::CallSelfHostedFunction (cx=0x7c88e5e47f0, name=..., thisv=..., args=..., rval=...) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/SelfHosting.cpp:1678
#24 0x000007c98f136f87 in js::jit::InterpretResume (cx=0x7c88e5e47f0, obj=..., stackValues=0x7f7ffffeb808, rval=...) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/jit/VMFunctions.cpp:999
#25 0x000007c99439eb90 in ?? ()
#26 0x00007f7ffffeb868 in ?? ()
#27 0x00007f7ffffeb7d8 in ?? ()
#28 0x00007f7ffffeb890 in ?? ()
#29 0xfff9800000000000 in ?? ()
#30 0x000007c9892f3058 in js::jit::vmFunctions () from /usr/local/lib/thunderbird/libxul.so.35.0
#31 0x000007c9943a6967 in ?? ()
#32 0x0000000000007821 in ?? ()
#33 0x00001f49c8f0ba18 in ?? ()
#34 0x00007f7ffffeb808 in ?? ()
#35 0xfff8800000000000 in ?? ()
#36 0xfffe109c575ba9a0 in ?? ()
#37 0xfffe1f49c8f0ba18 in ?? ()
#38 0xfffe1f49c8f0ba18 in ?? ()
#39 0x00002e419c082100 in ?? ()
#40 0x000007c8dce94270 in ?? ()
#41 0x000007c8a2b9f6c8 in ?? ()
#42 0x000035be8166e070 in ?? ()
#43 0xfff9800000000000 in ?? ()
#44 0x0000000100000001 in ?? ()
#45 0x000007c900000002 in ?? ()
#46 0x00007f7ffffeb8f0 in ?? ()
#47 0x00007f7ffffeb8d0 in ?? ()
#48 0x000007c99439b69f in ?? ()
#49 0x0000000000002043 in ?? ()
#50 0x00002e419c083e70 in ?? ()
#51 0x0000000000000001 in ?? ()
#52 0xfffe1f49c8f0ba18 in ?? ()
#53 0xfffe109c575ba9a0 in ?? ()
#54 0x00007f7ffffeba08 in ?? ()
#55 0x000007c88e5e47f0 in ?? ()
#56 0x00007f7ffffebb18 in ?? ()
#57 0x00007f7ffffebca0 in ?? ()
#58 0x0000000000000000 in ?? ()
Keywords: crash

dont see anything obviously wrong in the rnp_password_cb_bounce params at https://hg.mozilla.org/releases/comm-esr78/file/tip/third_party/rnp/src/lib/rnp.cpp#l627

(gdb) down
#5  0x000007c93326d4d4 in rnp_password_cb_bounce (ctx=0x7f7ffffeab08, password=0x7f7ffffea9b0 "", password_size=256, userdata_void=0x7c928c9d700)
(gdb) p * (rnp_ffi_t) userdata_void
$5 = {errs = 0x7c896cd8a90 <usual>, pubring = 0x7c8f2ce7c00, secring = 0x7c96415ab80, getkeycb = 0x0, getkeycb_ctx = 0x0, getpasscb = 0x7c939723040, getpasscb_ctx = 0x0, rng = {initialized = true, rng_type = 0 '\000', botan_rng = 
    0x7c97e776260}, key_provider = {callback = 0x7c93326d300 <ffi_key_provider(pgp_key_request_ctx_t const*, void*)>, userdata = 0x7c928c9d700}, pass_provider = {
    callback = 0x7c93326d390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>, userdata = 0x7c928c9d700}}
(gdb) p (pgp_password_ctx_t) *ctx
$6 = {op = 4 '\004', key = 0x7c8f5210010}

some alignment problem in libffi ?

#5 0x000007c93326d4d4 in rnp_password_cb_bounce (ctx=0x7f7ffffeab08, password=0x7f7ffffea9b0 "", password_size=256, userdata_void=0x7c928c9d700)
at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:627

You new stack trace is better than before.

This line is:

    return ffi->getpasscb(ffi,
                          ffi->getpasscb_ctx,
                          ctx->key ? &key : NULL,
                          operation_description(ctx->op),
                          password,
                          password_size);

It has already passed dereferencing of a ctx element and another ffi element, so the ctx and ffi paramers are probably good pointers in general. We know ffi->getpasscb is non-null.

We are using the primary ffi area for creating a new key, and that ffi has gotten a call to rnp_ffi_set_pass_provider shortly after init. The password callback should be good.

If it cannot be used, likely something is corrupted.

I suggest to use gdb to "print *ffi" and "print *ctx" at that stack level.

(In reply to Kai Engert (:KaiE:) from comment #6)

I suggest to use gdb to "print *ffi" and "print *ctx" at that stack level.

arent those the ones i printed in comment 4 ?

(In reply to Landry Breuil (:gaston) from comment #7)

(In reply to Kai Engert (:KaiE:) from comment #6)

I suggest to use gdb to "print *ffi" and "print *ctx" at that stack level.

arent those the ones i printed in comment 4 ?

yes sorry, I had missed that

at the next thunderbird startup, i can see that the key has indeed been generated (its present in the key manager), so the crash happens after key creation and during revocation info export, as rnp_key_export_revocation() seems to hint ? that codepath seems called from js here https://searchfox.org/comm-esr78/source/mail/extensions/openpgp/content/modules/RNP.jsm#2751

after a bit of fighting i can finally run tb within gdb & debug syms and can do step-by-step debugging. Here's some traces/prints from various points of the stack:

(gdb) s
rnp_key_get_revocation (ffi=0x4d8b9810c00, key=0x4d8b293d000, revoker=0x9ed4668c, hash=0x0, code=0x0, reason=0x0, sig=0x9)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:3773
3773	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p *key
$5 = {uids = {<std::__1::__vector_base<pgp_userid_t, std::__1::allocator<pgp_userid_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, 
      __begin_ = 0x4d90850ee60 <armored_dst_write(pgp_dest_t*, void const*, unsigned long)>, __end_ = 0x4d90850f5c0 <armored_dst_finish(pgp_dest_t*)>, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_userid_t*, 0, false>> = {
          __value_ = 0x4d90850f7d0 <armored_dst_close(pgp_dest_t*, bool)>}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_userid_t>, 1, true>> = {<std::__1::allocator<pgp_userid_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subsigs = {<std::__1::__vector_base<pgp_subsig_t, std::__1::allocator<pgp_subsig_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, 
      __begin_ = 0xb, __end_ = 0x0, __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_subsig_t*, 0, false>> = {
          __value_ = 0x4d88c831880}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_subsig_t>, 1, true>> = {<std::__1::allocator<pgp_subsig_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, revokes = {<std::__1::__vector_base<pgp_revoke_t, std::__1::allocator<pgp_revoke_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x0, __end_ = 0x0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_revoke_t*, 0, false>> = {
          __value_ = 0x0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_revoke_t>, 1, true>> = {<std::__1::allocator<pgp_revoke_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subkey_fps = {<std::__1::__vector_base<pgp_fingerprint_t, std::__1::allocator<pgp_fingerprint_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x0, __end_ = 0x0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_fingerprint_t*, 0, false>> = {
          __value_ = 0x0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_fingerprint_t>, 1, true>> = {<std::__1::allocator<pgp_fingerprint_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, primary_fp = {fingerprint = '\000' <repeats 19 times>, length = 0}, primary_fp_set = false, expiration = 0, pkt = {tag = PGP_PKT_RESERVED, version = PGP_VUNKNOWN, creation_time = 0, 
    alg = PGP_PKA_NOTHING, v3_days = 0, hashed_data = 0x0, hashed_len = 0, material = {alg = PGP_PKA_NOTHING, secret = false, {rsa = {n = {mpi = '\000' <repeats 2047 times>, len = 0}, e = {
            mpi = '\000' <repeats 2047 times>, len = 0}, d = {mpi = '\000' <repeats 2047 times>, len = 0}, p = {mpi = '\000' <repeats 2047 times>, len = 0}, q = {mpi = '\000' <repeats 2047 times>, len = 0}, u = {
            mpi = '\000' <repeats 2047 times>, len = 0}}, dsa = {p = {mpi = '\000' <repeats 2047 times>, len = 0}, q = {mpi = '\000' <repeats 2047 times>, len = 0}, g = {mpi = '\000' <repeats 2047 times>, 
            len = 0}, y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, eg = {p = {mpi = '\000' <repeats 2047 times>, len = 0}, g = {
            mpi = '\000' <repeats 2047 times>, len = 0}, y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, ec = {curve = PGP_CURVE_UNKNOWN, p = {
            mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}, kdf_hash_alg = PGP_HASH_UNKNOWN, key_wrap_alg = PGP_SA_PLAINTEXT}}}, sec_protection = {s2k = {
        usage = PGP_S2KU_NONE, specifier = PGP_S2KS_SIMPLE, hash_alg = PGP_HASH_UNKNOWN, salt = "\000\000\000\000\000\000\000", iterations = 0, gpg_ext_num = PGP_S2K_GPG_NONE, gpg_serial_len = 0 '\000', 
        gpg_serial = '\000' <repeats 15 times>}, symm_alg = PGP_SA_PLAINTEXT, cipher_mode = PGP_CIPHER_MODE_NONE, iv = '\000' <repeats 15 times>}, sec_data = 0x0, sec_len = 0}, rawpkt = {tag = PGP_PKT_RESERVED, 
    raw = {<std::__1::__vector_base<unsigned char, std::__1::allocator<unsigned char> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x0, __end_ = 0x0, 
        __end_cap_ = {<std::__1::__compressed_pair_elem<unsigned char*, 0, false>> = {
            __value_ = 0x0}, <std::__1::__compressed_pair_elem<std::__1::allocator<unsigned char>, 1, true>> = {<std::__1::allocator<unsigned char>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}}, key_flags = 0 '\000', keyid = {__elems_ = "\000\000\000\000\000\000\000"}, fingerprint = {fingerprint = '\000' <repeats 19 times>, length = 0}, grip = {__elems_ = '\000' <repeats 19 times>}, 
  uid0 = 0, uid0_set = 0, revoked = 0 '\000', revocation = {uid = 0, code = PGP_REVOCATION_NO_REASON, reason = {<std::__1::__basic_string_common<true>> = {<No data fields>}, static __short_mask = 1, 
      static __long_mask = 1, __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 0, 
                __size_ = 0, __data_ = 0x0}, __s = {{__size_ = 0 '\000', __lx = 0 '\000'}, __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                  0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>}, 
      static npos = 18446744073709551615}}, format = PGP_KEY_STORE_UNKNOWN, valid = false, validated = false}
(gdb) p *ffi
$6 = {errs = 0x4d8bcac6800, pubring = 0x808ca77a00000001, secring = 0x8e2c09e2, getkeycb = 0x0, getkeycb_ctx = 0x0, getpasscb = 0x0, getpasscb_ctx = 0x0, rng = {initialized = false, rng_type = 0 '\000', 
    botan_rng = 0x0}, key_provider = {callback = 0x0, userdata = 0x0}, pass_provider = {callback = 0x0, userdata = 0x0}}
...(gdb) n
3774	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) n
3775	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) n
3776	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p *ffi
$7 = {errs = 0x4d89edddcc0 <usual>, pubring = 0x4d8ddad4a80, secring = 0x4d8ddad4900, getkeycb = 0x0, getkeycb_ctx = 0x0, getpasscb = 0x4d89ef13d40, getpasscb_ctx = 0x0, rng = {initialized = true, 
    rng_type = 0 '\000', botan_rng = 0x4d8bf963460}, key_provider = {callback = 0x4d9084bf300 <ffi_key_provider(pgp_key_request_ctx_t const*, void*)>, userdata = 0x4d8bcac6800}, pass_provider = {
    callback = 0x4d9084bf390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>, userdata = 0x4d8bcac6800}}
(gdb) n
3778	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
3779	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
3783	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
3784	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
3788	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p revinfo
$8 = {uid = 0, code = PGP_REVOCATION_NO_REASON, reason = {<std::__1::__basic_string_common<true>> = {<No data fields>}, static __short_mask = 1, static __long_mask = 1, 
    __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 0, __size_ = 0, 
              __data_ = 0x0}, __s = {{__size_ = 0 '\000', __lx = 0 '\000'}, __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>}, 
    static npos = 18446744073709551615}}
(gdb) n
3792	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) n
3801	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) n
3802	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p locked
$9 = true
(gdb) s
pgp_key_unlock (key=0x4d8bcac6800, provider=0x4d85f217010) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:1278
1278	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp: No such file or directory.
(gdb) p *provider
$10 = {callback = 0x4d827b33680, userdata = 0x4d827b336d0}
(gdb) p *key
Cannot access memory at address 0x4d8bcac7000
(gdb) n
1279	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) p *key
$12 = {uids = {<std::__1::__vector_base<pgp_userid_t, std::__1::allocator<pgp_userid_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d841453180, __end_ = 0x4d8414531d0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_userid_t*, 0, false>> = {
          __value_ = 0x4d8414531d0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_userid_t>, 1, true>> = {<std::__1::allocator<pgp_userid_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subsigs = {<std::__1::__vector_base<pgp_subsig_t, std::__1::allocator<pgp_subsig_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d85351c700, 
      __end_ = 0x4d85351c7d8, __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_subsig_t*, 0, false>> = {
          __value_ = 0x4d85351c7d8}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_subsig_t>, 1, true>> = {<std::__1::allocator<pgp_subsig_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, revokes = {<std::__1::__vector_base<pgp_revoke_t, std::__1::allocator<pgp_revoke_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x0, __end_ = 0x0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_revoke_t*, 0, false>> = {
          __value_ = 0x0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_revoke_t>, 1, true>> = {<std::__1::allocator<pgp_revoke_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subkey_fps = {<std::__1::__vector_base<pgp_fingerprint_t, std::__1::allocator<pgp_fingerprint_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d86bd2cc00, 
      __end_ = 0x4d86bd2cc18, __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_fingerprint_t*, 0, false>> = {
          __value_ = 0x4d86bd2cc18}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_fingerprint_t>, 1, true>> = {<std::__1::allocator<pgp_fingerprint_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, primary_fp = {fingerprint = '\000' <repeats 19 times>, length = 0}, primary_fp_set = false, expiration = 94608000, pkt = {tag = PGP_PKT_SECRET_KEY, version = PGP_V4, 
    creation_time = 1599899007, alg = PGP_PKA_RSA, v3_days = 0, hashed_data = 0x4d85ec46c00 "\004_\\\205\177\001\f", hashed_len = 397, material = {alg = PGP_PKA_RSA, secret = false, {rsa = {n = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, e = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          d = {mpi = '\000' <repeats 2047 times>, len = 0}, p = {mpi = '\000' <repeats 2047 times>, len = 0}, q = {mpi = '\000' <repeats 2047 times>, len = 0}, u = {mpi = '\000' <repeats 2047 times>, len = 0}}, 
        dsa = {p = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, q = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          g = {mpi = '\000' <repeats 2047 times>, len = 0}, y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, eg = {p = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, g = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, ec = {curve = 607001834, p = {
            mpi = "z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX\354\351x\334\333os\242"..., len = 65537}, x = {mpi = '\000' <repeats 2040 times>..., len = 0}, 
          kdf_hash_alg = PGP_HASH_UNKNOWN, key_wrap_alg = PGP_SA_PLAINTEXT}}}, sec_protection = {s2k = {usage = PGP_S2KU_ENCRYPTED_AND_HASHED, specifier = PGP_S2KS_ITERATED_AND_SALTED, 
        hash_alg = PGP_HASH_SHA256, salt = "[\241{\202\216?\370h", iterations = 1245184, gpg_ext_num = PGP_S2K_GPG_NONE, gpg_serial_len = 0 '\000', gpg_serial = '\000' <repeats 15 times>}, 
      symm_alg = PGP_SA_AES_256, cipher_mode = PGP_CIPHER_MODE_CFB, iv = "\036e\253<\017G\203\307!\373a\035\353f+\264"}, sec_data = 0x4d84784f400 "\203j\035\177\310\065K\031\365\305-H", sec_len = 988}, rawpkt = {
    tag = PGP_PKT_SECRET_KEY, raw = {<std::__1::__vector_base<unsigned char, std::__1::allocator<unsigned char> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, 
        __begin_ = 0x4d8d1ce3800 "\305\304\306\004_\\\205\177\001\f", __end_ = 0x4d8d1ce3d89 '\337' <repeats 199 times>, <incomplete sequence \337>..., 
        __end_cap_ = {<std::__1::__compressed_pair_elem<unsigned char*, 0, false>> = {
            __value_ = 0x4d8d1ce3d89 '\337' <repeats 199 times>, <incomplete sequence \337>...}, <std::__1::__compressed_pair_elem<std::__1::allocator<unsigned char>, 1, true>> = {<std::__1::allocator<unsigned char>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}}, key_flags = 3 '\003', keyid = {__elems_ = "z\247\214\200\342\t,\216"}, fingerprint = {
    fingerprint = "\307٫ܶ\237/\254i?0:z\247\214\200\342\t,\216", length = 20}, grip = {__elems_ = "\002\243>\023\370\271\231\213\024D\357\004\204\305\367'Ǔ\022\245"}, uid0 = 0, uid0_set = 0, 
  revoked = 0 '\000', revocation = {uid = 0, code = PGP_REVOCATION_NO_REASON, reason = {<std::__1::__basic_string_common<true>> = {<No data fields>}, static __short_mask = 1, static __long_mask = 1, 
      __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 0, __size_ = 0, 
                __data_ = 0x0}, __s = {{__size_ = 0 '\000', __lx = 0 '\000'}, __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                  0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>}, 
      static npos = 18446744073709551615}}, format = PGP_KEY_STORE_GPG, valid = true, validated = true}

1285	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
1291	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
1295	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
1296	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) p ctx
$13 = {op = 4 '\004', key = 0x4d85f21b010}
(gdb) p ctx.key
$14 = (const pgp_key_t *) 0x4d85f21b010
(gdb) p *(ctx.key)
$15 = {uids = {<std::__1::__vector_base<pgp_userid_t, std::__1::allocator<pgp_userid_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d841453180, __end_ = 0x4d8414531d0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_userid_t*, 0, false>> = {
          __value_ = 0x4d8414531d0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_userid_t>, 1, true>> = {<std::__1::allocator<pgp_userid_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subsigs = {<std::__1::__vector_base<pgp_subsig_t, std::__1::allocator<pgp_subsig_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d85351c700, 
      __end_ = 0x4d85351c7d8, __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_subsig_t*, 0, false>> = {
          __value_ = 0x4d85351c7d8}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_subsig_t>, 1, true>> = {<std::__1::allocator<pgp_subsig_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, revokes = {<std::__1::__vector_base<pgp_revoke_t, std::__1::allocator<pgp_revoke_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x0, __end_ = 0x0, 
      __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_revoke_t*, 0, false>> = {
          __value_ = 0x0}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_revoke_t>, 1, true>> = {<std::__1::allocator<pgp_revoke_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, subkey_fps = {<std::__1::__vector_base<pgp_fingerprint_t, std::__1::allocator<pgp_fingerprint_t> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, __begin_ = 0x4d86bd2cc00, 
      __end_ = 0x4d86bd2cc18, __end_cap_ = {<std::__1::__compressed_pair_elem<pgp_fingerprint_t*, 0, false>> = {
          __value_ = 0x4d86bd2cc18}, <std::__1::__compressed_pair_elem<std::__1::allocator<pgp_fingerprint_t>, 1, true>> = {<std::__1::allocator<pgp_fingerprint_t>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}, primary_fp = {fingerprint = '\000' <repeats 19 times>, length = 0}, primary_fp_set = false, expiration = 94608000, pkt = {tag = PGP_PKT_SECRET_KEY, version = PGP_V4, 
    creation_time = 1599899007, alg = PGP_PKA_RSA, v3_days = 0, hashed_data = 0x4d85ec46c00 "\004_\\\205\177\001\f", hashed_len = 397, material = {alg = PGP_PKA_RSA, secret = false, {rsa = {n = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, e = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          d = {mpi = '\000' <repeats 2047 times>, len = 0}, p = {mpi = '\000' <repeats 2047 times>, len = 0}, q = {mpi = '\000' <repeats 2047 times>, len = 0}, u = {mpi = '\000' <repeats 2047 times>, len = 0}}, 
        dsa = {p = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, q = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          g = {mpi = '\000' <repeats 2047 times>, len = 0}, y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, eg = {p = {
            mpi = "\352\034.$B\226\226;z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX"..., len = 384}, g = {mpi = "\001\000\001", '\000' <repeats 2044 times>, len = 3}, 
          y = {mpi = '\000' <repeats 2047 times>, len = 0}, x = {mpi = '\000' <repeats 2047 times>, len = 0}}, ec = {curve = 607001834, p = {
            mpi = "z\313_\"T\022\327cH\t\360\001\247c\357O$+\273\332Pb\362S\n\276\205\225\261o\rR\345\321P\233cy[\230<\034Ӑs|7JG\n=\030\262\231ߒ\360\216\330\363\016\021{\214)6\232\324줹\264:[\005\020\\u\374~\ts\026\205\016\234\307\335&,pm$F\353|*vlrR\206\252\351\315\343\315\343\303\360`\032\226\373hϗ\241\277$\032\325\v'\027Ǧ\370\277\213\230\350\364\060\360z7\266w\017\322ף\f/\217\242\313\025}\314\005\370|\225z^\035E\367\024\247\301N\212Bpp\264I@\020H \024]\303[E\331\006l\262\303\351k\024\212\004\211\273Q\346\004\371T\303FX\354\351x\334\333os\242"..., len = 65537}, x = {mpi = '\000' <repeats 2040 times>..., len = 0}, 
          kdf_hash_alg = PGP_HASH_UNKNOWN, key_wrap_alg = PGP_SA_PLAINTEXT}}}, sec_protection = {s2k = {usage = PGP_S2KU_ENCRYPTED_AND_HASHED, specifier = PGP_S2KS_ITERATED_AND_SALTED, 
        hash_alg = PGP_HASH_SHA256, salt = "[\241{\202\216?\370h", iterations = 1245184, gpg_ext_num = PGP_S2K_GPG_NONE, gpg_serial_len = 0 '\000', gpg_serial = '\000' <repeats 15 times>}, 
      symm_alg = PGP_SA_AES_256, cipher_mode = PGP_CIPHER_MODE_CFB, iv = "\036e\253<\017G\203\307!\373a\035\353f+\264"}, sec_data = 0x4d84784f400 "\203j\035\177\310\065K\031\365\305-H", sec_len = 988}, rawpkt = {
    tag = PGP_PKT_SECRET_KEY, raw = {<std::__1::__vector_base<unsigned char, std::__1::allocator<unsigned char> >> = {<std::__1::__vector_base_common<true>> = {<No data fields>}, 
        __begin_ = 0x4d8d1ce3800 "\305\304\306\004_\\\205\177\001\f", __end_ = 0x4d8d1ce3d89 '\337' <repeats 199 times>, <incomplete sequence \337>..., 
        __end_cap_ = {<std::__1::__compressed_pair_elem<unsigned char*, 0, false>> = {
            __value_ = 0x4d8d1ce3d89 '\337' <repeats 199 times>, <incomplete sequence \337>...}, <std::__1::__compressed_pair_elem<std::__1::allocator<unsigned char>, 1, true>> = {<std::__1::allocator<unsigned char>> = {<No data fields>}, <No data fields>}, <No data fields>}}, <No data fields>}}, key_flags = 3 '\003', keyid = {__elems_ = "z\247\214\200\342\t,\216"}, fingerprint = {
    fingerprint = "\307٫ܶ\237/\254i?0:z\247\214\200\342\t,\216", length = 20}, grip = {__elems_ = "\002\243>\023\370\271\231\213\024D\357\004\204\305\367'Ǔ\022\245"}, uid0 = 0, uid0_set = 0, 
  revoked = 0 '\000', revocation = {uid = 0, code = PGP_REVOCATION_NO_REASON, reason = {<std::__1::__basic_string_common<true>> = {<No data fields>}, static __short_mask = 1, static __long_mask = 1, 
      __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 0, __size_ = 0, 
                __data_ = 0x0}, __s = {{__size_ = 0 '\000', __lx = 0 '\000'}, __data_ = '\000' <repeats 22 times>}, __r = {__words = {0, 0, 
                  0}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>}, 
      static npos = 18446744073709551615}}, format = PGP_KEY_STORE_GPG, valid = true, validated = true}
(gdb) n

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000004d89ef13d40 in ?? ()

will try to do the same for the last two levels of the stack (below pgp_decrypt_seckey)

fwiw i had set a bp on pgp_decrypt_sekey(), and when generating a newkeypair, there's already a codepath calling it before the crash```:

#0  pgp_decrypt_seckey (key=0xce799895010, provider=0x7f7ffffcd3e8, ctx=0x0) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:458
#1  0x00000ce7d62dd071 in pgp_key_unlock (key=0xce799895010, provider=0x7f7ffffcd3e8) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:1296
#2  0x00000ce7d6317d17 in rnp_key_unlock (handle=0xce783f99100, password=0xce7ab5fd380 "f7a16544ebf80cce7efff33962ace223")
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:6357
#3  0x00000ce7cc303ee0 in ffi_call_unix64 () at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/libffi/src/x86/unix64.S:76
#4  0x00000ce7cc3033bd in ffi_call (cif=<optimized out>, fn=0xce7d6317b40 <rnp_key_unlock(rnp_key_handle_t, char const*)>, rvalue=0xce72ea1e201 <malloc_mutex+33>, avalue=0x7f7ffffcd5d8)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/libffi/src/x86/ffi64.c:535
#5  0x00000ce7cb99fa39 in js::ctypes::FunctionType::Call (cx=0xce6f66137f0, argc=<optimized out>, vp=0xce722fe1408) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/ctypes/CTypes.cpp:7078
#6  0x00000ce7cb9b055f in CallJSNative (cx=0xce6f66137f0, native=0xce7cb99f040 <js::ctypes::FunctionType::Call(JSContext*, unsigned int, JS::Value*)>, reason=js::Call, args=...)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/js/src/vm/Interpreter.cpp:493

from that point i can continue execution, and there's no crash there. The next call to pgp_decrypt_seckey() is the one crashing (via rnp_key_export_revocation())

Thread 1 hit Breakpoint 2, pgp_decrypt_seckey (key=0xce799895010, provider=0xce7212a7758, ctx=0x0) at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp:458
458	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp: No such file or directory.
(gdb) s
461	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
464	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
468	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
471	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
472	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) 
482	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
483	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) n
484	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pgp-key.cpp
(gdb) s
pgp_request_password (provider=0xce799895010, ctx=0xce7212a7758, password=0x7f7ffffcb998 "\004\317-\326", <incomplete sequence \347\014>, password_size=14189870287088)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp:51
51	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp: No such file or directory.
(gdb) p *provider
$16 = {callback = 0xce788082080, userdata = 0xce7880820d0}
(gdb) p *ctx
$17 = {op = 144 '\220', key = 0xce7212a7700}
(gdb) n
52	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp
(gdb) p *ctx
$18 = {op = 4 '\004', key = 0xce799895010}
(gdb) p *provider
$19 = {callback = 0xce7d62f0390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>, userdata = 0xce7212a7700}
(gdb) 
(gdb) p *(provider->callback)
$20 = {bool (const pgp_password_ctx_t *, char *, size_t, void *)} 0xce7d62f0390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>
(gdb) n
55	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp
(gdb) s

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000ce74f9e9ec0 in ?? ()

now thinking about it, i dunno if that's normal or not, but since the key is generated in the key manager, and the crash happens during revocation info export, should i have been prompted at some point to set a password on the key when it is generated (so, before revocation info export), or all generated keys are passwordless ?

fwiw, i can also reproduce the crash by right-clicking on a key generated by a previous attempt/crash, selecting 'revoke key' and validating the dialog. same codepath called.

Thread 1 hit Breakpoint 1, pgp_request_password (provider=0x488590010, ctx=0x3f4046958, password=0x7f7ffffda508 "\004_", <incomplete sequence \353\004>, password_size=21126125808)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp:51
51	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp: No such file or directory.
(gdb) n
52	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp
(gdb) n
55	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/pass-provider.cpp
(gdb) p *(provider->userdata)
Attempt to dereference a generic pointer.
(gdb) s

Thread 1 hit Breakpoint 2, rnp_password_cb_bounce (ctx=0x3f4046958, password=0x7f7ffffda508 "\004_", <incomplete sequence \353\004>, password_size=140187732386736, userdata_void=0x100)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:617
617	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp: No such file or directory.
(gdb) n
618	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p password
$1 = 0x7f7ffffda3b0 ""
(gdb) p passowrd_size
No symbol "passowrd_size" in current context.
(gdb) p *userdata_void
Attempt to dereference a generic pointer.
(gdb) n
620	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p *userdata_void
Attempt to dereference a generic pointer.
(gdb) p ffi
$2 = (rnp_ffi_t) 0x3f4046900
(gdb) p *ffi
$3 = {errs = 0x42cd72740 <usual>, pubring = 0x4acb3e100, secring = 0x3f4046700, getkeycb = 0x0, getkeycb_ctx = 0x0, getpasscb = 0x4bf13d6c0, getpasscb_ctx = 0x0, rng = {initialized = false, rng_type = 0 '\000', 
    botan_rng = 0x0}, key_provider = {callback = 0x4eb389300 <ffi_key_provider(pgp_key_request_ctx_t const*, void*)>, userdata = 0x3f4046900}, pass_provider = {
    callback = 0x4eb389390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>, userdata = 0x3f4046900}}
(gdb) c
Continuing.

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00000004bf13d6c0 in ?? ()
Thread 1 hit Breakpoint 2, rnp_password_cb_bounce (ctx=0x8a47435fdd8, password=0x7f7ffffd88a8 "\004/\243X\244\b", password_size=140187732379472, userdata_void=0x100)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:617
617	/usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp: No such file or directory.
(gdb) n
618	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
620	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
624	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
625	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
626	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p key
$4 = {ffi = 0x8a47435fd80, locator = {type = PGP_KEY_SEARCH_UNKNOWN, by = {keyid = {__elems_ = "\000\000\000\000\000\000\000"}, grip = {__elems_ = '\000' <repeats 19 times>}, fingerprint = {
        fingerprint = '\000' <repeats 19 times>, length = 0}, userid = '\000' <repeats 128 times>}}, pub = 0x0, sec = 0x0}
(gdb) p *ctx
$5 = {op = 4 '\004', key = 0x8a428fed010}
(gdb) n
627	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p key
$6 = {ffi = 0x8a47435fd80, locator = {type = PGP_KEY_SEARCH_UNKNOWN, by = {keyid = {__elems_ = "\000\000\000\000\000\000\000"}, grip = {__elems_ = '\000' <repeats 19 times>}, fingerprint = {
        fingerprint = '\000' <repeats 19 times>, length = 0}, userid = '\000' <repeats 128 times>}}, pub = 0x0, sec = 0x8a428fed010}
(gdb) p ctx->key
$7 = (const pgp_key_t *) 0x8a428fed010
(gdb) p password
$8 = 0x7f7ffffd8750 ""
(gdb) p password_size
$9 = 256
(gdb) p ffi
$10 = (rnp_ffi_t) 0x8a47435fd80
(gdb) p *ffi
$11 = {errs = 0x8a448937740 <usual>, pubring = 0x8a462142200, secring = 0x8a462142280, getkeycb = 0x0, getkeycb_ctx = 0x0, getpasscb = 0x8a40a35ac40, getpasscb_ctx = 0x0, rng = {initialized = false, 
    rng_type = 0 '\000', botan_rng = 0x0}, key_provider = {callback = 0x8a458a46300 <ffi_key_provider(pgp_key_request_ctx_t const*, void*)>, userdata = 0x8a47435fd80}, pass_provider = {
    callback = 0x8a458a46390 <rnp_password_cb_bounce(pgp_password_ctx_t const*, char*, unsigned long, void*)>, userdata = 0x8a47435fd80}}
(gdb) s
628	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) s
629	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
630	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
operation_description (op=0 '\000') at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:587
587	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
588	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 
rnp_password_cb_bounce (ctx=0x7f7ffffd88a8, password=0x7f7ffffd8750 "", password_size=256, userdata_void=0x8a47435fd80)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:631
631	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) n
632	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) s
627	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) 

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000008a40a35ac40 in ?? ()
(gdb) up
#1  0x000008a458a464d4 in rnp_password_cb_bounce (ctx=0x7f7ffffd88a8, password=0x7f7ffffd8750 "", password_size=256, userdata_void=0x8a47435fd80)
    at /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:627
627	in /usr/obj/ports/thunderbird-78.2.2rc1/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp
(gdb) p ffi->getpasscb
$12 = (rnp_password_cb) 0x8a40a35ac40
(gdb) p *(ffi->getpasscb)
$13 = {bool (rnp_ffi_t, void *, rnp_key_handle_t, const char *, char *, size_t)} 0x8a40a35ac40

something feels wrong about ffi->getpasscb, and i dunno which method it calls... back into js i guess ? wrong signature/params ?

Password callback is defined in JS as the following:

const rnp_password_cb_t = ctypes.FunctionType(abi, ctypes.bool, [
rnp_ffi_t,
ctypes.void_t.ptr,
rnp_key_handle_t,
ctypes.char.ptr,
ctypes.char.ptr,
ctypes.size_t,
+
−]).ptr;

However, in RNP first char * param is defined as const. Could this make any impact on the problem described?

Flags: needinfo?(kaie)

(In reply to Nickolay Olshevsky from comment #15)

Password callback is defined in JS as the following:
...
However, in RNP first char * param is defined as const. Could this make any impact on the problem described?

It doesn't seem possible to declare a js-ctypes parameter as const.

I think "const" shouldn't have an effect on alignment etc. It's effect should be limited to telling a compiler to reject certain modification code, at compile time.

Flags: needinfo?(kaie)

from my understanding, in c++ any function signature difference can have an impact on parameter passing and alignment, which might explain the crash.. either way, i'm really open to try any suggestion/patch to gather more info, because so far for me this bug is a blocker to update thunderbird in our ports tree.

Maybe in C++, but in plain C I don't think it makes a difference.

Another two suspicious for me things are:

  • variable keep_password_cb_alive in RNPLib.jsm, which is set in init(). As name implies, it is set to password callback to keep it in memory. Could it happen somehow that on different system it still will be offloaded? Just a guess, not have a lot of knowledge on JS and how it works in this case.

  • usage of async/await in JS: while those work in a single thread, it still theoretically could give memory corruption problems when, for instance, you've got key handle in plans to do something with it afterwards, but during waiting for some external operation to finish another code part removed that key or it's secret part.

Attached patch t.patchSplinter Review

Landry, can you please test if this patch makes a difference?

Attachment #9175563 - Flags: feedback?(landry)

applied, started, in the console i have this (so the patch is in use):

Successfully loaded OpenPGP library librnp.so.35.0 from /usr/local/lib/thunderbird/librnp.so.35.0 RNPLib.jsm:46:13
==> RNPLib.enableRNPLibJS RNPLib.jsm:122:9
public keys: 2, secret keys: 2 RNPLib.jsm:194:15
2 protected and 0 unprotected keys

going to the key manager, rightclicking on a key (yeah, there's only one listed, even if the previous line said 2 ?), selecting 'revoke' and validating in the confirmation dialog triggers the crash. I'm not sure password_cb is entered at all... as before the segfault, i dont see any of the debug messages that your patch adds to password_cb. So definitely something wrong in the call to password_cb ?

some output from gdb, when live on the segfault:

(gdb) up
#1  0x00000c1fbfaacdc4 in rnp_password_cb_bounce (ctx=0x7f7ffffe52b8, password=0x7f7ffffe5160 "", password_size=256, 
    userdata_void=0xc2084d9ee80)
    at /usr/obj/ports/thunderbird-78.2.2/thunderbird-78.2.2/comm/third_party/rnp/src/lib/rnp.cpp:627
(gdb) p ctx
$2 = (const pgp_password_ctx_t *) 0x7f7ffffe52b8
(gdb) p *ctx
$3 = {op = 4 '\004', key = 0xc1ff83cc010}
(gdb) down
#0  0x00000c205a9feac0 in ?? ()
(gdb) p ctx
$1 = (Context *) 0x0

my gdb-fu is limited at that point.. something corrupts the args.

78.2.2 segfaults.
82.0a1 (from source) and 81.0b4 (openbsd port) work.
I suspect this revision fixed it, but I am unsure: https://hg.mozilla.org/mozilla-central/rev/6f6c608cb8df6eb7e326d16e7731eea7974f89e0

Details

I investigated building from source and was able to build 82.0a1 (2020-09-21) thunderbird daily. This actually did not have the segfault and I was able to generate a new openpgp key.

Before ./mach bootstrap I had to edit python/mozboot/mozboot/openbsd.py to comment out a lot of the lines that installed packages like self.run_as_root(['pkg_add', '-z'] + self.packages) and added in pass as a no-op. I did not want to run the script as root so I manually installed the packages.
https://developer.thunderbird.net/thunderbird-development/building-thunderbird/linux-build-prerequisites

I commented out build/moz.configure/warnings.configure:219:check_and_add_gcc_warning('-Werror=implicit-function-declaration') to get pass an implicit-function-declaration warning/error.

mozconfig:

mk_add_options MOZ_MAKE_FLAGS="-j11"
ac_add_options --disable-sandbox
ac_add_options --with-libclang-path=/usr/local/lib
ac_add_options --enable-application=comm/mail
ac_add_options --with-app-basename=Thunderbird

https://developer.thunderbird.net/thunderbird-development/building-thunderbird

ulimit -d 16000000
CARGOFLAGS="-j11" M4=/usr/local/bin/gm4 ./mach build

compilation error in toolkit/mozapps/update/updater/updater.cpp because of no stat64 on openbsd. I changed stat64 to stat here.

    struct stat64 st_buf;
    int test = stat64(foundpath, &st_buf);
    if (test) {
      closedir(dir);
      return UNEXPECTED_FILE_OPERATION_ERROR;
    }

running it produced a helpful error message and there was no openpgp menu visible in the end-to-end encryption section.

$ ./mach run                                                              
 0:00.81 /home/namtsui/workspace/thunderbird/source/obj-x86_64-unknown-openbsd6.8/dist/bin/thunderbird -no-remote -profile /home/namtsui/workspace/thunderbird/source/obj-x86_64-unknown-openbsd6.8/tmp/profile-default
[calBackendLoader] Using Thunderbird's ical.js backend
[MsgSendModuleLoader] Using nsMsgSend.cpp
console.debug: "Successfully loaded OpenPGP library librnp.so.1.0 from /home/namtsui/workspace/thunderbird/source/obj-x86_64-unknown-openbsd6.8/dist/bin/librnp.so.1.0"
console.log: (new Error("couldn't create closure - libffi error", "chrome://openpgp/content/modules/RNPLib.jsm", 153))
console.error: (new Error("couldn't open library libc.so.1.0: File not found", "resource:///modules/CLib.jsm", 46))
JavaScript error: resource:///modules/CLib.jsm, line 46: Error: couldn't open library libc.so.1.0: File not found

https://searchfox.org/comm-esr78/source/mail/extensions/openpgp/content/modules/RNPLib.jsm#153

From the libffi error, I looked at what the OpenBSD port does for devel/libffi. It is patched for RWX reasons as explained in revision 1.1 of this patch.
https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/devel/libffi/patches/patch-src_closures_c
https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/devel/libffi/patches/patch-src_closures_c?rev=1.2&content-type=text/x-cvsweb-markup

After applying this patch to closures.c, the console error for closure went away and I could see the openpgp menu. I could also generate a key.

At this point, I suspected this revision: https://hg.mozilla.org/mozilla-central/rev/6f6c608cb8df6eb7e326d16e7731eea7974f89e0
first appearing in 81.0a1.

https://ftp.mozilla.org/pub/thunderbird/releases/
I wanted to modify landry@'s OpenBSD port instead of building from source. 81.0b4 was the closest candidate available so I used landry@'s update for 78.2.2 and changed it to 81.0b4. It built but I needed to use this fix.

https://bugzilla.mozilla.org/show_bug.cgi?id=1661096
https://searchfox.org/mozilla-central/diff/4820139e53464b13fd588bd6c4f162d339ee9e83/dom/system/IOUtils.h#26

I'm also not fully convinced that closures.c patch is needed. 78.2.2 + closures.c patch segfaults. 81.0b4 + closures.c patch worked.

well, many thanks nam - it seems you're really onto something, as building 78.3.0rc1 using --with-system-ffi makes it use libffi 3.3 from OpenBSD packages, and the resulting build doesnt crash anymore when revoking a previously generated pgp key or generating a new pgp key. So far, 78.x build were done with the default bundled libffi 3.1.

Testing 78.2.2 --with-system-ffi after your hint worked, too. I was able to generate/revoke/delete a key and encrypted/decrypted a test e-mail.

Comment on attachment 9175563 [details] [diff] [review] t.patch Review of attachment 9175563 [details] [diff] [review]: ----------------------------------------------------------------- as i said in a previous comment it didnt help, building with libffi 3.3 worked around the crash
Attachment #9175563 - Flags: feedback?(landry) → feedback-

Glad you found the reason, which was outside of Thunderbird.
Sounds like this bug is no longer necessary.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID

(In reply to Kai Engert (:KaiE:) from comment #28)

Glad you found the reason, which was outside of Thunderbird.
Sounds like this bug is no longer necessary.

well technically afaiui it was a bug inside thunderbird 78 which bundles libffi 3.1 (which we were building against so far) so the libffi update in bug 1659906 (which landed in 81) would have actually fixed it ..

Thanks for clarifying. Is there any reason besides BSD that could support an uplift of bug 1659906 to esr78 ?

See Also: → 1659906

(In reply to Kai Engert (:KaiE:) from comment #30)

Thanks for clarifying. Is there any reason besides BSD that could support an uplift of bug 1659906 to esr78 ?

i think this would be risky, as it might have lots of side-effects.. ask glandium ? And it seems freebsd isnt affected, jan ? maybe only openbsd is affected because of stricter memory constraints in the kernel ?

Flags: needinfo?(jbeich)

(In reply to Landry Breuil (:gaston) from comment #31)

(In reply to Kai Engert (:KaiE:) from comment #30)

Thanks for clarifying. Is there any reason besides BSD that could support an uplift of bug 1659906 to esr78 ?

And it seems freebsd isnt affected, jan ?

I don't use Thunderbird but FreeBSD passes --enable-system-ffi downstream. However, when building Tor Browser using system libraries may not be a good idea.
http://beefy6.nyi.freebsd.org/data/latest-per-pkg/thunderbird/78.3.0_1/121amd64-default.log
https://www.freebsd.org/doc/en/books/porters-handbook/bundled-libs.html

Flags: needinfo?(jbeich)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: