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

_ast allows smuggling objects across subinterpreters #68

Open
encukou opened this issue Sep 15, 2020 · 0 comments
Open

_ast allows smuggling objects across subinterpreters #68

encukou opened this issue Sep 15, 2020 · 0 comments

Comments

@encukou
Copy link
Collaborator

encukou commented Sep 15, 2020

The _ast module uses global state with heap types, so it is possible to do:

import _xxsubinterpreters
import _ast
_ast.Lambda.smuggled = 'any object'
interp = _xxsubinterpreters.create()
_xxsubinterpreters.run_string(interp, 'import _ast; print(_ast.Lambda.smuggled)')
_xxsubinterpreters.destroy(interp)

(And any object might store any kind of interpreter-specific state.)

See bpo-41631 for some related discussion.

Aside from this particular issue, there's the bigger issue of identifying other cases like this. It's not enough to remove statics; we also need to isolate the dynamics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant