-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Allocate a guard page for each newly created thread #2545
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
Conversation
d25f638
to
4242563
Compare
This PR no longer relies on the kernel's guard page (it removes |
Yes, but |
TIL.
How does this work if not |
The kernel is still using that flag internally (as
The whole stack is allocated and a guard page is added, a simple trick that solves so many (security) problems. |
4242563
to
381f845
Compare
mmap_slice, | ||
os.PROT_READ | os.PROT_WRITE, | ||
) catch |err| switch (err) { | ||
error.OutOfMemory => unreachable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this truly unreachable? My understanding is that this "splits" a mapping which can potentially result in ENOMEM. Fortunately OutOfMemory is one of the possible errors of spawning a thread, so I think we can just return it.
No description provided.