This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, gregory.p.smith, martin.panter, miss-islington, pablogsal, vstinner
Date 2022-03-10.17:10:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I enabled the test on ASAN on test_crypt and I confirm that I get a crash on calling a NULL function.

The Python crypt.crypt() function calls the C function crypt_r() which is intercepted by libasan, but the libasan implementation calls a NULL function. I don't know why.

$ ./configure --with-address-sanitizer --with-pydebug
$ make clean
$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" make
$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" gdb -args ./python -m test -v test_crypt 
(gdb) run
0:00:00 load avg: 0.53 Run tests sequentially
0:00:00 load avg: 0.53 [1/1] test_crypt

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff761189f in __interceptor_crypt_r.part.0 () from /lib64/
#2  0x00007fffe6a40821 in crypt_crypt_impl (module=<module at remote 0x6080004ae7c0>, word=0xfcb050 <importlib.bootstrap_external_toplevel_consts_7+48> "", salt=0x6080004bc660 "$6$d8Imx7a5WbE12iK4")
    at /home/vstinner/python/main/Modules/_cryptmodule.c:44
#3  0x00007fffe6a40695 in crypt_crypt (module=<module at remote 0x6080004ae7c0>, args=0x629000001368, nargs=2) at /home/vstinner/python/main/Modules/clinic/_cryptmodule.c.h:58

$ ASAN_OPTIONS="detect_leaks=0:allocator_may_return_null=1:handle_segv=0" ./python -m test -v test_crypt 
0:00:00 load avg: 0.56 Run tests sequentially
0:00:00 load avg: 0.56 [1/1] test_crypt
Fatal Python error: Segmentation fault

Current thread 0x00007f367c6c77c0 (most recent call first):
  File "/home/vstinner/python/main/Lib/", line 82 in crypt
  File "/home/vstinner/python/main/Lib/", line 94 in _add_method
  File "/home/vstinner/python/main/Lib/", line 105 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 931 in exec_module
  File "<frozen importlib._bootstrap>", line 690 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1149 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1178 in _find_and_load
  File "/home/vstinner/python/main/Lib/test/", line 6 in <module>
Date User Action Args
2022-03-10 17:10:29vstinnersetrecipients: + vstinner, gregory.p.smith, christian.heimes, martin.panter, pablogsal, miss-islington
2022-03-10 17:10:29vstinnersetmessageid: <>
2022-03-10 17:10:29vstinnerlinkissue46913 messages
2022-03-10 17:10:29vstinnercreate