Skip to content
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

test_importlib creates a coredump on AMD64 FreeBSD 10.x Shared 3.7 #77810

Closed
vstinner opened this issue May 24, 2018 · 6 comments
Closed

test_importlib creates a coredump on AMD64 FreeBSD 10.x Shared 3.7 #77810

vstinner opened this issue May 24, 2018 · 6 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 33629
Nosy @ncoghlan, @vstinner, @encukou, @koobs, @miss-islington
PRs
  • bpo-33629: Prevent coredump in test_importlib #7090
  • [3.7] bpo-33629: Prevent coredump in test_importlib (GH-7090) #7101
  • [3.6] bpo-33629: Prevent coredump in test_importlib (GH-7090) #7102
  • 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:

    assignee = None
    closed_at = <Date 2018-05-24.22:24:32.202>
    created_at = <Date 2018-05-24.01:38:14.916>
    labels = ['3.7', 'tests']
    title = 'test_importlib creates a coredump on AMD64 FreeBSD 10.x Shared 3.7'
    updated_at = <Date 2018-05-24.22:24:32.201>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-05-24.22:24:32.201>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-05-24.22:24:32.202>
    closer = 'vstinner'
    components = ['Tests', 'FreeBSD']
    creation = <Date 2018-05-24.01:38:14.916>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33629
    keywords = ['patch']
    message_count = 6.0
    messages = ['317497', '317504', '317507', '317614', '317620', '317624']
    nosy_count = 5.0
    nosy_names = ['ncoghlan', 'vstinner', 'petr.viktorin', 'koobs', 'miss-islington']
    pr_nums = ['7090', '7101', '7102']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33629'
    versions = ['Python 3.7']

    @vstinner
    Copy link
    Member Author

    http://buildbot.python.org/all/#/builders/124/builds/315

    Warning -- files was modified by test_importlib
    Before: []
    After: ['python.core']

    @vstinner vstinner added 3.7 (EOL) end of life tests Tests in the Lib/test dir labels May 24, 2018
    @vstinner
    Copy link
    Member Author

    The problem comes from MultiPhaseExtensionModuleTests.test_bad_traverse() of Lib/test/test_importlib/extension/test_loader.py.

    This test runs the following code:
    ---

    import importlib.util as util
    spec = util.find_spec('_testmultiphase')
    spec.name = '_testmultiphase_with_bad_traverse'
    m = spec.loader.create_module(spec)

    I confirm that this script does crash and may generate a core dump:

    vstinner@apu$ ./python x.py
    Segmentation fault (core dumped)

    Python traceback of the crash:

    (gdb) py-bt
    Traceback (most recent call first):
      <built-in method create_dynamic of module object at remote 0x7ffff7f37458>
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "<frozen importlib._bootstrap_external>", line 1043, in create_module
      File "x.py", line 4, in <module>
        m = spec.loader.create_module(spec)

    C traceback:

    Program received signal SIGSEGV, Segmentation fault.
    0x00007fffeffb69f3 in bad_traverse (self=<module at remote 0x7ffff7e59658>, visit=0x481b4d <bad_traverse_test>, arg=0x0)
    at /home/vstinner/prog/python/master/Modules/_testmultiphase.c:628
    628 Py_VISIT(m_state->integer);
    (gdb) where
    #0 0x00007fffeffb69f3 in bad_traverse (self=<module at remote 0x7ffff7e59658>, visit=0x481b4d <bad_traverse_test>, arg=0x0)
    at /home/vstinner/prog/python/master/Modules/_testmultiphase.c:628
    #1 0x0000000000482866 in PyModule_FromDefAndSpec2TraceRefs (def=0x7ffff01b8ce0 <def_with_bad_traverse>,
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, module_api_version=1013) at Objects/moduleobject.c:366
    #2 0x000000000057ed89 in _PyImport_LoadDynamicModuleWithSpec (
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, fp=0x0) at ./Python/importdl.c:193
    #3 0x000000000057df53 in _imp_create_dynamic_impl (module=<module at remote 0x7ffff7f37458>,
    spec=<ModuleSpec(name='_testmultiphase_with_bad_traverse', loader=<ExtensionFileLoader(name='_testmultiphase', path='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so') at remote 0x7ffff04632c8>, origin='/home/vstinner/prog/python/master/build/lib.linux-x86_64-3.8-pydebug/_testmultiphase.cpython-38dm-x86_64-linux-gnu.so', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached=None) at remote 0x7ffff0463330>, file=0x0) at Python/import.c:2174
    #4 0x000000000057789f in _imp_create_dynamic (module=<module at remote 0x7ffff7f37458>, args=0x7ffff7f1f630, nargs=1) at Python/clinic/import.c.h:289
    (...)

    @vstinner
    Copy link
    Member Author

    The test creating the coredump has been added by bpo-32374.

    @vstinner
    Copy link
    Member Author

    New changeset 483000e by Victor Stinner in branch 'master':
    bpo-33629: Prevent coredump in test_importlib (GH-7090)
    483000e

    @miss-islington
    Copy link
    Contributor

    New changeset d9eb22c by Miss Islington (bot) in branch '3.7':
    bpo-33629: Prevent coredump in test_importlib (GH-7090)
    d9eb22c

    @miss-islington
    Copy link
    Contributor

    New changeset fc0356d by Miss Islington (bot) in branch '3.6':
    bpo-33629: Prevent coredump in test_importlib (GH-7090)
    fc0356d

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants