This is an archive of the discontinued LLVM Phabricator instance.

[AAArch64][Windows] Fix the crash when running ninja check-asan
ClosedPublic

Authored by bcl5980 on Oct 21 2022, 1:40 AM.

Details

Summary

The crash comes from mismatch between load count in epilogue and seh instruction count.
Still because of the pass AArch64LoadStoreOpt. It remove some load in the epilogue but haven't remove the corresponding seh instruction.
This patch don't optimize the load in the epilogue to fix the issue.

Fix: #58516

Diff Detail

Event Timeline

bcl5980 created this revision.Oct 21 2022, 1:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 1:40 AM
bcl5980 requested review of this revision.Oct 21 2022, 1:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2022, 1:40 AM

Do I need to precommit the test to make the test cleaner?

@omjavaid has also been looking at sanitizers on Windows on Arm.

Do I need to precommit the test to make the test cleaner?

As in, commit a test that shows the exiting broken behaviour, then this patch just has the correction? Sounds like a good idea to me. You can land them right next to each other in any case.

mstorsjo accepted this revision.Oct 21 2022, 2:16 AM

If the issue was on the level that the number of SEH opcodes didn't match the number of instructions, then D131394 should have triggered when compiling the object file too - can you clarify whether this was the case (but you might have tested with an older version before D131394 had been landed), or if it was a case where the number of opcodes/instructions matched while being incorrect?

The fix in itself probably is correct in any case.

This revision is now accepted and ready to land.Oct 21 2022, 2:16 AM

If the issue was on the level that the number of SEH opcodes didn't match the number of instructions, then D131394 should have triggered when compiling the object file too - can you clarify whether this was the case (but you might have tested with an older version before D131394 had been landed), or if it was a case where the number of opcodes/instructions matched while being incorrect?

The fix in itself probably is correct in any case.

I use today's main branch to test so D131394 is already landed. The test error is:

Incorrect size for ?catch$3@?0??_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ@4HA epilogue: 8 bytes of instructions in range, but .seh directives corresponding to 12 bytes

If the issue was on the level that the number of SEH opcodes didn't match the number of instructions, then D131394 should have triggered when compiling the object file too - can you clarify whether this was the case (but you might have tested with an older version before D131394 had been landed), or if it was a case where the number of opcodes/instructions matched while being incorrect?

The fix in itself probably is correct in any case.

I use today's main branch to test so D131394 is already landed. The test error is:

Incorrect size for ?catch$3@?0??_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ@4HA epilogue: 8 bytes of instructions in range, but .seh directives corresponding to 12 bytes

Ok, great! So then that check works exactly as intended for catching issues like these!