[PATCH] Fix MCDataAtom never calling remap when adding data.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Oct 16 08:03:02 PDT 2013


> I think you're right. What do you think the correct behavior here should be? I can think of a few possibilities:
>
> 1. Truncate the text atom after the last valid instruction and add a data atom for the remainder of the section.
> 2. Truncate the text atom, add a data atom of size 1, and attempt to disassemble starting with the next byte, creating a new text atom if it succeeds.

Looks like this is what it is trying to do. It should probably be
creating the data atom with a size of 1. If disassembly flails again
in the next byte, addData (after your patch) will correctly add the
second byte to the atom.

> 3. Perform a smarter disassembly. Section 2.2 of <http://0b4af6cdc2f0c5998459-c0245c5c937c5dedcca3f1764ecc9b2f.r43.cf2.rackcdn.com/12313-sec13-paper_zhang.pdf> (which won best paper award at USENIX Security this year) offers a mixed linear and recursive disassembly approach which apparently works well in practice.
>

Cheers,
Rafael




More information about the llvm-commits mailing list