Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test segfault on NetBSD #596

Closed
0-wiz-0 opened this issue Jan 28, 2017 · 17 comments

Comments

@0-wiz-0
Copy link

commented Jan 28, 2017

py-acme does not work on NetBSD. Tracking down the problem we first fixed an issue in cryptography (with help from @reaperhulk in pyca/cryptography#3372). Now I see a segfault in pyopenssl (after applying the patch from #595):

# python3.6 setup.py test
running test
running egg_info
writing src/pyOpenSSL.egg-info/PKG-INFO
writing dependency_links to src/pyOpenSSL.egg-info/dependency_links.txt
writing requirements to src/pyOpenSSL.egg-info/requires.txt
writing top-level names to src/pyOpenSSL.egg-info/top_level.txt
reading manifest file 'src/pyOpenSSL.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching 'leakcheck'
warning: no previously-included files matching '*.py' found under directory 'leakcheck'
warning: no previously-included files matching '*.pem' found under directory 'leakcheck'
no previously-included directories found matching 'doc/_build'
no previously-included directories found matching '.travis'
no previously-included directories found matching '.mention-bot'
writing manifest file 'src/pyOpenSSL.egg-info/SOURCES.txt'
running build_ext
test_add_revoked_keyword (tests.test_crypto.CRLTests) ... ok
test_add_revoked_wrong_args (tests.test_crypto.CRLTests) ... ok
test_construction (tests.test_crypto.CRLTests) ... ok
test_construction_wrong_args (tests.test_crypto.CRLTests) ... ok
test_dump_crl (tests.test_crypto.CRLTests) ... ok
test_export_custom_digest (tests.test_crypto.CRLTests) ... ok
test_export_default_digest (tests.test_crypto.CRLTests) ... ok
test_export_der (tests.test_crypto.CRLTests) ... /scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/test_crypto.py:3333: DeprecationWarning: The default message digest (md5) is deprecated.  
Pass the name of a message digest explicitly.
  dumped_crl = crl.export(self.cert, self.pkey, FILETYPE_ASN1)
ok
test_export_invalid (tests.test_crypto.CRLTests) ... /scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/util.py:283: DeprecationWarning: The default message digest (md5) is deprecated.  Pass
 the name of a message digest explicitly.
  f(*args, **kwargs)
ok
test_export_md5_digest (tests.test_crypto.CRLTests) ... ok
test_export_pem (tests.test_crypto.CRLTests) ... /scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/test_crypto.py:3313: DeprecationWarning: The default message digest (md5) is deprecated.  
Pass the name of a message digest explicitly.
  dumped_crl = crl.export(self.cert, self.pkey, days=20)
ok
test_export_text (tests.test_crypto.CRLTests) ... /scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/test_crypto.py:3351: DeprecationWarning: The default message digest (md5) is deprecated. 
 Pass the name of a message digest explicitly.
  dumped_crl = crl.export(self.cert, self.pkey, FILETYPE_ASN1)
/scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/test_crypto.py:3357: DeprecationWarning: The default message digest (md5) is deprecated.  Pass the name of a message digest explicitly.
  dumped_text = crl.export(self.cert, self.pkey, type=FILETYPE_TEXT)
ok
test_export_unknown_digest (tests.test_crypto.CRLTests) ... ok
test_export_unknown_filetype (tests.test_crypto.CRLTests) ... /scratch/security/py-OpenSSL/work/pyOpenSSL-16.2.0/tests/test_crypto.py:3448: DeprecationWarning: The default message digest (md5) is 
deprecated.  Pass the name of a message digest explicitly.
  crl.export(self.cert, self.pkey, 100, 10)
ok
test_export_wrong_args (tests.test_crypto.CRLTests) ... ok
test_get_issuer (tests.test_crypto.CRLTests) ... ok
test_get_revoked (tests.test_crypto.CRLTests) ... ok
test_get_revoked_wrong_args (tests.test_crypto.CRLTests) ... ok
test_load_crl (tests.test_crypto.CRLTests) ... ok
test_load_crl_bad_data (tests.test_crypto.CRLTests) ... ok
test_load_crl_bad_filetype (tests.test_crypto.CRLTests) ... ok
test_load_crl_wrong_args (tests.test_crypto.CRLTests) ... ok
test_verify_with_missing_crl (tests.test_crypto.CRLTests) ... ok
test_verify_with_revoked (tests.test_crypto.CRLTests) ... ok
test_anotherTypeEq (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_anotherTypeNe (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_delegateNe (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_delegatedEq (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_differentEq (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_differentNe (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_identicalEq (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_identicalNe (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_sameEq (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_sameNe (tests.test_crypto.EllipticCurveEqualityTests) ... ok
test_contains (tests.test_crypto.EllipticCurveHashTests) ... ok
test_does_not_contain (tests.test_crypto.EllipticCurveHashTests) ... ok
test_a_curve (tests.test_crypto.EllipticCurveTests) ... ok
test_not_a_curve (tests.test_crypto.EllipticCurveTests) ... ok
test_repr (tests.test_crypto.EllipticCurveTests) ... ok
test_set (tests.test_crypto.EllipticCurveTests) ... ok
test_some_curves (tests.test_crypto.EllipticCurveTests) ... ok
test_to_EC_KEY (tests.test_crypto.EllipticCurveTests) ... ok
test_dump_certificate (tests.test_crypto.FunctionTests) ... ok
test_dump_certificate_bad_type (tests.test_crypto.FunctionTests) ... ok
test_dump_certificate_request (tests.test_crypto.FunctionTests) ... ok
test_dump_privatekey_asn1 (tests.test_crypto.FunctionTests) ... writing RSA key
ok
test_dump_privatekey_invalid_filetype (tests.test_crypto.FunctionTests) ... ok
test_dump_privatekey_invalid_passphrase_type (tests.test_crypto.FunctionTests) ... ok
test_dump_privatekey_passphrase (tests.test_crypto.FunctionTests) ... ok
test_dump_privatekey_passphraseCallback (tests.test_crypto.FunctionTests) ... [1]   Segmentation fault (core dumped) (cd /scratch/sec...
*** Error code 139

The python backtrace is:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007b992bf2cf30 in ?? ()
(gdb) bt
#0  0x00007b992bf2cf30 in ?? ()
#1  0x00007b99258d7103 in do_pk8pkey (bp=bp@entry=0x7b99217184e0, x=x@entry=0x7b9921712d00, isder=isder@entry=0, nid=nid@entry=-1, enc=enc@entry=0x7b9925c1baa0, kstr=kstr@entry=0x0, klen=0, 
    cb=0x7b992bf2cf30, u=u@entry=0x0) at /disk/6/archive/foreign/src/crypto/external/bsd/openssl/dist/crypto/pem/pem_pk8.c:128
#2  0x00007b99258d724e in PEM_write_bio_PKCS8PrivateKey (bp=bp@entry=0x7b99217184e0, x=x@entry=0x7b9921712d00, enc=enc@entry=0x7b9925c1baa0, kstr=kstr@entry=0x0, klen=<optimized out>, 
    cb=<optimized out>, u=u@entry=0x0) at /disk/6/archive/foreign/src/crypto/external/bsd/openssl/dist/crypto/pem/pem_pk8.c:94
#3  0x00007b99258d6818 in PEM_write_bio_PrivateKey (bp=0x7b99217184e0, x=0x7b9921712d00, enc=0x7b9925c1baa0, kstr=0x0, klen=klen@entry=0, cb=cb@entry=0x7b992bf2cf30, u=0x0)
    at /disk/6/archive/foreign/src/crypto/external/bsd/openssl/dist/crypto/pem/pem_pkey.c:155
#4  0x00007b992146b3f9 in _cffi_f_PEM_write_bio_PrivateKey (self=<optimized out>, args=<optimized out>) at build/temp.netbsd-7.99.59-amd64-3.6/_openssl.c:43042
#5  0x00007b992bab3fdc in _PyCFunction_FastCallDict (func_obj=func_obj@entry=0x7b99269cc8a8, args=0x7b992170fde0, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/methodobject.c:234
#6  0x00007b992bab431e in _PyCFunction_FastCallKeywords (func=func@entry=0x7b99269cc8a8, stack=<optimized out>, nargs=nargs@entry=7, kwnames=kwnames@entry=0x0) at Objects/methodobject.c:295
#7  0x00007b992bb2bc90 in call_function (pp_stack=pp_stack@entry=0x7f7fffc75ba0, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4788
#8  0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b992170fc18, throwflag=<optimized out>) at Python/ceval.c:3275
#9  0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=0x7b99253e4f70, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7b992171f3d0, argcount=4, kwnames=0x0, 
    kwargs=kwargs@entry=0x7b992171f3f0, kwcount=0, kwstep=kwstep@entry=1, defs=0x7b99253ed4f0, defcount=2, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7b9927590080, 
    qualname=qualname@entry=0x7b9927590080) at Python/ceval.c:4119
#10 0x00007b992bb2b922 in fast_function (func=<optimized out>, stack=0x7b992171f3d0, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4929
#11 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc75ef0, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#12 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b992171f218, throwflag=<optimized out>) at Python/ceval.c:3275
#13 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=0x7b9925d469d0, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7b992170f200, argcount=1, kwnames=0x0, 
    kwargs=kwargs@entry=0x7b992170f208, kwcount=0, kwstep=kwstep@entry=1, defs=0x0, defcount=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7b9927144920, 
    qualname=qualname@entry=0x7b9925d51580) at Python/ceval.c:4119
#14 0x00007b992bb2b922 in fast_function (func=<optimized out>, stack=0x7b992170f200, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4929
#15 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc76240, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#16 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b992170f018, throwflag=<optimized out>) at Python/ceval.c:3275
#17 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=0x7b99281f1f60, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7b9921728120, argcount=2, kwnames=0x0, 
    kwargs=kwargs@entry=0x7b9921728130, kwcount=0, kwstep=kwstep@entry=1, defs=0x7b99281f6bf0, defcount=1, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7b992ada6d40, 
    qualname=qualname@entry=0x7b99281c9f40) at Python/ceval.c:4119
#18 0x00007b992bb2b922 in fast_function (func=<optimized out>, stack=0x7b9921728120, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4929
#19 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc76590, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#20 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9921727f78, throwflag=<optimized out>) at Python/ceval.c:3275
#21 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b99253657d0, globals=globals@entry=0x7b99261c2b68, locals=locals@entry=0x0, args=args@entry=0x7f7fffc76870, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x7b992b9060b0, kwargs=kwargs@entry=0x7b992b9060b8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, 
    closure=0x7b99253a2158, name=0x7b992ada6d40, qualname=0x7b9924b0de80) at Python/ceval.c:4119
#22 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b992331c098, args=args@entry=0x7f7fffc76870, nargs=2, kwargs=kwargs@entry=0x7b992171cd58) at Python/ceval.c:5021
#23 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b992331c098, args=args@entry=0x7f7fffc76870, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7b992171cd58)
    at Objects/abstract.c:2295
#24 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b992331c098, obj=<optimized out>, args=0x7b9921712b18, kwargs=0x7b992171cd58) at Objects/abstract.c:2358
#25 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c7c58, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#26 0x00007b992bb30754 in do_call_core (kwdict=0x7b992171cd58, callargs=0x7b9921712b18, func=0x7b99237c7c58) at Python/ceval.c:5057
#27 _PyEval_EvalFrameDefault (f=0x7b992172da98, throwflag=<optimized out>) at Python/ceval.c:3357
#28 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b99281f2080, globals=globals@entry=0x7b992815cc08, locals=locals@entry=0x0, args=args@entry=0x7f7fffc76ce0, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, 
    name=0x7b992b90f1c0, qualname=0x7b99281cbf20) at Python/ceval.c:4119
#29 0x00007b992bb33fab in _PyFunction_FastCallDict (func=func@entry=0x7b9927d10d48, args=args@entry=0x7f7fffc76ce0, nargs=2, kwargs=kwargs@entry=0x0) at Python/ceval.c:5021
#30 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b9927d10d48, args=args@entry=0x7f7fffc76ce0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#31 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b9927d10d48, obj=<optimized out>, args=0x7b99223e7898, kwargs=0x0) at Objects/abstract.c:2358
#32 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c7198, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#33 0x00007b992bacd569 in slot_tp_call (self=self@entry=0x7b9923b0bb58, args=args@entry=0x7b99223e7898, kwds=kwds@entry=0x0) at Objects/typeobject.c:6167
#34 0x00007b992ba669b7 in _PyObject_FastCallDict (func=func@entry=0x7b9923b0bb58, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#35 0x00007b992ba66ff9 in _PyObject_FastCallKeywords (func=func@entry=0x7b9923b0bb58, stack=<optimized out>, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#36 0x00007b992bb2baf0 in call_function (pp_stack=pp_stack@entry=0x7f7fffc76f70, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4812
#37 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99223e9778, throwflag=<optimized out>) at Python/ceval.c:3275
#38 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d61040, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc77250,
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x7b992b9060b0, kwargs=kwargs@entry=0x7b992b9060b8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x7b9927d45570, defcount=1,
    kwdefs=0x0, closure=0x0, name=0x7b992ada6d40, qualname=0x7b9927d451c0) at Python/ceval.c:4119
#39 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc77250, nargs=2, kwargs=kwargs@entry=0x7b992758f028) at Python/ceval.c:5021
#40 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc77250, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7b992758f028)
    at Objects/abstract.c:2295
#41 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d1d48, obj=<optimized out>, args=0x7b9922b885d8, kwargs=0x7b992758f028) at Objects/abstract.c:2358
#42 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c7ad8, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#43 0x00007b992bb30754 in do_call_core (kwdict=0x7b992758f028, callargs=0x7b9922b885d8, func=0x7b99237c7ad8) at Python/ceval.c:5057
#44 _PyEval_EvalFrameDefault (f=0x7b9922368b38, throwflag=<optimized out>) at Python/ceval.c:3357
#45 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d60e90, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc776c0, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, 
    name=0x7b992b90f1c0, qualname=0x7b9927d654d0) at Python/ceval.c:4119
#46 0x00007b992bb33fab in _PyFunction_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc776c0, nargs=2, kwargs=kwargs@entry=0x0) at Python/ceval.c:5021
#47 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc776c0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#48 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d19e8, obj=<optimized out>, args=0x7b99237dc998, kwargs=0x0) at Objects/abstract.c:2358
#49 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c72d8, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#50 0x00007b992bacd569 in slot_tp_call (self=self@entry=0x7b9923b01258, args=args@entry=0x7b99237dc998, kwds=kwds@entry=0x0) at Objects/typeobject.c:6167
#51 0x00007b992ba669b7 in _PyObject_FastCallDict (func=func@entry=0x7b9923b01258, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#52 0x00007b992ba66ff9 in _PyObject_FastCallKeywords (func=func@entry=0x7b9923b01258, stack=<optimized out>, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#53 0x00007b992bb2baf0 in call_function (pp_stack=pp_stack@entry=0x7f7fffc77950, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4812
#54 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99237e7c18, throwflag=<optimized out>) at Python/ceval.c:3275
#55 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d61040, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc77c30, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x7b992b9060b0, kwargs=kwargs@entry=0x7b992b9060b8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x7b9927d45570, defcount=1, 
    kwdefs=0x0, closure=0x0, name=0x7b992ada6d40, qualname=0x7b9927d451c0) at Python/ceval.c:4119
#56 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc77c30, nargs=2, kwargs=kwargs@entry=0x7b992757d578) at Python/ceval.c:5021
#57 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc77c30, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7b992757d578)
    at Objects/abstract.c:2295
#58 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d1d48, obj=<optimized out>, args=0x7b99237c85d8, kwargs=0x7b992757d578) at Objects/abstract.c:2358
#59 0x00007b992ba66823 in PyObject_Call (func=0x7b99237b0f98, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#60 0x00007b992bb30754 in do_call_core (kwdict=0x7b992757d578, callargs=0x7b99237c85d8, func=0x7b99237b0f98) at Python/ceval.c:5057
#61 _PyEval_EvalFrameDefault (f=0x7b9922366528, throwflag=<optimized out>) at Python/ceval.c:3357
#62 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d60e90, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc780a0, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, 
    name=0x7b992b90f1c0, qualname=0x7b9927d654d0) at Python/ceval.c:4119
#63 0x00007b992bb33fab in _PyFunction_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc780a0, nargs=2, kwargs=kwargs@entry=0x0) at Python/ceval.c:5021
#64 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc780a0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#65 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d19e8, obj=<optimized out>, args=0x7b99237f0658, kwargs=0x0) at Objects/abstract.c:2358
#66 0x00007b992ba66823 in PyObject_Call (func=0x7b99237af558, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#67 0x00007b992bacd569 in slot_tp_call (self=self@entry=0x7b992334ac18, args=args@entry=0x7b99237f0658, kwds=kwds@entry=0x0) at Objects/typeobject.c:6167
#68 0x00007b992ba669b7 in _PyObject_FastCallDict (func=func@entry=0x7b992334ac18, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#69 0x00007b992ba66ff9 in _PyObject_FastCallKeywords (func=func@entry=0x7b992334ac18, stack=<optimized out>, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#70 0x00007b992bb2baf0 in call_function (pp_stack=pp_stack@entry=0x7f7fffc78330, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4812
#71 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99237a8c18, throwflag=<optimized out>) at Python/ceval.c:3275
#72 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d61040, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc78610, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x7b992b9060b0, kwargs=kwargs@entry=0x7b992b9060b8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x7b9927d45570, defcount=1, 
    kwdefs=0x0, closure=0x0, name=0x7b992ada6d40, qualname=0x7b9927d451c0) at Python/ceval.c:4119
#73 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc78610, nargs=2, kwargs=kwargs@entry=0x7b99223e4f38) at Python/ceval.c:5021
#74 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc78610, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7b99223e4f38)
    at Objects/abstract.c:2295
#75 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d1d48, obj=<optimized out>, args=0x7b99233e1358, kwargs=0x7b99223e4f38) at Objects/abstract.c:2358
#76 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c7498, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#77 0x00007b992bb30754 in do_call_core (kwdict=0x7b99223e4f38, callargs=0x7b99233e1358, func=0x7b99237c7498) at Python/ceval.c:5057
#78 _PyEval_EvalFrameDefault (f=0x7b9923fe47d8, throwflag=<optimized out>) at Python/ceval.c:3357
#79 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d60e90, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc78a80, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, 
    name=0x7b992b90f1c0, qualname=0x7b9927d654d0) at Python/ceval.c:4119
#80 0x00007b992bb33fab in _PyFunction_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc78a80, nargs=2, kwargs=kwargs@entry=0x0) at Python/ceval.c:5021
#81 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc78a80, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#82 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d19e8, obj=<optimized out>, args=0x7b992790f598, kwargs=0x0) at Objects/abstract.c:2358
#83 0x00007b992ba66823 in PyObject_Call (func=0x7b99237b0b98, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#84 0x00007b992bacd569 in slot_tp_call (self=self@entry=0x7b992235f118, args=args@entry=0x7b992790f598, kwds=kwds@entry=0x0) at Objects/typeobject.c:6167
#85 0x00007b992ba669b7 in _PyObject_FastCallDict (func=func@entry=0x7b992235f118, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#86 0x00007b992ba66ff9 in _PyObject_FastCallKeywords (func=func@entry=0x7b992235f118, stack=<optimized out>, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#87 0x00007b992bb2baf0 in call_function (pp_stack=pp_stack@entry=0x7f7fffc78d10, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4812
#88 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99237e9418, throwflag=<optimized out>) at Python/ceval.c:3275
#89 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d61040, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc78ff0, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x7b992b9060b0, kwargs=kwargs@entry=0x7b992b9060b8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x7b9927d45570, defcount=1, 
    kwdefs=0x0, closure=0x0, name=0x7b992ada6d40, qualname=0x7b9927d451c0) at Python/ceval.c:4119
#90 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc78ff0, nargs=2, kwargs=kwargs@entry=0x7b99223e4ee8) at Python/ceval.c:5021
#91 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d1d48, args=args@entry=0x7f7fffc78ff0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7b99223e4ee8)
    at Objects/abstract.c:2295
#92 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d1d48, obj=<optimized out>, args=0x7b992759dc58, kwargs=0x7b99223e4ee8) at Objects/abstract.c:2358
#93 0x00007b992ba66823 in PyObject_Call (func=0x7b99237c7718, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#94 0x00007b992bb30754 in do_call_core (kwdict=0x7b99223e4ee8, callargs=0x7b992759dc58, func=0x7b99237c7718) at Python/ceval.c:5057
#95 _PyEval_EvalFrameDefault (f=0x7b9923fd90a8, throwflag=<optimized out>) at Python/ceval.c:3357
#96 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d60e90, globals=globals@entry=0x7b992815bbc8, locals=locals@entry=0x0, args=args@entry=0x7f7fffc79460, 
    argcount=argcount@entry=2, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, 
    name=0x7b992b90f1c0, qualname=0x7b9927d654d0) at Python/ceval.c:4119
#97 0x00007b992bb33fab in _PyFunction_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc79460, nargs=2, kwargs=kwargs@entry=0x0) at Python/ceval.c:5021
#98 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b99281d19e8, args=args@entry=0x7f7fffc79460, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2295
#99 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b99281d19e8, obj=<optimized out>, args=0x7b9927d6e158, kwargs=0x0) at Objects/abstract.c:2358
#100 0x00007b992ba66823 in PyObject_Call (func=0x7b99237afa98, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#101 0x00007b992bacd569 in slot_tp_call (self=self@entry=0x7b992235f498, args=args@entry=0x7b9927d6e158, kwds=kwds@entry=0x0) at Objects/typeobject.c:6167
#102 0x00007b992ba669b7 in _PyObject_FastCallDict (func=func@entry=0x7b992235f498, args=<optimized out>, nargs=<optimized out>, kwargs=kwargs@entry=0x0) at Objects/abstract.c:2316
#103 0x00007b992ba66ff9 in _PyObject_FastCallKeywords (func=func@entry=0x7b992235f498, stack=<optimized out>, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at Objects/abstract.c:2480
#104 0x00007b992bb2baf0 in call_function (pp_stack=pp_stack@entry=0x7f7fffc796f0, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4812
#105 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9922381c18, throwflag=<optimized out>) at Python/ceval.c:3275
#106 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=2, globals=<optimized out>) at Python/ceval.c:4870
#107 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#108 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc798f0, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#109 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9927571c18, throwflag=<optimized out>) at Python/ceval.c:3275
#110 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4870
#111 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#112 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc79af0, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#113 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9927576018, throwflag=<optimized out>) at Python/ceval.c:3275
#114 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b9927d43a60, globals=globals@entry=0x7b992add8618, locals=locals@entry=0x0, args=args@entry=0x7f7fffc79dd0, 
    argcount=argcount@entry=4, kwnames=kwnames@entry=0x7b9927557950, kwargs=kwargs@entry=0x7b9927557958, kwcount=6, kwcount@entry=3, kwstep=kwstep@entry=2, defs=0x7b9927d76610, defcount=11, 
    kwdefs=0x7b99285f6fd8, closure=0x0, name=0x7b992b90f500, qualname=0x7b9927d6fed0) at Python/ceval.c:4119
#115 0x00007b992bb33eba in _PyFunction_FastCallDict (func=func@entry=0x7b9927d76838, args=args@entry=0x7f7fffc79dd0, nargs=4, kwargs=kwargs@entry=0x7b9927588ad8) at Python/ceval.c:5021
#116 0x00007b992ba66a98 in _PyObject_FastCallDict (func=func@entry=0x7b9927d76838, args=args@entry=0x7f7fffc79dd0, nargs=nargs@entry=4, kwargs=kwargs@entry=0x7b9927588ad8)
    at Objects/abstract.c:2295
#117 0x00007b992ba66c72 in _PyObject_Call_Prepend (func=0x7b9927d76838, obj=<optimized out>, args=0x7b992757cf38, kwargs=0x7b9927588ad8) at Objects/abstract.c:2358
#118 0x00007b992ba66823 in PyObject_Call (func=0x7b99281b4ad8, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#119 0x00007b992bacd262 in slot_tp_init (self=<optimized out>, args=0x7b992757cf38, kwds=0x7b9927588ad8) at Objects/typeobject.c:6380
#120 0x00007b992bac95a7 in type_call (type=<optimized out>, args=0x7b992757cf38, kwds=0x7b9927588ad8) at Objects/typeobject.c:915
#121 0x00007b992ba66823 in PyObject_Call (func=0x7b9927d7b418, args=<optimized out>, kwargs=<optimized out>) at Objects/abstract.c:2246
#122 0x00007b992bb30754 in do_call_core (kwdict=0x7b9927588ad8, callargs=0x7b992757cf38, func=0x7b9927d7b418) at Python/ceval.c:5057
#123 _PyEval_EvalFrameDefault (f=0x7b992814d818, throwflag=<optimized out>) at Python/ceval.c:3357
#124 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4870
#125 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#126 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc7a230, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#127 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99285f4818, throwflag=<optimized out>) at Python/ceval.c:3275
#128 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4870
#129 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#130 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc7a430, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#131 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9928182018, throwflag=<optimized out>) at Python/ceval.c:3275
#132 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=2, globals=<optimized out>) at Python/ceval.c:4870
#133 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#134 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc7a630, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#135 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b99285f5818, throwflag=<optimized out>) at Python/ceval.c:3275
#136 0x00007b992bb2ad6c in _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Python/ceval.c:4870
#137 0x00007b992bb2ba32 in fast_function (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4912
#138 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc7a830, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4809
#139 0x00007b992bb2eab2 in _PyEval_EvalFrameDefault (f=0x7b9928147818, throwflag=<optimized out>) at Python/ceval.c:3275
#140 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=0x7b992b1f8a50, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7b992b1ac998, argcount=0, kwnames=0x7b992b967770, 
    kwargs=kwargs@entry=0x7b992b1ac998, kwcount=14, kwstep=kwstep@entry=1, defs=0x0, defcount=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7b992b5601c0, 
    qualname=qualname@entry=0x7b992b5601c0) at Python/ceval.c:4119
#141 0x00007b992bb2b922 in fast_function (func=<optimized out>, stack=0x7b992b1ac998, nargs=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:4929
#142 0x00007b992bb2bb9b in call_function (pp_stack=pp_stack@entry=0x7f7fffc7ab88, oparg=<optimized out>, kwnames=kwnames@entry=0x7b992b967758) at Python/ceval.c:4809
#143 0x00007b992bb2d22f in _PyEval_EvalFrameDefault (f=0x7b992b1ac818, throwflag=<optimized out>) at Python/ceval.c:3291
#144 0x00007b992bb2b753 in _PyEval_EvalCodeWithName (_co=_co@entry=0x7b992b1669d0, globals=globals@entry=0x7b992b556a78, locals=locals@entry=0x7b992b556a78, args=args@entry=0x0, 
    argcount=argcount@entry=0, kwnames=kwnames@entry=0x0, kwargs=kwargs@entry=0x8, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=defs@entry=0x0, defcount=defcount@entry=0, 
    kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x0, qualname=qualname@entry=0x0) at Python/ceval.c:4119
#145 0x00007b992bb2bdcb in PyEval_EvalCodeEx (_co=_co@entry=0x7b992b1669d0, globals=globals@entry=0x7b992b556a78, locals=locals@entry=0x7b992b556a78, args=args@entry=0x0, 
    argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0)
    at Python/ceval.c:4140
#146 0x00007b992bb2be32 in PyEval_EvalCode (co=co@entry=0x7b992b1669d0, globals=globals@entry=0x7b992b556a78, locals=locals@entry=0x7b992b556a78) at Python/ceval.c:695
#147 0x00007b992bb57128 in run_mod (mod=mod@entry=0x7b992b1cc828, filename=filename@entry=0x7b992b55ff00, globals=globals@entry=0x7b992b556a78, locals=locals@entry=0x7b992b556a78, 
    flags=flags@entry=0x7f7fffc7af50, arena=arena@entry=0x7b992b9023e0) at Python/pythonrun.c:980
#148 0x00007b992bb595e8 in PyRun_FileExFlags (fp=fp@entry=0x7b992a97f7a0, filename_str=filename_str@entry=0x7b992b111d90 "setup.py", start=start@entry=257, globals=globals@entry=0x7b992b556a78, 
    locals=locals@entry=0x7b992b556a78, closeit=closeit@entry=1, flags=flags@entry=0x7f7fffc7af50) at Python/pythonrun.c:933
#149 0x00007b992bb59750 in PyRun_SimpleFileExFlags (fp=fp@entry=0x7b992a97f7a0, filename=<optimized out>, closeit=closeit@entry=1, flags=flags@entry=0x7f7fffc7af50) at Python/pythonrun.c:396
#150 0x00007b992bb59b9b in PyRun_AnyFileExFlags (fp=fp@entry=0x7b992a97f7a0, filename=<optimized out>, closeit=closeit@entry=1, flags=flags@entry=0x7f7fffc7af50) at Python/pythonrun.c:80
#151 0x00007b992bb70b31 in run_file (p_cf=0x7f7fffc7af50, filename=0x7b992b906050 L"setup.py", fp=0x7b992a97f7a0) at Modules/main.c:320
#152 Py_Main (argc=argc@entry=3, argv=argv@entry=0x7b992b901060) at Modules/main.c:780
#153 0x0000000000400dd4 in main (argc=3, argv=0x7f7fffc7b0e0) at ./Programs/python.c:69

That's with python-3.6.0 and openssl-1.0.2j in case it matters.

I'm new to pypi. Any ideas on how to track this down?

@hynek

This comment has been minimized.

Copy link
Contributor

commented Jan 28, 2017

By looking only at the test log, it seems like the crash happens in a callback-related test. i would assume it's the exact same crash as in cryptography.

@reaperhulk

This comment has been minimized.

Copy link
Member

commented Jan 28, 2017

Unfortunately the nature of the static callbacks workaround in cryptography is not one that pyOpenSSL can pursue. This means we need a reduced test case so we can (probably) submit a bug to cffi.

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jan 28, 2017

wiz
Updated py-OpenSSL to 16.2.0.
Add patch that makes tests on NetBSD progress further.
But then there's a segfault. See
pyca/pyopenssl#596

16.2.0 (2016-10-15)
-------------------

Changes:
^^^^^^^^

- Fixed compatibility errors with OpenSSL 1.1.0.
- Fixed an issue that caused failures with subinterpreters and embedded Pythons.
  `#552 <https://github.com/pyca/pyopenssl/pull/552>`_


16.1.0 (2016-08-26)
-------------------

Deprecations:
^^^^^^^^^^^^^

- Dropped support for OpenSSL 0.9.8.


Changes:
^^^^^^^^

- Fix memory leak in ``OpenSSL.crypto.dump_privatekey()`` with ``FILETYPE_TEXT``.
  `#496 <https://github.com/pyca/pyopenssl/pull/496>`_
- Enable use of CRL (and more) in verify context.
  `#483 <https://github.com/pyca/pyopenssl/pull/483>`_
- ``OpenSSL.crypto.PKey`` can now be constructed from ``cryptography`` objects and also exported as such.
  `#439 <https://github.com/pyca/pyopenssl/pull/439>`_
- Support newer versions of ``cryptography`` which use opaque structs for OpenSSL 1.1.0 compatibility.
@arigo

This comment has been minimized.

Copy link

commented Jan 28, 2017

I think cffi is not the issue there. It fails its ffi.callback() tests too, indeed, but it works fine elsewhere. The problem might be in libffi instead. There are several reasons for why I marked ffi.callback() as deprecated, and this is one of them: it involves different paths inside libffi, which are typically less well-tested. And indeed, apparently libffi fails a third of its own tests on NetBSD...

@0-wiz-0

This comment has been minimized.

Copy link
Author

commented Jan 28, 2017

Converting to new-style callbacks might help, see https://cffi.readthedocs.io/en/latest/using.html#id3

@arigo

This comment has been minimized.

Copy link

commented Jan 28, 2017

@reaperhulk: for reference, you call it a "workaround" in cryptography, but I call it a clean up: it's a move away from the general mess of libffi callbacks, which keep hurting users on less-common architectures or with hardened systems.

@reaperhulk

This comment has been minimized.

Copy link
Member

commented Jan 29, 2017

@arigo no argument, I only called it a workaround since it just changed the code path rather than attempting to understand the underlying issue 😄

Unfortunately switching to static callbacks in pyOpenSSL is more challenging as it will require us to define them in cryptography (even though it does not use them) so that pyOpenSSL can consume them. That's doable, but unfortunate from a code organization standpoint.

@arigo

This comment has been minimized.

Copy link

commented Jan 29, 2017

and I suppose you don't want to add a compilation step to pyopenssl, even though a similar compilation step is needed for cryptography?

@hynek

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2017

It’s not really “even though”. We were really happy to make pyOpenSSL Python-only and focus all compiler weirdnesses on cryptography that comes with the appropriate (HUGE) fleet of CI builders.

Keeping all C stuff in cryptography seems like the most pragmatic solution to me ATM.

This also touches #595. :|

@reaperhulk

This comment has been minimized.

Copy link
Member

commented Jan 29, 2017

@arigo Yeah I'd rather deal with it in cryptography since we have all the wheel and testing infrastructure in place.

I think @tiran will find this interesting since he has previously wanted to make pyOpenSSL use static callbacks defined in cryptography and we were resistant at the time. Seems like it's time to revisit that.

@tiran

This comment has been minimized.

Copy link

commented Jan 29, 2017

I looked into the matter when I assisted @arigo with testing new static callback and when I ported cryptography to static callbacks. It's doable but it would be a humongous undertaking in both PyOpenSSL and cryptography. Some OpenSSL callbacks take a user specified void ptr, some callbacks have to store context data on a struct.

  1. Add bindings for get/set ex data functions ( SSL_get_ex_data) to cryptography to store data on a ssl or ssl context instance.
  2. Add an API to abstract get/set data ex data to cryptography. It's necessary to have an API in cryptogrpahy since cffi static callbacks are process globals.
  3. Redesign and rewrite all of PyOpenSSL's callback code to use the new API.
@tiran

This comment has been minimized.

Copy link

commented Jan 29, 2017

@reaperhulk Yeah, I lost interest as soon as I realized the amount of work. I'm not sure if @hynek can stomach a major rewrite, too.

@hynek

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2017

I’d certainly not be happy and I’d even more certainly not actually do it.

However it seems like the current callback situation is problematic. I dare to guess that #447 might be related too? So if we could form task force of people interested (and competent) for this kind of work, I’d more likely help than obstruct.

@arigo

This comment has been minimized.

Copy link

commented Jan 30, 2017

I would be happy to take part in a "task force" to try to improve the libffi situation. However, we need ssh access to various relatively uncommon systems. Last time I looked, cffi's tests were more comprehensive than libffi's own tests for this kind of problems, so that's a good starting point.

There is also the issue on hardened systems, which libffi solves using the wrong approach because it can crash after fork() in a security-exploitable manner; it could also be fixed inside libffi with enough efforts. It's harder work, though. (Fixing it would solve the uneasiness I have seeing a security-oriented library like pyopenssl using a feature that requires disabling some security checks on hardened systems.)

@reaperhulk

This comment has been minimized.

Copy link
Member

commented Jan 30, 2017

This seems like a good long term idea since libffi is critical software. I don't know that I have the technical expertise in this arena to assist, but I can definitely organize access to systems. Outside of NetBSD what would you hypothetically like to have access to Armin?

@hynek

This comment has been minimized.

Copy link
Contributor

commented Jan 30, 2017

This is all great news! Frankly we need at least one expert on cffi (and I wouldn’t know anyone better than Armin :)) and at least one for OpenSSL. So if @tiran and @reaperhulk could share something…I’m happy to help out too, but I’m still mainly the janitor around here. :D

@0-wiz-0

This comment has been minimized.

Copy link
Author

commented Jul 1, 2017

libffi is fixed, at least on NetBSD 8.99.1 with the latest libffi from pkgsrc, see libffi/libffi#294
py-cffi remains troublesome, see https://bitbucket.org/cffi/cffi/issues/321/cffi-191-segmentation-fault-during-self
I'm happy to give shell access to anyone who wants to work on this, contact me privately with your ssh key.

@0-wiz-0

This comment has been minimized.

Copy link
Author

commented Jul 3, 2017

@jsonn fixed cffi (see https://bitbucket.org/cffi/cffi/issues/321/cffi-191-segmentation-fault-during-self). I don't see any segfaults in pyopenssl any longer, I'll report other test failures separately.

@0-wiz-0 0-wiz-0 closed this Jul 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.