-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Clear the IRBuilder's insertion point after emitting a function #18054
Conversation
The function might get finalized, invalidating the IP. However, in some cases this invalid IP may get saved and restored, accessing the invalid IP while doing so. Example code path accessing an invalid IP: -> jl_cfunction_object (nested_compile=true, but doesn't change IP) -> gen_cfun_wrapper -> jl_compile_linfo (saves and restores invalid IP)
Thanks, lgtm. |
can that code path be tested? |
I can add the snippet above to the tests, but we'd still need an ASAN-like builder to detect if it fails. |
Note that this test requires a memory sanitizer (ASAN, valgrind) to detect failure.
I'm hoping we can simply eliminate all globals from codegen in the near future (and wrap almost the whole file inside the class |
Good to know. In the meantime, this gets us a little closer again to passing all tests with ASAN enabled (I'll be pushing some devdocs on how to set it all up, because it has been a bit of a struggle). |
If you think this should be backported, do speak up. |
Clear the IRBuilder's insertion point after emitting a function
The function might get finalized, invalidating the IP. However, in some cases this invalid IP may get saved and restored, accessing the invalid IP while doing so. Example code path accessing an invalid IP: -> jl_cfunction_object (nested_compile=true, but doesn't change IP) -> gen_cfun_wrapper -> jl_compile_linfo (saves and restores invalid IP) (cherry picked from commit ebd24a8, ref #18054)
Note that this test requires a memory sanitizer (ASAN, valgrind) to detect failure.
Similar to #18054. Proper fix would be not to have a global builder.
Similar to JuliaLang#18054. Proper fix would be not to have a global builder.
The function might get finalized, invalidating the IP. However, in some cases this invalid IP may get saved and restored, accessing the invalid IP while doing so.
Example code path accessing an invalid IP:
jl_cfunction_object
: nested_compile=true, but doesn't change IPgen_cfun_wrapper
jl_compile_linfo
: saves and restores invalid IPExample code: