-
Notifications
You must be signed in to change notification settings - Fork 562
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
support Windows Subsystem for Linux #1986
Comments
It looks like ARCH_SET_GS does work, but ARCH_GET_GS (and _FS) is just plain broken and always returns the same, incorrect value. Combined with the selector not being set by the kernel, this is going to be a pain as we cannot query these segment bases. If we do not support attach and only support early injection we can use the cached value we observe ld.so passing to ARCH_SET_FS, making sure all uses of get_segment_base() use that. So it should be doable if we can figure out a sequence to determine whether our TLS is initialized. We'll have to see whether a new thread has any weirdness. |
To identify uninitialized TLS, I was hoping to clear the selector and use
|
For now I put in detection of WSL and a message that it is unsupported. |
I put in a hack to work for the main thread to see what other problems we For subsequent threads: since we can't rely on the selector value or kernel |
I tested the memtrace_x86_text client and it works running "ls" now (with maps query curiosities). Dr. Memory, however, hangs while reading the maps file: I think, gdb does not operate very well here. So there is more work to do on maps queries. |
An example maps issue:
|
The Dr. Memory hang seems to have disappeared when I use the latest DR there: perhaps the hang was #2557. Another problem, though, with the latest DR is this assert: |
The basics seem to work so I'm closing this issue. Any new specific problems should open a new issue. |
Windows 10 Anniversary Edition introduced the new Windows Subsystem for Linux (WSL), where a process can run under a subsystem that supports 64-bit Linux ELF binaries and system calls.
Information on WSL:
https://blogs.msdn.microsoft.com/wsl/2016/06/08/wsl-system-calls/
Looks like there is at least some procfs support:
https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/
https://blogs.msdn.microsoft.com/wsl/2016/05/23/pico-process-overview/
Added: better fork support, 4KB-boundary mem mgmt, case-sensitive file names
To install: it's under "Turn Windows features on or off" and you then launch Bash.
Initial tests: DR crashes due to TLS problems (this one is trying late injection -- early or late makes no difference):
read_thread_register** returns non-zero:
gdb think it's 0 yet when I read it I get 0x2b.
It looks like the ARCH_SET_GS returns 0 for success but does not actually do anything, as a subsequent ARCH_GET_GS gets the same value as before the set.
Same with FS:
But how does native work then?
"strace ls" shows:
The text was updated successfully, but these errors were encountered: