Skip to content

Type punning (and strict aliasing) issue in Py_CLEAR() and Py_SETREF() macros: Python --enable-pystats is miscompiled #99701

Closed
@mdboom

Description

@mdboom

Bug report

When building with --enable-pystats, the ensurepip step fails with a segmentation fault.
The v3.11.0 tag works on this machine, main is currently broken. I have not yet bisected it.

Cc @markshannon as the primary pystats author.

Your environment

Debian bookworm, WSL

Output during build
if test "xupgrade" != "xno"  ; then \
        case upgrade in \                                                                                                               upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
        esac; \                                                                                                                  ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpnrufafo0
Processing /tmp/tmpnrufafo0/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmpnrufafo0/pip-22.3.1-py3-none-any.whl
Installing collected packages: setuptools, pip                                                                          Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/mdboom/Work/builds/cpython/Lib/ensurepip/__main__.py", line 5, in <module>                                    sys.exit(ensurepip._main())                                                                                                      ^^^^^^^^^^^^^^^^^
  File "/home/mdboom/Work/builds/cpython/Lib/ensurepip/__init__.py", line 286, in _main                                     return _bootstrap(
           ^^^^^^^^^^^
  File "/home/mdboom/Work/builds/cpython/Lib/ensurepip/__init__.py", line 202, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mdboom/Work/builds/cpython/Lib/ensurepip/__init__.py", line 103, in _run_pip
    return subprocess.run(cmd, check=True).returncode                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mdboom/Work/builds/cpython/Lib/subprocess.py", line 571, in run                                               raise CalledProcessError(retcode, process.args,                                                                     subprocess.CalledProcessError: Command '['/home/mdboom/Work/builds/cpython/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpnrufafo0/setuptools-65.5.0-py3-none-any.whl\', \'/tmp/tmpnrufafo0/pip-22.3.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpnrufafo0\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' died with <Signals.SIGSEGV: 11>.
Backtrace from the segfault
#0  tee_next (to=0x7ffff5ba9040) at ./Modules/itertoolsmodule.c:998
#1  0x0000555555897f66 in filterfalse_next (lz=0x7ffff5c109d0) at ./Modules/itertoolsmodule.c:4198
#2  0x00005555557caf4e in map_next (lz=0x7ffff5c12a10) at Python/bltinmodule.c:1359
#3  0x000055555589b10a in chain_next (lz=0x7ffff5c10640) at ./Include/object.h:135
#4  0x000055555589b10a in chain_next (lz=0x7ffff5c129b0) at ./Include/object.h:135
#5  0x00005555556551d7 in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9bd8,
    throwflag=<optimized out>) at ./Include/object.h:135
#6  0x00005555556bf0bd in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=3, args=0x7fffffffd120,
    callable=0x7ffff5c311c0, tstate=0x555555b98968 <_PyRuntime+450344>) at ./Include/internal/pycore_call.h:92
#7  method_vectorcall (method=<optimized out>, args=0x7ffff5e11218, nargsf=<optimized out>, kwnames=0x0)
    at Objects/classobject.c:89
#8  0x0000555555656173 in do_call_core (use_tracing=<optimized out>, kwdict=0x0, callargs=0x7ffff5e11200,
    func=0x7ffff72d1540, tstate=<optimized out>) at Python/ceval.c:2981
#9  _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9548, throwflag=<optimized out>)
    at Python/generated_cases.c.h:3510
#10 0x00005555557d3645 in _PyEval_EvalFrame (throwflag=<optimized out>, frame=<optimized out>, tstate=<optimized out>)
    at ./Include/internal/pycore_ceval.h:88
#11 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7ffff7fb9308, func=0x7ffff7c65f80,
    tstate=0x555555b98968 <_PyRuntime+450344>) at Python/ceval.c:2059
#12 PyEval_EvalCode (co=co@entry=0x555555d4d720, globals=globals@entry=0x7ffff7a80040,
    locals=locals@entry=0x7ffff7a80040) at Python/ceval.c:585
#13 0x00005555557cc280 in builtin_exec_impl (module=<optimized out>, closure=<optimized out>, locals=0x7ffff7a80040,
    globals=0x7ffff7a80040, source=0x555555d4d720) at Python/bltinmodule.c:1075
#14 builtin_exec (module=<optimized out>, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>)
    at Python/clinic/bltinmodule.c.h:543
#15 0x000055555571bd6b in cfunction_vectorcall_FASTCALL_KEYWORDS (func=0x7ffff7c242c0, args=0x7ffff7fb92d0,
    nargsf=<optimized out>, kwnames=<optimized out>) at Objects/methodobject.c:438
#16 0x00005555556bbd5c in _PyObject_VectorcallTstate (kwnames=0x7ffff7a80040, nargsf=<optimized out>,
    args=0xfffc555598798768, callable=0x7ffff7c242c0, tstate=0x555555b98968 <_PyRuntime+450344>)
    at ./Include/internal/pycore_call.h:92
#17 PyObject_Vectorcall (callable=callable@entry=0x7ffff7c242c0, args=args@entry=0x7ffff7fb92d0,
    nargsf=<optimized out>, kwnames=kwnames@entry=0x0) at Objects/call.c:301
#18 0x0000555555651c3b in _PyEval_EvalFrameDefault (tstate=<optimized out>, frame=0x7ffff7fb9228,
    throwflag=<optimized out>) at Python/generated_cases.c.h:2972
#19 0x00005555557d3645 in _PyEval_EvalFrame (throwflag=<optimized out>, frame=<optimized out>, tstate=<optimized out>)
    at ./Include/internal/pycore_ceval.h:88
#20 _PyEval_Vector (args=0x0, argcount=0, kwnames=0x0, locals=0x7ffff7c580ee, func=0x7ffff7c65e40,
    tstate=0x555555b98968 <_PyRuntime+450344>) at Python/ceval.c:2059
#21 PyEval_EvalCode (co=co@entry=0x7ffff7c58030, globals=globals@entry=0x7ffff7c869c0,
    locals=locals@entry=0x7ffff7c869c0) at Python/ceval.c:585
#22 0x000055555582911c in run_eval_code_obj (locals=0x7ffff7c869c0, globals=0x7ffff7c869c0, co=0x7ffff7c58030,
    tstate=0x555555b98968 <_PyRuntime+450344>) at Python/pythonrun.c:1702
#23 run_mod (mod=<optimized out>, filename=filename@entry=0x7ffff7c8b870, globals=globals@entry=0x7ffff7c869c0,
    locals=locals@entry=0x7ffff7c869c0, flags=flags@entry=0x7fffffffd798, arena=arena@entry=0x7ffff7bb3990)
    at Python/pythonrun.c:1723
#24 0x000055555582c192 in pyrun_file (flags=0x7fffffffd798, closeit=1, locals=0x7ffff7c869c0, globals=0x7ffff7c869c0,
    start=257, filename=0x7ffff7c8b870, fp=<optimized out>) at Python/pythonrun.c:1617
#25 _PyRun_SimpleFileObject (fp=fp@entry=0x555555c2f3a0, filename=filename@entry=0x7ffff7c8b870,
    closeit=closeit@entry=1, flags=flags@entry=0x7fffffffd798) at Python/pythonrun.c:439
#26 0x000055555582c810 in _PyRun_AnyFileObject (fp=0x555555c2f3a0, filename=filename@entry=0x7ffff7c8b870,
    closeit=closeit@entry=1, flags=flags@entry=0x7fffffffd798) at Python/pythonrun.c:78

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy