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
Your Windows build number: (Type ver at a Windows Command Prompt)
Microsoft Windows [Version 10.0.15063]
What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
Given a ucontext_t *ctx pointer, I'm trying to access ctx->uc_mcontext.fpregs->_xmm[0].
What's wrong / what should be happening instead:
The ctx->uc_mcontext.fpregs field contains a NULL pointer. On a normal Linux system, the ctx->uc_mcontext.fpregs field is always a non-NULL pointer, presumably pointing to ctx->__fpregs_mem. Indeed, if I dig into ctx->__fpregs_mem, all the data is there as expected. So it seems WSL is simply not setting the ctx->uc_mcontext.fpregs field as it should.
Reacted by Maik Riechert, Jay Krell, Heyang Zhou and Aleksey Kliger (λgeek)
Ben Hillis (@benhillis) - I don't know if a strace will show much, because there won't be a syscall fail.
Richard's tight repro from unrelated #1692 (message) demonstrates the problem. Besides his gregs ask, fpregs are all nada. On Real Linux it's populated, natch.
[...blah blah gdb startup]
(gdb) break 16
Breakpoint 1 at 0x40071d: file ucontext.c, line 16.
(gdb) run
Starting program: /home/ken/Devel/ucontext/ucontext
Program received signal SIGSEGV, Segmentation fault.
0x0000000000400812 in main () at ucontext.c:41
41 *x = 3;
(gdb) cont
Continuing.
Breakpoint 1, segv (sig=11, info=0x7ffffffddd40, context=0x7ffffffdd730) at ucontext.c:16
16 printf("SIGSEGV at 0x%lx, fixing up\n", (unsigned long)fault_addr);
(gdb) list
11 ucontext_t *c = context;
12 mcontext_t m = c->uc_mcontext;
13 void *fault_addr = (void *)m.gregs[REG_CR2];
14 void *addr;
15
16 printf("SIGSEGV at 0x%lx, fixing up\n", (unsigned long)fault_addr);
17
18 addr = mmap(fault_addr, 4096, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
19 if (addr == MAP_FAILED) {
20 printf("map failed!\n");
(gdb) print m
$1 = {gregs = {0, 255, 8, 8, 4195776, 140737488215856, 0, 0, 11, 140737488215104, 140737488215632, 0, 0, 3735928559,
8, 140737488215616, 4196370, 66118, 356485103667, 0, 0, 0, 0}, fpregs = 0x0, __reserved1 = {0, 0, 0, 0, 0, 0, 0,
0}}
(gdb)
They were trapping SIGSEGV, but any signal will do. I assume you are trapping SIGFPE. I hope gregs is addressed also because that is valuable on its own merits, as is fpregs. I haven't tested it personally, but I am pretty sure libsigsegv is broken on WSL.
This issue remains unresolved. In many corporate environments, Windows runs on virtual machines, but often does not support nested virtualization. As a result, WSL2 and other virtual machines cannot be run, leaving only WSL1. Therefore, a natural idea is to run User Mode Linux to obtain a complete Linux kernel.
Strongly hope to solve the problems of running UML.
Activity
benhillis commentedon Oct 10, 2017
Alex Rønne Petersen (@alexrp) - Thanks for posting, could you share an strace so I can narrow down what's happening?
therealkenc commentedon Oct 11, 2017
Ben Hillis (@benhillis) - I don't know if a
stracewill show much, because there won't be a syscall fail.Richard's tight repro from unrelated #1692 (message) demonstrates the problem. Besides his
gregsask,fpregsare all nada. On Real Linux it's populated, natch.alexrp commentedon Oct 13, 2017
To be clear, the
ucontext_tis obtained as the third argument from a signal handler that was installed viasigactionwithSA_SIGINFO.therealkenc commentedon Oct 13, 2017
Yep. In the test case I cited it is:
They were trapping
SIGSEGV, but any signal will do. I assume you are trappingSIGFPE. I hopegregsis addressed also because that is valuable on its own merits, as isfpregs. I haven't tested it personally, but I am pretty sure libsigsegv is broken on WSL.fix: Allow a NULL value for mcontext.fpregs
shizhx commentedon Dec 31, 2024
This issue remains unresolved. In many corporate environments, Windows runs on virtual machines, but often does not support nested virtualization. As a result, WSL2 and other virtual machines cannot be run, leaving only WSL1. Therefore, a natural idea is to run User Mode Linux to obtain a complete Linux kernel.
Strongly hope to solve the problems of running UML.