-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Boostraped rustc fails in thread initialization on NetBSD #50313
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
Comments
I could at least trace it, so the failing call is: 8094 1 rustc CALL mprotect(0x7f7fff006000,0x1000,3) which looks like a properly aligned stack address, 1 page, and RW mapping request. |
... and the corresponding mmap worked and returned the same address, so all looks fine: 8094 1 rustc CALL mmap(0x7f7fff006000,0x1000,PROT_NONE,0x1012<PRIVATE,FIXED,,,>,0xffffffff,0,0) I'm puzzled |
Found it: Fix is simple: change the initial mmap() to MAP_READ|MAP_WRITE and do an mprotect(0) right away. This creates a mapping that allows later mprotect(MAP_READ|MAP_WRITE). |
Map the stack guard page with max protection on NetBSD On NetBSD the initial mmap() protection of a mapping can not be made less restrictive with mprotect(). So when mapping a stack guard page, use the maximum protection we ever want to use, then mprotect() it to the permission we want it to have initially. Fixes #50313
Trying to build rustc on NetBSD fails, after creating a local rustc, it fails when invoked for the first time:
thread 'main' panicked at 'unable to reset the guard page',libstd/sys/unix/thread.rs:361:21
I have no idea why that mprotect() call fails, it would be helpfull if the panic would mention the address and the return value.
Unfortunately I can't just invoke the same binary manually as it needs some secret/hidden environment setup to work.
The text was updated successfully, but these errors were encountered: