You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can see, on x86, this library assumes that target functions will always be called with %rsp properly aligned.
However, some of the functions I'd like to hook are called with %rsp unaligned. If transit function is not used, it jumps to the hook function and the stack is still unaligned. This may cause issues.
It gets even worse when the transit procedure is used, as it contains movdqa instructions which immediately segfault.
From what I can see, to support this, one needs to:
force transit usage
add code to check and fix alignment in the transit function.
Is this right?
The text was updated successfully, but these errors were encountered:
Fixing alignment for hook functions isn't that simple. (1) Fixed alignment must be back to the original before returning to the caller. (2) Hook functions get incorrect arguments when alignment is fixed and the arguments are passed on the stack.
On the other hand, fixing alignment for prehook is simple as you did.
I made some changes to transit function for x86_64-sysv
I would do it as follows.
add or $0xfffffffffffffff0, %rsp just after sub $0xd0, %rsp.
As far as I can see, on x86, this library assumes that target functions will always be called with
%rsp
properly aligned.However, some of the functions I'd like to hook are called with
%rsp
unaligned. If transit function is not used, it jumps to the hook function and the stack is still unaligned. This may cause issues.It gets even worse when the transit procedure is used, as it contains
movdqa
instructions which immediately segfault.From what I can see, to support this, one needs to:
Is this right?
The text was updated successfully, but these errors were encountered: