microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.43k stars 822 forks source link

WSLInterop in effect even with `interop.enabled = false` in `wsl.conf` #11920

Closed mataha closed 2 months ago

mataha commented 2 months ago

Windows Version

Microsoft Windows [Version 10.0.19045.4651]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Ubuntu 22.04

Other Software

Applicable to any binary utilizing the Actually Portable Executable format.

Repro Steps

curl -fqsSLO https://cosmo.zip/pub/cosmos/bin/make
chmod +x ./make
./make --version

Expected Behavior

GNU Make 4.4.1
Built for x86_64-linux-cosmo
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Actual Behavior

<3>WSL (225) ERROR: UtilAcceptVsock:250: accept4 failed 110

Diagnostic Logs

/emailed-logs

github-actions[bot] commented 2 months ago

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs Download and execute [collect-wsl-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-wsl-logs.ps1) in an **administrative powershell prompt**: ``` Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1 Set-ExecutionPolicy Bypass -Scope Process -Force .\collect-wsl-logs.ps1 ``` The script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'

mataha commented 2 months ago

/emailed-logs

github-actions[bot] commented 2 months ago
Diagnostic information ``` Found '/emailed-logs', adding tag 'emailed-logs' ```
OneBlue commented 2 months ago

@mataha: Can you capture an strace of the command that's showing this error ? If you're trying to run a Windows command with interop disabled, this error is expected.

mataha commented 2 months ago

@mataha: Can you capture an strace of the command that's showing this error ? If you're trying to run a Windows command with interop disabled, this error is expected.

It's not a Windows command (though it runs on Windows just fine) - in fact, I can run it without any hiccups if I disable WSLInterop manually:

$ sudo sh -c 'echo -1 >"/proc/sys/fs/binfmt_misc/WSLInterop"'
$ ./make --version
GNU Make 4.4.1
Built for x86_64-linux-cosmo
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

But that defeats the point of interop.enabled = false in the first place; not to mention I have to do that every time I start WSL.

strace -ff ./make --version ```java stacktrace execve("./make", ["./make", "--version"], 0x7ffd6a7c9a50 /* 23 vars */) = 0 arch_prctl(ARCH_SET_FS, 0x40cc60) = 0 set_tid_address(0x40cc00) = 351 gettid() = 351 gettid() = 351 gettid() = 351 gettid() = 351 brk(NULL) = 0x17cb000 brk(0x17cd000) = 0x17cd000 mmap(0x17cb000, 4096, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x17cb000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb5000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb4000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb1000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeb0000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeaf000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeae000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefead000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefeab000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea9000 sched_getaffinity(0, 128, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]) = 32 getpid() = 351 getpid() = 351 uname({sysname="Linux", nodename="shuchiin", ...}) = 0 getcwd("/home/mataha", 4096) = 13 readlink("make", 0x7ffdc2fea370, 4096) = -1 EINVAL (Invalid argument) getcwd("/home/mataha", 4097) = 13 open("/proc/self/mountinfo", O_RDONLY|O_LARGEFILE) = 3 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea8000 read(3, "52 61 0:26 / /wsl rw,relatime sh"..., 1024) = 1024 read(3, "oatime shared:4 - proc proc rw\n7"..., 1024) = 1024 read(3, "wslg/run/user /run/user rw,relat"..., 1024) = 567 read(3, "", 1024) = 0 close(3) = 0 munmap(0x7facefea8000, 4096) = 0 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea5000 getcwd("/home/mataha", 4096) = 13 munmap(0x7facefea5000, 16384) = 0 getcwd("/home/mataha", 4096) = 13 open("/proc/self/mountinfo", O_RDONLY|O_LARGEFILE) = 3 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea8000 read(3, "52 61 0:26 / /wsl rw,relatime sh"..., 1024) = 1024 read(3, "oatime shared:4 - proc proc rw\n7"..., 1024) = 1024 read(3, "wslg/run/user /run/user rw,relat"..., 1024) = 567 read(3, "", 1024) = 0 close(3) = 0 munmap(0x7facefea8000, 4096) = 0 ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0 ioctl(0, TIOCGPGRP, [348]) = 0 getpgid(0) = 348 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x3), ...}) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x3), ...}) = 0 fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x3), ...}) = 0 ioctl(0, TIOCGWINSZ, {ws_row=70, ws_col=132, ws_xpixel=0, ws_ypixel=0}) = 0 ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 -opost -isig -icanon -echo ...}) = 0 dup(0) = 3 socket(AF_VSOCK, SOCK_STREAM|SOCK_CLOEXEC, 0) = 4 bind(4, {sa_family=AF_VSOCK, svm_cid=VMADDR_CID_ANY, svm_port=VMADDR_PORT_ANY, svm_flags=0}, 16) = 0 getsockname(4, {sa_family=AF_VSOCK, svm_cid=VMADDR_CID_ANY, svm_port=0x9f0e9e9f, svm_flags=0}, [16]) = 0 listen(4, 4) = 0 getppid() = 348 access("/run/WSL/348_interop", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea5000 open("/proc/348/stat", O_RDONLY|O_LARGEFILE) = 5 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea4000 readv(5, [{iov_base="348 (strace) S 294 348 294 34819"..., iov_len=4095}, {iov_base="", iov_len=1024}], 2) = 317 readv(5, [{iov_base="", iov_len=3778}, {iov_base="", iov_len=1024}], 2) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 munmap(0x7facefe9f000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 munmap(0x7facefe9f000, 8192) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 brk(0x17ce000) = 0x17ce000 mmap(NULL, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe92000 munmap(0x7facefe99000, 16384) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 mmap(NULL, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe85000 munmap(0x7facefe92000, 28672) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe98000 munmap(0x7facefe98000, 4096) = 0 munmap(0x7facefe99000, 16384) = 0 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefea0000, 4096) = 0 munmap(0x7facefea1000, 4096) = 0 munmap(0x7facefe9d000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9e000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe98000 munmap(0x7facefe98000, 4096) = 0 munmap(0x7facefe99000, 16384) = 0 munmap(0x7facefe9d000, 4096) = 0 munmap(0x7facefe9e000, 4096) = 0 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefea0000, 8192) = 0 munmap(0x7facefe85000, 53248) = 0 munmap(0x7facefea2000, 8192) = 0 lseek(5, 0, SEEK_CUR) = 317 close(5) = 0 munmap(0x7facefea4000, 4096) = 0 munmap(0x7facefea5000, 16384) = 0 access("/run/WSL/294_interop", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea5000 open("/proc/294/stat", O_RDONLY|O_LARGEFILE) = 5 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea4000 readv(5, [{iov_base="294 (bash) S 293 294 294 34819 3"..., iov_len=4095}, {iov_base="", iov_len=1024}], 2) = 326 readv(5, [{iov_base="", iov_len=3769}, {iov_base="", iov_len=1024}], 2) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 munmap(0x7facefe9f000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 munmap(0x7facefe9f000, 8192) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 mmap(NULL, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe92000 munmap(0x7facefe99000, 16384) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 mmap(NULL, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe85000 munmap(0x7facefe92000, 28672) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe98000 munmap(0x7facefe98000, 4096) = 0 munmap(0x7facefe99000, 16384) = 0 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefea0000, 4096) = 0 munmap(0x7facefea1000, 4096) = 0 munmap(0x7facefe9d000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9e000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe99000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe98000 munmap(0x7facefe98000, 4096) = 0 munmap(0x7facefe99000, 16384) = 0 munmap(0x7facefe9d000, 4096) = 0 munmap(0x7facefe9e000, 4096) = 0 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefea0000, 8192) = 0 munmap(0x7facefe85000, 53248) = 0 munmap(0x7facefea2000, 8192) = 0 lseek(5, 0, SEEK_CUR) = 326 close(5) = 0 munmap(0x7facefea4000, 4096) = 0 munmap(0x7facefea5000, 16384) = 0 access("/run/WSL/293_interop", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea5000 open("/proc/293/stat", O_RDONLY|O_LARGEFILE) = 5 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea4000 readv(5, [{iov_base="293 (Relay(294)) S 292 292 292 0"..., iov_len=4095}, {iov_base="", iov_len=1024}], 2) = 182 readv(5, [{iov_base="", iov_len=3913}, {iov_base="", iov_len=1024}], 2) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 munmap(0x7facefe9f000, 4096) = 0 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9c000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9a000 mmap(NULL, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe93000 munmap(0x7facefe9c000, 16384) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefe9a000, 8192) = 0 munmap(0x7facefea2000, 4096) = 0 munmap(0x7facefea3000, 4096) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9e000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 munmap(0x7facefe9d000, 4096) = 0 munmap(0x7facefe9e000, 8192) = 0 munmap(0x7facefea2000, 4096) = 0 munmap(0x7facefea3000, 4096) = 0 munmap(0x7facefea0000, 8192) = 0 munmap(0x7facefe93000, 28672) = 0 lseek(5, 0, SEEK_CUR) = 182 close(5) = 0 munmap(0x7facefea4000, 4096) = 0 munmap(0x7facefea5000, 16384) = 0 access("/run/WSL/292_interop", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea5000 open("/proc/292/stat", O_RDONLY|O_LARGEFILE) = 5 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea4000 readv(5, [{iov_base="292 (SessionLeader) S 2 292 292 "..., iov_len=4095}, {iov_base="", iov_len=1024}], 2) = 179 readv(5, [{iov_base="", iov_len=3916}, {iov_base="", iov_len=1024}], 2) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea1000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 munmap(0x7facefea1000, 4096) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea0000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 munmap(0x7facefe9f000, 4096) = 0 mmap(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9c000 munmap(0x7facefea2000, 8192) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9a000 mmap(NULL, 28672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe93000 munmap(0x7facefe9c000, 16384) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9f000 munmap(0x7facefe9f000, 4096) = 0 munmap(0x7facefe9a000, 8192) = 0 munmap(0x7facefea2000, 4096) = 0 munmap(0x7facefea3000, 4096) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefea2000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9e000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7facefe9d000 munmap(0x7facefe9d000, 4096) = 0 munmap(0x7facefe9e000, 8192) = 0 munmap(0x7facefea2000, 4096) = 0 munmap(0x7facefea3000, 4096) = 0 munmap(0x7facefea0000, 8192) = 0 munmap(0x7facefe93000, 28672) = 0 lseek(5, 0, SEEK_CUR) = 179 close(5) = 0 munmap(0x7facefea4000, 4096) = 0 munmap(0x7facefea5000, 16384) = 0 access("/run/WSL/2_interop", F_OK) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 5 connect(5, {sa_family=AF_UNIX, sun_path="/run/WSL/2_interop"}, 110) = 0 write(5, "\7\0\0\0+\1\0\0\237\236\16\237\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 299) = 299 poll([{fd=4, events=POLLIN}], 1, 10000) = 0 (Timeout) getpid() = 351 writev(2, [{iov_base="<3>WSL (351) ERROR: UtilAcceptVs"..., iov_len=60}, {iov_base=NULL, iov_len=0}], 2) = 60 close(5) = 0 close(4) = 0 ioctl(3, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0 close(3) = 0 munmap(0x7facefeab000, 8192) = 0 munmap(0x7facefead000, 4096) = 0 munmap(0x7facefeaf000, 4096) = 0 munmap(0x7facefeb0000, 4096) = 0 munmap(0x7facefeb1000, 4096) = 0 munmap(0x7facefeb3000, 4096) = 0 munmap(0x7facefeb4000, 4096) = 0 exit_group(1) = ? +++ exited with 1 +++ ```
zcobol commented 2 months ago

Setting interop.enabled = false won't disable WSLInterop. It seems broken! Contents of/proc/sys/fs/binfmt_misc/ after restart:

zcobol@toto:~$ ls -l /proc/sys/fs/binfmt_misc/
total 0
-rw-r--r-- 1 root root 0 Aug 13 13:58 WSLInterop
-rw-r--r-- 1 root root 0 Aug 13 13:59 WSLInterop-late
--w------- 1 root root 0 Aug 13 13:59 register
-rw-r--r-- 1 root root 0 Aug 13 13:58 status

WSLInterop and WSLInterop-late are present:

zcobol@toto:~$ cat /proc/sys/fs/binfmt_misc/WSLInterop
enabled
interpreter /init
flags: PF
offset 0
magic 4d5a

The file make used for testing has the same magic number as Windows binaries:

zcobol@toto:~$ xxd -l 2 make
00000000: 4d5a                                     MZ

and if running it when WSLInterop is enabled, this is the output:

zcobol@toto:~$ ./make --version
error: APE is running on WIN32 inside WSL. You need to run: sudo sh -c 'echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop'

File info:

zcobol@toto:~$ file make
make: DOS/MBR boot sector; partition 1 : ID=0x7f, active, start-CHS (0x0,0,1), end-CHS (0x3ff,255,63), startsector 0, 4294967295 sectors

The test can be done with a Windows binary, i.e. notepad, using an APE binary is not necessary:

zcobol@toto:~$ notepad.exe
<3>WSL (413) ERROR: UtilAcceptVsock:251: accept4 failed 110
OneBlue commented 2 months ago

Ok I see. This is unfortunately the same issue as #8203. There seems to be support for binfmt namespacing in recent kernels so we might be able to finally implement this.

/dupe #8203

benhillis commented 1 month ago

https://github.com/microsoft/WSL/releases/tag/2.3.21