-
Notifications
You must be signed in to change notification settings - Fork 14
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
Fix unwind from signal handler #25
Conversation
In case of this is frame of signal handler, the IP should be incremented, because the IP saved in the signal handler points to first non-executed instruction, while FDE/CIE expects IP to be after the first non-executed instruction.
// incremented, because the IP saved in the signal handler points to | ||
// first non-executed instruction, while FDE/CIE expects IP to be after | ||
// the first non-executed instruction. | ||
newRegisters.setIP(returnAddress + cieInfo.isSignalFrame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can point in the middle between two instructions. Is this ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only needed to execute proper CFI here -
Lines 430 to 434 in 854538c
ParseInfo parseInfoArray[] = { | |
{cieInfo.cieInstructions, cieInfo.cieStart + cieInfo.cieLength, | |
(pint_t)(-1)}, | |
{fdeInfo.fdeInstructions, fdeInfo.fdeStart + fdeInfo.fdeLength, | |
upToPC - fdeInfo.pcStart}}; |
So in other words, everything should be OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give it a try.
In case of this is frame of signal handler, the IP should be incremented, because the IP saved in the signal handler points to first non-executed instruction, while FDE/CIE expects IP to be after the first non-executed instruction.
PR in upstream: llvm/llvm-project#92291