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

Heap Tracker #1805

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manticore/native/cpu/aarch64.py
Original file line number Diff line number Diff line change
Expand Up @@ -5302,6 +5302,9 @@ def get_arguments(self):
for address in self.values_from(self._cpu.STACK):
yield address

def get_return_reg(self):
return "X0"

def write_result(self, result):
self._cpu.X0 = result

Expand Down
10 changes: 10 additions & 0 deletions manticore/native/cpu/abstractcpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,16 @@ def get_arguments(self):
"""
raise NotImplementedError

def get_return_reg(self):
"""
Extract the location a return value will be written to. Produces
a string describing a register where the return value is written to.

:return: return register name
:rtype: string
"""
raise NotImplementedError

def write_result(self, result):
"""
Write the result of a model back to the environment.
Expand Down
3 changes: 3 additions & 0 deletions manticore/native/cpu/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ def get_arguments(self):
for address in self.values_from(self._cpu.STACK):
yield address

def get_return_reg(self):
return "R0"

def write_result(self, result):
self._cpu.R0 = result

Expand Down
6 changes: 6 additions & 0 deletions manticore/native/cpu/x86.py
Original file line number Diff line number Diff line change
Expand Up @@ -6412,6 +6412,9 @@ def get_arguments(self):
for address in self.values_from(base):
yield address

def get_return_reg(self):
return "EAX"

def write_result(self, result):
self._cpu.EAX = result

Expand Down Expand Up @@ -6464,6 +6467,9 @@ def get_arguments(self):
for address in self.values_from(self._cpu.RSP + word_bytes):
yield address

def get_return_reg(self):
return "RAX"

def write_result(self, result):
# XXX(yan): Can also return in rdx for wide values.
self._cpu.RAX = result
Expand Down
20 changes: 20 additions & 0 deletions manticore/native/heap_tracking/heap_syscalls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
i386 = {
"brk": 45,
"mmap": 192, # sys_mmap_pgoff
"munmap": 91,
}
amd64 = {
"brk": 12,
"mmap": 9,
"munmap": 11,
}
armv7 = {
"brk": 45,
"mmap": 192, # sys_mmap2
"munmap": 91,
}
aarch64 = {
"brk": 214,
"mmap": 222,
"munmap": 215,
}
Loading