This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix potentially incorrect SEH stack allocs for realignments
AbandonedPublic

Authored by mstorsjo on Oct 12 2022, 12:25 PM.

Details

Reviewers
efriedma
Summary

After a07787c9a50c046e45921dd665f5a53a752bbc31, I'm not sure if it
is even possible to trigger this though.

But before possibly removing it later, it would be good to point out
that this previously was wrong - the instruction immediate encoding
for an AND instruction is entirely irrelevant for passing the raw number
of bytes to the SEH unwind opcode.

I guess it's just pure luck that it has happened to work, whenever this
has been tested (if at all).

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 12 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 12:25 PM
mstorsjo requested review of this revision.Oct 12 2022, 12:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 12:25 PM

It's complete nonsense either way; we don't know how many bytes an "and" allocates.

But yes, this should be unreachable now; realignment implies a frame pointer, and a frame pointer implies we've already set NeedsWinCFI is false. (But even before a07787c9, the amount we allocate here doesn't matter; realignment implies a frame pointer, so the setfp is just going going to overwrite the stack pointer no matter what it contains.)

mstorsjo abandoned this revision.Oct 12 2022, 1:30 PM

(But even before a07787c9, the amount we allocate here doesn't matter; realignment implies a frame pointer, so the setfp is just going going to overwrite the stack pointer no matter what it contains.)

Doh, of course. Yeah, whatever nonsense value has been written here before hasn't really had any effect anyway.

Thus I guess it's better to abandon this and make a different patch that simply removes this case and potential other cases where we add SEH opcodes that never will be included any longer.