[PATCH] D73531: [llvm-objdump] avoid crash disassembling unknown instruction

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 03:00:23 PST 2020


SjoerdMeijer added a comment.

Thanks for your speedy responses!

For more context, this is my problem, the dissassembler is unable to disassemble some/most instructions:

  fca8: b8 bf                        	it	lt
  fcaa: b0 ee 42 4b                       vmovlt.f64	d4, d2
  fcae: b4                           	<unknown>
  fcaf: ee 4c                        	ldr	r4, [pc, #952]
  fcb1: 4b f1 ee 10                        adc	r0, r11, #15597806
  fcb5: fa 33                        	adds	r3, #250
  fcb7: fe 0c                        	lsrs	r6, r7, #19
  fcb9: cb                           	<unknown> llvm-objdump: <crash>

At a point, it is just disassembling garbage, for example, here where the crash happens instruction with opcode `cb` here (just a byte, which is nonsense), and is feeding this to function `evaluateBranch()` here:

  // Try to resolve the target of a call, tail call, etc. to a specific
  // symbol.
  if (MIA && (MIA->isCall(Inst) || MIA->isUnconditionalBranch(Inst) ||
              MIA->isConditionalBranch(Inst))) {
    uint64_t Target;
    if (MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target)) {

The garbage value to some existing/random opcode, it tries to get an instruction operand, but then crashes trying to do so because the MCInst hasn't been created.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73531/new/

https://reviews.llvm.org/D73531





More information about the llvm-commits mailing list