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

LeakSanitizer at build time using --with-address-sanitizer on Ubuntu 22.04 #AddressSanitizer #ASAN #104791

Closed
gpshead opened this issue May 23, 2023 · 2 comments
Labels
type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@gpshead
Copy link
Member

gpshead commented May 23, 2023

Using the 3.13a0 main branch (or the 3.12 branch at 3.12b1) on Ubuntu Linux 22.04 with gcc 11.3:

b$ ../cpython/configure --with-address-sanitizer --without-pymalloc --with-pydebug
b$ make
...
Checked 111 modules (31 built-in, 79 shared, 1 n/a on linux-x86_64, 0 disabled, 0 missing, 0 failed on import)

=================================================================
==31517==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f128655b867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55bb37a4ee85 in _PyMem_RawMalloc ../cpython/Objects/obmalloc.c:42
    #2 0x55bb37a4f066 in _PyMem_DebugRawAlloc ../cpython/Objects/obmalloc.c:1971
    #3 0x55bb37a4f0c5 in _PyMem_DebugRawMalloc ../cpython/Objects/obmalloc.c:2004
    #4 0x55bb37a50493 in _PyMem_DebugMalloc ../cpython/Objects/obmalloc.c:2156
    #5 0x55bb37a5254a in PyObject_Malloc ../cpython/Objects/obmalloc.c:676
    #6 0x55bb379afbc6 in PyFloat_FromDouble ../cpython/Objects/floatobject.c:149
    #7 0x55bb37dbbeb1 in fill_time ../cpython/Modules/posixmodule.c:2404
    #8 0x55bb37dd172b in _pystat_fromstructstat ../cpython/Modules/posixmodule.c:2506
    #9 0x55bb37dd3999 in posix_do_stat ../cpython/Modules/posixmodule.c:2632
    #10 0x55bb37dd4043 in os_stat_impl ../cpython/Modules/posixmodule.c:2961
    #11 0x55bb37dd44c6 in os_stat ../cpython/Modules/clinic/posixmodule.c.h:100
    #12 0x55bb37c3e844 in _PyEval_EvalFrameDefault Python/bytecodes.c:2903
    #13 0x55bb37c488bf in _PyEval_EvalFrame ../cpython/Include/internal/pycore_ceval.h:87
    #14 0x55bb37c488bf in _PyEval_Vector ../cpython/Python/ceval.c:1610
    #15 0x55bb37c48ae0 in PyEval_EvalCode ../cpython/Python/ceval.c:567
    #16 0x55bb37d2d868 in run_eval_code_obj ../cpython/Python/pythonrun.c:1695
    #17 0x55bb37d2e4ee in run_mod ../cpython/Python/pythonrun.c:1716
    #18 0x55bb37d2e677 in pyrun_file ../cpython/Python/pythonrun.c:1616
    #19 0x55bb37d3538b in _PyRun_SimpleFileObject ../cpython/Python/pythonrun.c:433
    #20 0x55bb37d356d3 in _PyRun_AnyFileObject ../cpython/Python/pythonrun.c:78
    #21 0x55bb37d8f540 in pymain_run_file_obj ../cpython/Modules/main.c:360
    #22 0x55bb37d8fd0c in pymain_run_file ../cpython/Modules/main.c:379
    #23 0x55bb37d921a0 in pymain_run_python ../cpython/Modules/main.c:610
    #24 0x55bb37d92322 in Py_RunMain ../cpython/Modules/main.c:689
    #25 0x55bb37d92509 in pymain_main ../cpython/Modules/main.c:719
    #26 0x55bb37d92881 in Py_BytesMain ../cpython/Modules/main.c:743
    #27 0x55bb377c1a25 in main ../cpython/Programs/python.c:15
    #28 0x7f12861c1d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 48 byte(s) leaked in 1 allocation(s).
make: *** [Makefile:1149: checksharedmods] Error 1

The same also reproduces on ubuntu 23.04 gcc 12.2 and clang 15.

@gpshead gpshead added the type-crash A hard crash of the interpreter, possibly with a core dump label May 23, 2023
@gpshead
Copy link
Member Author

gpshead commented May 23, 2023

Oh I see that our AddressSanitizer CI build uses ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0

so this probably falls under "well known issues" while we work on all of our multi-phase init and finalization stuff.

@vstinner
Copy link
Member

I cannot reproduce the issue on Fedora nor Ubuntu 22.04 with commands of the first issue. I suppose that it was fixed in the meanwhile. Please reopen the issue if you can still reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

2 participants