Message406578
Hi,
Context
=======
we are compiling a dll with clang and it's address sanitizer and loading it via cffi, at random spots ASAN complains with bad-free.
==15100==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x01991a850310 in thread T0
#0 0x7ffa1dcc7f31 (C:\LLVM-13.0.0-win64\lib\clang\13.0.0\lib\windows\clang_rt.asan_dynamic-x86_64.dll+0x180037f31)
#1 0x7ffa3aea59ec in _PyObject_Realloc D:\_w\1\s\Objects\obmalloc.c:2011
#2 0x7ffa3af7f347 in _PyObject_GC_Resize D:\_w\1\s\Modules\gcmodule.c:2309
#3 0x7ffa3aedeeaa in _PyEval_EvalCode D:\_w\1\s\Python\ceval.c:4101
...
See links below for a full trace
The project where we see this it's quite complex and with many moving parts therefore we made a minimal reproducible example.
Reprex
======
The test boils down to the following:
win32api.LoadLibrary("LLVM-13.0.0-win64/lib/clang/13.0.0/lib/windows/clang_rt.asan_dynamic-x86_64.dll")
import hello # hello is our compiled c extension with clang and ASAN
print(hello.system())
import pdb
If if comment the last line (import pdb) ASAN does not complain.
If instead of import pdb you import numpy the same problem can be seen.
See the following failing build https://github.com/FrancescElies/min_reprex_python_c_extension_asan/runs/4263693010?check_suite_focus=true
See here the CI test https://github.com/FrancescElies/min_reprex_python_c_extension_asan/blob/d966d3a472df71977dc6519a76be0120d2d58d39/test.py
We did not try this in linux yet, would that help?
Is this a bug? Or are we doing something wrong?
Thanks in advance for your time. |
|
Date |
User |
Action |
Args |
2021-11-19 12:06:17 | FrancescElies | set | recipients:
+ FrancescElies, paul.moore, tim.golden, zach.ware, steve.dower |
2021-11-19 12:06:17 | FrancescElies | set | messageid: <1637323577.79.0.578225391074.issue45842@roundup.psfhosted.org> |
2021-11-19 12:06:17 | FrancescElies | link | issue45842 messages |
2021-11-19 12:06:17 | FrancescElies | create | |
|