Skip to content

CIFuzz CI: segfault during Python build #116899

Closed as not planned
Closed as not planned
@vstinner

Description

@vstinner
./Programs/_freeze_module importlib._bootstrap_external ./Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
Segmentation fault (core dumped)
make: *** [Makefile:1660: Python/frozen_modules/importlib._bootstrap_external.h] Error 139

When I tried to reproduce in an Ubuntu 22.04 container, I get the errors:

root@ubuntu-dev:/cpython# make -j4 SHELL="bash -x"
(...)
./Programs/_freeze_module getpath ./Modules/getpath.py Python/frozen_modules/getpath.h
==11165==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55d06e6084c0 in read_text /cpython/Programs/_freeze_module.c:109:9
    #1 0x55d06e6084c0 in main /cpython/Programs/_freeze_module.c:225:24
    #2 0x7f1097f42d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #3 0x7f1097f42e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #4 0x55d06e580f34 in _start (/cpython/Programs/_freeze_module+0x85f34) (BuildId: f91c6a29210dc0cd457ac4d39f134316a9608c08)

  Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main'
    #0 0x55d06e606f60 in main /cpython/Programs/_freeze_module.c:206

SUMMARY: MemorySanitizer: use-of-uninitialized-value /cpython/Programs/_freeze_module.c:109:9 in read_text
==11165==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55d06e6084cd in read_text /cpython/Programs/_freeze_module.c:116:21
    #1 0x55d06e6084cd in main /cpython/Programs/_freeze_module.c:225:24
    #2 0x7f1097f42d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #3 0x7f1097f42e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #4 0x55d06e580f34 in _start (/cpython/Programs/_freeze_module+0x85f34) (BuildId: f91c6a29210dc0cd457ac4d39f134316a9608c08)

  Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main'
    #0 0x55d06e606f60 in main /cpython/Programs/_freeze_module.c:206

SUMMARY: MemorySanitizer: use-of-uninitialized-value /cpython/Programs/_freeze_module.c:116:21 in read_text
MemorySanitizer: 2 warnings reported.
make: *** [Makefile:1640: Python/frozen_modules/getpath.h] Error 1
make: *** Waiting for unfinished jobs....

I can reproduce the issue by running _freeze_module manually:

# ./Programs/_freeze_module zipimport ./Lib/zipimport.py Python/frozen_modules/zipimport.h
==11199==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5622e273f4c0 in read_text /cpython/Programs/_freeze_module.c:109:9
    #1 0x5622e273f4c0 in main /cpython/Programs/_freeze_module.c:225:24
    #2 0x7fa50d770d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #3 0x7fa50d770e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #4 0x5622e26b7f34 in _start (/cpython/Programs/_freeze_module+0x85f34) (BuildId: f91c6a29210dc0cd457ac4d39f134316a9608c08)

  Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main'
    #0 0x5622e273df60 in main /cpython/Programs/_freeze_module.c:206

SUMMARY: MemorySanitizer: use-of-uninitialized-value /cpython/Programs/_freeze_module.c:109:9 in read_text
==11199==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5622e273f4cd in read_text /cpython/Programs/_freeze_module.c:116:21
    #1 0x5622e273f4cd in main /cpython/Programs/_freeze_module.c:225:24
    #2 0x7fa50d770d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #3 0x7fa50d770e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: c289da5071a3399de893d2af81d6a30c62646e1e)
    #4 0x5622e26b7f34 in _start (/cpython/Programs/_freeze_module+0x85f34) (BuildId: f91c6a29210dc0cd457ac4d39f134316a9608c08)

  Uninitialized value was created by an allocation of 'stat.i' in the stack frame of function 'main'
    #0 0x5622e273df60 in main /cpython/Programs/_freeze_module.c:206

SUMMARY: MemorySanitizer: use-of-uninitialized-value /cpython/Programs/_freeze_module.c:116:21 in read_text
MemorySanitizer: 2 warnings reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions