8000 add ELF 32-bit support by wideglide · Pull Request #27 · sslab-gatech/qsym · GitHub
[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

add ELF 32-bit support #27

Merged
merged 5 commits into from
Nov 9, 2018
Merged

Conversation

wideglide
Copy link
Contributor

Adding support for ELF 32-bit target binaries:

  • build 32-bit z3 library (copied to /usr/lib32/libz.so)
  • build 32-bit pintool (pintool/obj-ia32/libqsym.so)
  • simple check in ELF header for 32/64 bit (byte 5)
  • testing on CI:
    • Ubuntu 14.04 passes all but one check (unrelated to changes)
    • Ubuntu 16.04 passes all checks

An alternative option would be to add a command line parameter to run_qsym_afl.py, but this works cleanly in some simple tests.

wideglide and others added 3 commits November 8, 2018 11:36
- build 32bit z3 library
- build 32bit pintool (obj-ia32/libqsym.so)
- simple check in ELF header for 32/64 bit (byte 5)
Refactor
Copy link
Contributor
@insuyun insuyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, thank you for your pull request.
Overall the patch seems good!
But I made some changes (mostly style part) and left some comments.
Could you check them?

Thank you!

setup.py Outdated

my_env = os.environ.copy()
my_env["TARGET"] = "ia32"
if subprocess.call(["make", "-C", "qsym/pintool", "-j", str(mp.cpu_count())],env=my_env) != 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add space between comma and env.

@@ -65,6 +65,14 @@ def status_file(self):
def log_file(self):
return os.path.join(self.testcase_dir, "pin.log")

def check_elf32(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be fine? or should we use other elf parsing library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the elf parsing libraries, and it seemed like overkill to add another dependency just to support this simple check. I also thought about using the command line utility file and parsing the output, which would also work and is almost always available. In the end I preferred the simplicity of this approach. All properly compiled ELF binaries will be compliant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I think it's better to use this approach. Then if we need more functionality about ELF parsing later, we can use others.

@@ -18,5 +18,8 @@ def find_pin():

ROOT = os.path.realpath(os.path.dirname(__file__))
PINTOOL_DIR = os.path.join(ROOT, "pintool")
SO = os.path.join(PINTOOL_DIR, "obj-intel64/libqsym.so")
SO = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this more cleaner form.

@insuyun insuyun merged commit 6fa5878 into sslab-gatech:master Nov 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0