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

Interpreter crash upon accessing frame.f_restricted of a frame from a dead thread #66166

Closed
akruis mannequin opened this issue Jul 12, 2014 · 2 comments
Closed

Interpreter crash upon accessing frame.f_restricted of a frame from a dead thread #66166

akruis mannequin opened this issue Jul 12, 2014 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@akruis
Copy link
Mannequin

akruis mannequin commented Jul 12, 2014

BPO 21967
Nosy @serhiy-storchaka, @akruis
Superseder
  • bpo-22851: 2.7 core crashes with generator.gi_frame.f_restricted
  • Files
  • crash_on_f_restricted.py: test programm that eventually causes a crash
  • 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-10-26.08:14:40.095>
    created_at = <Date 2014-07-12.16:31:09.705>
    labels = ['interpreter-core', 'type-crash']
    title = 'Interpreter crash upon accessing frame.f_restricted of a frame from a dead thread'
    updated_at = <Date 2018-10-26.08:14:40.093>
    user = 'https://github.com/akruis'

    bugs.python.org fields:

    activity = <Date 2018-10-26.08:14:40.093>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-26.08:14:40.095>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2014-07-12.16:31:09.705>
    creator = 'anselm.kruis'
    dependencies = []
    files = ['35931']
    hgrepos = []
    issue_num = 21967
    keywords = []
    message_count = 2.0
    messages = ['222852', '328521']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'anselm.kruis']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '22851'
    type = 'crash'
    url = 'https://bugs.python.org/issue21967'
    versions = ['Python 2.7']

    @akruis
    Copy link
    Mannequin Author

    akruis mannequin commented Jul 12, 2014

    If you store a reference to a frame from a dead thread and then access
    frame.f_restricted python eventually crashed.

    I didn't investigate this bug in depth. Here is my preliminary explanation.

    The access of frame.f_restricted causes a call of PyFrame_IsRestricted(f).

    PyFrame_IsRestricted is a macro and expands to
    ((f)->f_builtins != (f)->f_tstate->interp->builtins)

    Now, if the thread that created f is already dead, the f_tstate points to an invalid structure. Depending on the content of the memory the access of f_tstate->interp causes an access violation. I use a Win32 debug build to reliable reproduce the issue.

    @akruis akruis mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Jul 12, 2014
    @serhiy-storchaka
    Copy link
    Member

    Thank you for your report Anselm. Seems this bug is fixed in bpo-22851.

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant