Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Fix RhpCallFilterFunclet stack alignment on ARM #7744

Merged

Conversation

janvorli
Copy link
Member

The number of registers pushed to the stack in the RhpCallFilterFunclet prolog on ARM made the stack misaligned (it needs to be aligned on 8 bytes), so the filter funclet and its transitive callees all had misaligned stack. While in many cases this doesn't cause issues, there are cases where it can cause runtime failures or crashes. For example, when the exception filter call chain invokes a varargs function with certain combination of parameter sizes when some of the arguments are supposed to be 8 byte aligned.

This change fixes the problem by pushing one more register as a padding in the RhpCallFilterFunclet (and popping it in the epilog).

The number of registers pushed to the stack in the RhpCallFilterFunclet prolog on ARM made the stack misaligned (it needs to be aligned on 8 bytes), so the filter funclet and its transitive callees all had misaligned stack. While in many cases this doesn't cause issues, there are cases where it can cause runtime failures or crashes. For example, when the exception filter call chain invokes a varargs function with certain combination of parameter sizes when some of the arguments are supposed to be 8 byte aligned.

This change fixes the problem by pushing one more register as a padding in the RhpCallFilterFunclet (and popping it in the epilog).
Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Thanks!

@MichalStrehovsky MichalStrehovsky merged commit 2423f4f into dotnet:master Aug 28, 2019
@janvorli janvorli deleted the fix-rhpcallfilterfunclet-alignment branch August 28, 2019 17:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants