Skip to content

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

Closed
@gpshead

Description

@gpshead

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions