[New-bugs-announce] [issue43967] Valgrind memcheck on Py_Initialize

Simon Aldrich report at bugs.python.org
Wed Apr 28 09:53:21 EDT 2021


New submission from Simon Aldrich <simon at aldrich.cc>:

Running a Valgrind memcheck of Py_Initialize still produces issues even when using the suggested suppressions file. Am I doing something wrong or is this expected?

I've attached a simple reproducer which can be run as follows:

1. Extract tarball
2. cmake
3. make memcheck (runs valgrind with suppressions)

Gives output similar to:

[100%] Built target valgrind-libpython
==2901== Memcheck, a memory error detector
==2901== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2901== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==2901== Command: ./valgrind-libpython
==2901== 
==2901== Conditional jump or move depends on uninitialised value(s)
==2901==    at 0x5729DB7: __wcsnlen_avx2 (strlen-avx2.S:264)
==2901==    by 0x5657CA1: wcsrtombs (wcsrtombs.c:104)
==2901==    by 0x55DDC40: wcstombs (wcstombs.c:34)
==2901==    by 0x4FB7EB9: _Py_EncodeLocaleRaw (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FB99F7: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FBB8B2: _PyPathConfig_Calculate (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FDAC8D: _PyConfig_InitPathConfig (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE4F6E: PyConfig_Read (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE687A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE79A1: Py_InitializeFromConfig (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE7A5B: Py_InitializeEx (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x108758: main (in /home/simon/temp/valgrind-libpython/build/valgrind-libpython)
==2901== 
==2901== Conditional jump or move depends on uninitialised value(s)
==2901==    at 0x55C14E8: internal_utf8_loop (loop.c:298)
==2901==    by 0x55C14E8: __gconv_transform_internal_utf8 (skeleton.c:609)
==2901==    by 0x5657CD4: wcsrtombs (wcsrtombs.c:110)
==2901==    by 0x55DDC40: wcstombs (wcstombs.c:34)
==2901==    by 0x4FB7EB9: _Py_EncodeLocaleRaw (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FB99F7: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FBB8B2: _PyPathConfig_Calculate (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FDAC8D: _PyConfig_InitPathConfig (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE4F6E: PyConfig_Read (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE687A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE79A1: Py_InitializeFromConfig (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x4FE7A5B: Py_InitializeEx (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==2901==    by 0x108758: main (in /home/simon/temp/valgrind-libpython/build/valgrind-libpython)...

----------
components: C API, Library (Lib)
files: valgrind-libpython.tar.gz
messages: 392199
nosy: simonaldrich
priority: normal
severity: normal
status: open
title: Valgrind memcheck on Py_Initialize
type: security
versions: Python 3.8
Added file: https://bugs.python.org/file49996/valgrind-libpython.tar.gz

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43967>
_______________________________________


More information about the New-bugs-announce mailing list