STINNER Victor <vstin...@python.org> added the comment:

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/libasan.so.6
#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/crypt.py", line 82 in crypt
  File "/home/vstinner/python/main/Lib/crypt.py", line 94 in _add_method
  File "/home/vstinner/python/main/Lib/crypt.py", 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/test_crypt.py", line 6 in <module>
  (...)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46913>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to