This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix Decode of tsb csync
ClosedPublic

Authored by lenary on Mar 11 2022, 11:05 AM.

Details

Summary

There is a crash in the ARM backend when attempting to decode a "tsb
csync" instruction using llvm-objdump --triple=armv8.4a -d. The crash
was in ARMMCInstrAnalysis::evaluateBranch where the number of operands
in the decoded instruction (0) did not match the number of operands in
the instruction description (1).

This is becuase tsb csync looks like it has an operand during
assembly, but there is only one valid operand (csync), so there is no
encoding space in the instruction for the operand, so the decoder never
has a field to decode that represents csync.

The fix is to add a custom decode method, which ensures that this
instruction does have the right number of operands after decoding. This
method merely adds the only available operand value, ARM_TSB::CSYNC.

Diff Detail

Event Timeline

lenary created this revision.Mar 11 2022, 11:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 11:05 AM
lenary requested review of this revision.Mar 11 2022, 11:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 11:05 AM
lenary updated this revision to Diff 414714.Mar 11 2022, 11:30 AM
  • Add Test
  • Fix Condition on Opcode
This revision is now accepted and ready to land.Mar 14 2022, 3:34 AM
This revision was landed with ongoing or failed builds.Mar 17 2022, 10:30 AM
This revision was automatically updated to reflect the committed changes.