-
Notifications
You must be signed in to change notification settings - Fork 135
Conversation
- build 32bit z3 library - build 32bit pintool (obj-ia32/libqsym.so) - simple check in ELF header for 32/64 bit (byte 5)
Refactor
There was a problem hiding this 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: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
Adding support for ELF 32-bit target binaries:
/usr/lib32/libz.so
)pintool/obj-ia32/libqsym.so
)An alternative option would be to add a command line parameter to
run_qsym_afl.py
, but this works cleanly in some simple tests.