This is an archive of the discontinued LLVM Phabricator instance.

[libunwind][AArch64] Fix libunwind::Registers_arm64::jumpto
ClosedPublic

Authored by miyuki on Jun 7 2019, 7:17 AM.

Details

Summary

The AArch64 version of the libunwind function which restores the
CPU state and resumes execution is not interrupt-safe. It restores
the target value of SP before loading the floating-point registers
from the context struct, but that struct is allocated on the stack
which is being deallocated. This means that if an interrupt occurs
during this function, and uses a lot of stack space, it could
overwrite the values about to be loaded into the floating-point
registers.

This patch fixes the issue.

Patch by Oliver Stannard.

Diff Detail

Repository
rL LLVM

Event Timeline

miyuki created this revision.Jun 7 2019, 7:17 AM
chill accepted this revision.Jun 17 2019, 3:47 AM
chill added a subscriber: chill.

LGTM. r17 and r18 are be clobbered by a calls, according to AAPCS-64 (5.1.1) and I couldn't find any indication that some Apple ABI would deviate from that.

This revision is now accepted and ready to land.Jun 17 2019, 3:47 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2019, 3:57 AM