-
Notifications
You must be signed in to change notification settings - Fork 846
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
ptrace changing syscall parameters with setregs #1491
Comments
@kpocza When you run it on WSL, do you see any failing syscalls or sockopts or something in If not, you may have found an implementation bug. |
@fpqc There are no failing syscalls according to
|
@kpocza Ok, cool hopefully one of the devs will use your poc to see if it's an implementation bug good luck! |
What's the current state of this issue? I am running into the same bug. Using a ptracer I have to modify syscall values (in this case including the syscall number itself and the arguments) to work around missing implementations in WSL. However changes to the register set are ignored and only visible when back in user space. I.e. registers are changed as they should be. WSLs seems to rely on values fetched bevor the tracer is called and ignores any changes afterwards. With respect to certain "implementation specific abnormalities" this does not allow to fix things with the help of a tracer. It should be rather easy to use the values from the register sets. The linux kernel works the same way. The proof of concept from @kpocza is valid. |
PS: verified up to 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux So this is still a current issue. |
Any updates? |
Tried the OP PoC on a Real Linux box and (oddly) it did not create |
According to #1470 I'm trying to change mmap flags to MAP_ANONYMOUS|MAP_PRIVATE and the fd to -1 via ptrace.
I'm trying to do it exactly after when PTRACE_SYSCALL stops the tracee before enterring into the mmap syscall of /dev/fb0.
I was expecting that PTRACE_SETREGS will do the job, since it works correctly after returning from any syscall. However the registers are not correctly updated before a syscall.
(Hm. I'm depending on a bug since setting orig_rax to -1 and calling SETREGS has no real effect before syscall, SETREGS just ruins some context....)
I've created the following PoC to demonstrate this behavior.
On Ubuntu 16.04 LTS this program correctly creates yes.txt, however on Bash on Windows 10 AU and RS2 14965 it creates no.txt. It means that the rdi register is not properly updated on Bash on Windows. Of course the problem is not only with rdi but with the other regs, as well.
Am I messing something and should I do something differently, or is this really a bug somewhere?
The text was updated successfully, but these errors were encountered: