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

Error in Free_Bp_handler when getting argument #45

Open
Yuuoniy opened this issue May 2, 2021 · 0 comments
Open

Error in Free_Bp_handler when getting argument #45

Yuuoniy opened this issue May 2, 2021 · 0 comments

Comments

@Yuuoniy
Copy link

Yuuoniy commented May 2, 2021

getarch()
if arch == "x86-64":
reg = "$rsi"
result = int(gdb.execute("info register " + reg,to_string=True).split()[1].strip(),16) + 0x10
else :

According to x86-64 function calling convention, The first six integer or pointer arguments are passed in registers RDI, RSI, RDX, RCX, R8, R9. so RDI stores the first argument of the free function. which denotes the pointer to free. Using RSI would get the wrong value.
Same for Malloc_Bp_handler function, but I found $RDI = $RSI in malloc when debugging. So malloc trace seems normal. But Free_Bp_handler failed to get the value of the pointer to be freed.

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

1 participant