-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Listed in
Labels
A-stack-probeArea: Stack probing and guard pagesArea: Stack probing and guard pagesC-bugCategory: This is a bug.Category: This is a bug.O-muslTarget: The musl libcTarget: The musl libc
Description
In #30629 I disabled guard pages on musl. I did this because one of the pthread calls (I've forgotten which) was segfaulting during runtime initialization on i686-unknown-linux-musl, with my local build of musl, and I just wanted it working.
It should at least be on for x86_64 where it's known to work on the bots.
Metadata
Metadata
Assignees
Labels
A-stack-probeArea: Stack probing and guard pagesArea: Stack probing and guard pagesC-bugCategory: This is a bug.Category: This is a bug.O-muslTarget: The musl libcTarget: The musl libc
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
alexcrichton commentedon Jul 3, 2017
I've found this issue again through #42816 as it bounced. I poked around in the source code for musl and it looks like guard pages are not disabled. What it looks like is that guard page detection in libstd is disabled.
Our detection of the guard page relies on
pthread_getattr_np
which on musl is implemented to only fill out some fields, specifically not the fields related to the guard size.I believe the consequence of this is that on musl you don't get a pretty "you overflowed your stack" error message, you just get a scary segfault. Technically though I believe guard pages are indeed enabled and we'll guarantee segfaults on stack overflow.
gilescope commentedon Jun 12, 2018
Looking at the musl source, musl is now specifying the guard size as of the feb 2018 commit:
https://git.musl-libc.org/cgit/musl/commit/src?id=7c709f2d4f9872d1b445f760b0e68da89e256b9e
and I've checked that it picked up in mainline musl v1.1.19 and that looks like it will be in AlpineLinux 3.8 once it comes out...
mati865 commentedon Jan 10, 2019
I tried enabling it in https://github.com/rust-lang/rust/blob/6ecad338381cc3b8d56e2df22e5971a598eddd6c/src/libstd/sys/unix/thread.rs but overflow tests fail the same way as before.
At least i686 build didn't crash.