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

Fix unwind from signal handler on ARM #30

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Fix unwind from signal handler on ARM #30

merged 1 commit into from
Jul 24, 2024

Conversation

al13n321
Copy link
Member

Same fix as in #25 , but for the other code path that unwinds from signal handler.

#27 was incorrect because I didn't understand that the comparison was intentionally off-by-one, to implicitly subtract 1 from the address. Added a comment about it. I wish this -1 was (a) explicit, (b) skipped for signal return (instead of adding 1, then implicitly subtracting it).

Not upstreamable in current state because maybe-DWARF-specific code (with DWARF-specific comment at least) is in non-DWARF-specific part of the code. Need to figure out which of the unwind methods need this +1 and enable it for those. There's also a --pc in setInfoBasedOnIPRegister() which plays a similar role and should maybe be unified with all the other explicit and implicit +-1s. It's too much mess to clean up, I probably won't do it. This is probably good enough for clickhouse, we don't use all those other unwinding methods.

@alexey-milovidov alexey-milovidov self-assigned this Jul 24, 2024
@alexey-milovidov alexey-milovidov merged commit a89d904 into master Jul 24, 2024
azat added a commit to azat-ch/libunwind that referenced this pull request Jul 25, 2024
This reverts commit a89d904, reversing
changes made to fe85444.
// with DWARF. Need to research whether the other unwind methods have the same +-1 situation or
// are off by one.
pint_t returnAddress = _addressSpace.get64(sigctx + kOffsetPc);
_registers.setIP(returnAddress + 1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU this patch it is not required with the last version of mine initial patch - https://github.com/llvm/llvm-project/pull/92291/files

Since now this +1 is in setInfoBasedOnIPRegister which is called for arm64 as well, so let's try to reapply proper version of the patch - #31

@azat
Copy link

azat commented Jul 25, 2024

@al13n321 this patch is much more cleaner than the initial #27 and at least I understood it now :)

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

Successfully merging this pull request may close these issues.

3 participants