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

MAP_STACK is a no-op on linux #119

Open
lolbinarycat opened this issue May 27, 2024 · 3 comments
Open

MAP_STACK is a no-op on linux #119

lolbinarycat opened this issue May 27, 2024 · 3 comments

Comments

@lolbinarycat
Copy link

https://www.man7.org/linux/man-pages/man2/mmap.2.html

on linux, memmap2 should use MAP_GROWSDOWN, or possibly MAP_GROWSDOWN | MAP_STACK, for future proofing (glibc uses MAP_STACK despite it doing nothing).

@adamreichold
Copy link

If we do decide to set GROWSDOWN, we need to ensure the rest of the code is able to handle the automatic growth and adjusted return value properly. I think this is quite the project compared to just setting the flag.

@lolbinarycat
Copy link
Author

MAP_GROWSDOWN will not cause the mapping region to grow beyond the requested bounds. it will cause it to start at one page, and then whenever the next "guard page" is touched, it grows by a page, up to the size initially requested. it is equivalent to MAP_STACK on bsd systems.

@adamreichold
Copy link

Isn't that behaviour also tied to stack probing, i.e. it does not happen if the fault lies beyond the guard page?

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

No branches or pull requests

2 participants