Skip to content
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

Need some readonly /proc/sys/vm values on WSL1 #10049

Open
Artoria2e5 opened this issue May 1, 2023 · 1 comment
Open

Need some readonly /proc/sys/vm values on WSL1 #10049

Artoria2e5 opened this issue May 1, 2023 · 1 comment

Comments

@Artoria2e5
Copy link

Is your feature request related to a problem? Please describe.
WSL1 currently does not work with qemu. The symptoms are basically the same as termux/termux-packages#6172, with:

qemu-i386-static: Unable to reserve 0xfffff000 bytes of virtual address space at 0x1000 (Operation not supported) for use as guest address space (check your virtual memory ulimit setting, min_mmap_addr or reserve less using -R option)

This is due to /proc/sys/vm/mmap_min_addr not existing, at all.

Describe the solution you'd like
Add some readonly values so applications can read them. I know changing them is not something to really expect, but reading is required for a lot of things.

This is the same as @Dakkaron's question in #3126 (comment):

Would it be possible to create that file as read-only with a fitting value in it? I keep getting errors with programs that expect that value to exist, e.g. Elastic Search. I don't care too much about what that value is, but scripts keep crashing because that file does not exist. Maybe just make that file writable but ignored or something.

Describe alternatives you've considered
I suppose I could use WSL2 or compile my own qemu. Hyper-V is kept off due to gaming reasons. Building my own qemu or asking my distribution to do a patch does not make sense.

Additional context
Linux [hostname] 4.4.0-22621-Microsoft #1610-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 GNU/Linux

@Artoria2e5
Copy link
Author

Artoria2e5 commented May 13, 2023

We need another test case! qemu is failing due to a different reason (#10102). I should try elastic search or whatever it's called.

mmap fiddle Huh, this might still be a different issue. The default 4K address actually seems to work at least with this test program:
#include <unistd.h>
#include <sys/mman.h>
#include <stdio.h>

int main(){
        void* a = mmap((void*) (4096 ), 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_ANON, -1, 0);
        printf("%08lx", (long)a);
        perror("mmap");
}

Huuuuuhhhhh I changed the 4096 requested size to 0xfffff000 and it still worked. Something's wrong with my test case.

strace says

 mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE|MAP_FIXED_NOREPLACE, -1, 0) = -1 EOPNOTSUPP (Operation not supported)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants