Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example code for testing ARM lifting #29

Open
ebtaleb opened this issue Nov 19, 2018 · 1 comment
Open

Example code for testing ARM lifting #29

ebtaleb opened this issue Nov 19, 2018 · 1 comment

Comments

@ebtaleb
Copy link

ebtaleb commented Nov 19, 2018

Hi,

I would like to test ARM lifting for BAP and pyVEX, but I am puzzled by the CLI interface.
How does one go about generating instructions to test and to feed to the lifters?
The usage part in the README is still to be done.

Could you please provide a minimum working example for testing instructions other than x86/x64?

Thank you.

@soomin-kim
Copy link
Collaborator

Hi, thank you for your interest in MeanDiff.

Adding architectures without modifying current MeanDiff code is not supported yet, so if you want to test BAP and pyVEX for ARM, you need to fix MeanDiff.

  1. StreamGen Modification
    You should modify StreamGen module, because current module only generates x86 or x64 instructions. Functions need to be fixed are, blackListGen, whiteListGen, and allGen. Former one is generating instructions based on black list, and the latter is based on white list. You can generate ARM instructions on your own systematic way, or just random instruction generation. You might need a module to check generated instructions are valid or not.
    Very simple (and dumb) implementation of blackListGen will look like:
let blackListGen arch path =
  let target = readLinesToList path
  match arch with
  | X86 ->
      // existing code
      ...
  | X64 ->
      // existing code
      ...
  | ARM -> // to support ARM, you need to add another type for indicating ARM in CmdOpt.fs
      [ "00000000" ] // this only generates an instruction, "andeq r0, r0, r0"
  1. Lifter Modification
    Another modules you need to fix are MeanDiff-LifterPyVEX and MeanDiff-LifterBAP written in Python, and OCaml, respectively. You'll only need a small modification like giving an address of image base, or something else.

Please let me know if you have any further questions.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants