-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
./Programs/_freeze_module fails with MSAN: Uninitialized value was created by an allocation of 'stat.i' #91043
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
Comments
"./Programs/_freeze_module zipimport" fails with MSAN: $ make SHELL="bash -x"
(...)
+ ./Programs/_freeze_module zipimport ./Lib/zipimport.py Python/frozen_modules/zipimport.h
==110524==WARNING: MemorySanitizer: use-of-uninitialized-value
==110523==WARNING: MemorySanitizer: use-of-uninitialized-value
==110526==WARNING: MemorySanitizer: use-of-uninitialized-value
==110525==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x4b8cfc in read_text /home/vstinner/python/main/Programs/_freeze_module.c:109:9
#1 0x4b8cfc in main /home/vstinner/python/main/Programs/_freeze_module.c:224:24
#2 0x7fe8acb8555f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
#3 0x7fe8acb8560b in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2d60b)
#4 0x435f44 in _start (/home/vstinner/python/main/Programs/_freeze_module+0x435f44) Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main' SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/vstinner/python/main/Programs/_freeze_module.c:109:9 in read_text Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main' SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/vstinner/python/main/Programs/_freeze_module.c:109:9 in read_text
Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main'
SUMMARY: MemorySanitizer: use-of-uninitialized-value /home/vstinner/python/main/Programs/_freeze_module.c:109:9 in read_text Build Python with clang MSAN: |
It looks like a bug in clang MSAN: |
Hum, later "import ssl" in setup.py also fails. Simplified code: import _ssl
print(_ssl.txt2obj('1.3.6.1.5.5.7.3.1', name=False)) # server OID Error: $ ./python x.py
Uninitialized bytes in MemcmpInterceptorCommon at offset 0 inside [0x701000000032, 8)
==135651==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x49467c in memcmp (/home/vstinner/python/main/python+0x49467c)
#1 0x7f5546825adc in OBJ_bsearch_ex_ (/lib64/libcrypto.so.1.1+0x14eadc)
#2 0x7f5546826ff1 in OBJ_obj2nid (/lib64/libcrypto.so.1.1+0x14fff1)
#3 0x7f554675b434 (/lib64/libcrypto.so.1.1+0x84434)
#4 0x7f554675b6af in d2i_ASN1_OBJECT (/lib64/libcrypto.so.1.1+0x846af)
#5 0x7f5546827702 in OBJ_txt2obj (/lib64/libcrypto.so.1.1+0x150702)
#6 0x7f5546a78c31 in _ssl_txt2obj_impl /home/vstinner/python/main/Modules/_ssl.c:5276:11
#7 0x7f5546a78c31 in _ssl_txt2obj /home/vstinner/python/main/Modules/clinic/_ssl.c.h:1216:20
(...) Uninitialized value was created by a heap allocation SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/vstinner/python/main/python+0x49467c) in memcmp The Python code calls OBJ_txt2obj("1.3.6.1.5.5.7.3.1", 0) in C: the OpenSSL function. |
I wrote #75814 to work around the false alarm on stat() and fstat(). |
This error is unrelated to Python, but comes from OpenSSL. |
I reported this issue to OpenSSL: openssl/openssl#17784 |
It's unclear to me if it's an issue in Python itself, Clang/GCC, or how the glibc was built. For example, openssl/openssl#17784 (comment) was closed OpenSSL must be built with -fsanitize=memory. Anyway, I close the issue. |
I've recently tried building and compiling CPython with After making the #102510 change, a slightly different So, I tried compiling it against OpenSSL built with But it looks like there is a sequence of other diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 6761bba457..ac379d5d98 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -56,7 +56,7 @@ _PyImport_FindSharedFuncptr(const char *prefix,
{
dl_funcptr p;
void *handle;
- char funcname[258];
+ char funcname[258] = "";
char pathbuf[260];
int dlopenflags=0; I stopped digging on this one, but noticed the
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: