mirror of https://github.com/mkerrisk/man-pages
99c3a00027
Christian Brauner suggested mmap(MAP_STACKED), rather than malloc(), as the canonical way of allocating a stack for the child of clone(), and Jann Horn noted some reasons why: Not on Linux, but on OpenBSD, they do use MAP_STACK now AFAIK; this was announced here: <http://openbsd-archive.7691.n7.nabble.com/stack-register-checking-td338238.html>. Basically they periodically check whether the userspace stack pointer points into a MAP_STACK region, and if not, they kill the process. So even if it's a no-op on Linux, it might make sense to advise people to use the flag to improve portability? I'm not sure if that's something that belongs in Linux manpages. Another reason against malloc() is that when setting up thread stacks in proper, reliable software, you'll probably want to place a guard page (in other words, a 4K PROT_NONE VMA) at the bottom of the stack to reliably catch stack overflows; and you probably don't want to do that with malloc, in particular with non-page-aligned allocations. And the OpenBSD 6.5 manual pages says: MAP_STACK Indicate that the mapping is used as a stack. This flag must be used in combination with MAP_ANON and MAP_PRIVATE. And I then noticed that MAP_STACK seems already to be on FreeBSD for a long time: MAP_STACK Map the area as a stack. MAP_ANON is implied. Offset should be 0, fd must be -1, and prot should include at least PROT_READ and PROT_WRITE. This option creates a memory region that grows to at most len bytes in size, starting from the stack top and growing down. The stack top is the start‐ ing address returned by the call, plus len bytes. The bottom of the stack at maximum growth is the starting address returned by the call. The entire area is reserved from the point of view of other mmap() calls, even if not faulted in yet. Reported-by: Jann Horn <jannh@google.com> Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com> |
||
---|---|---|
man1 | ||
man2 | ||
man3 | ||
man4 | ||
man5 | ||
man6 | ||
man7 | ||
man8 | ||
scripts | ||
CONTRIBUTING | ||
Changes | ||
Changes.old | ||
Makefile | ||
README | ||
man-pages-5.04.Announce | ||
man-pages-5.04.lsm |
README
This package contains Linux man pages for sections 1 through 8. Some more information is given in the 'man-pages-x.y.Announce' file. Installing and uninstalling =========================== "make install" will copy these man pages to /usr/share/man/man[1-8]. To install to a path different from /usr, use "make install prefix=/install/path". "make remove" or "make uninstall" will remove any man page in this distribution from its destination. Use with caution, and remember to use "prefix" if desired, as with the "install" target. "make" or "make all" will perform "make uninstall" followed by "make install". Man page overlap and duplication ================================ Note that sometimes these pages are duplicates of pages also distributed in other packages. This has been reported about: man page also found in ------------------------------------- resolver.3 bind-utils, bind9utils resolv.conf.5 " passwd.5 shadow, passwd mailaddr.7 ? Copyrights ========== See the 'man-pages-x.y.Announce' file. Homepage ======== For much more about the Linux man-pages project, see http://www.kernel.org/doc/man-pages/index.html.