-
Notifications
You must be signed in to change notification settings - Fork 720
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
Segmentation fault with TR_StressTrampolines enabled #11296
Comments
Using limit files and tracing, I narrowed down the crash to compilation of 3 methods:
As you can see the problematic method Looking at the trace files for these methods the address of the method is directly used here:
|
And this is another where the address of the method is used:
|
The actual reason this segfault happens is because when we generate a call to In this part of the call snippet code, we reserve a trampoline, however since However, when the method gets compiled, the patching code expects a reserved trampoline: There is a method called |
It seems like the solution would be to modify assembly of |
There used to be a call to the trampoline adjustment code from PicBuilder in pre-open source releases, but I see it has been removed for some reason. I'll try and find out when/why. |
This is a good find and good detective work to get to the bottom of it. The original implementation of the unresolved dispatch logic had the call to adjust the reservation but when the code was rewritten almost 15 years ago that logic was missed for some reason. I can't think of a reason why it would have been intentionally omitted. I think it is needed--and in the spot that you identified--because otherwise I can't see how a trampoline would move from the unresolved to the resolved hash table. The original code looked like this. I imagine a lot of it could be re-used with some freshening up for the current implementation (register usage, stack offsets, comments, etc.)
|
Alright, thanks for providing the original implementation. |
The segfault happens every time when running
-version
withTR_StressTrampolines
enabled.The crash occurs on x86, but I haven't checked other platforms.
The stack trace:
I'm pretty sure that the last frame should be ignored, as
resetCodeCache
is only called in one place on JITServer server, so it's impossible for it to be called in this case and it's probably gdb messing up the stack trace.entry
is NULL, which indicates that method0x51718
hasn't been added to the hash table of methods for which we know we might need a trampoline. To reserve a trampoline,TR_J9VMBase::reserveTrampolineIfNecessary
should be called.All of this information leads me to conclude that somewhere we force a call through trampoline under
TR_StressTrampolines
but don't account for it withreserveTrampolineIfNecessary
.The text was updated successfully, but these errors were encountered: