A mirror of Man pages
Go to file
Michael Kerrisk 99c3a00027 clone.2: Allocate child's stack using mmap(2) rather than malloc(3)
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>
2019-11-14 12:19:21 +01:00
man1 localedef.1, close.2, copy_file_range.2, execve.2, get_robust_list.2, getdomainname.2, gethostname.2, inotify_add_watch.2, io_submit.2, ioctl_fideduperange.2, kcmp.2, kill.2, mmap.2, move_pages.2, perf_event_open.2, ptrace.2, rt_sigqueueinfo.2, sched_setaffinity.2, sched_setparam.2, setns.2, sigaction.2, signalfd.2, statx.2, syscall.2, syscalls.2, uname.2, write.2, errno.3, fexecve.3, getauxval.3, printf.3, pthread_mutex_consistent.3, pthread_mutexattr_init.3, pthread_mutexattr_setrobust.3, pthread_setcancelstate.3, regex.3, strtok.3, strtol.3, ttyname.3, smartpqi.4, core.5, resolv.conf.5, man-pages.7, mq_overview.7, operator.7, pthreads.7, signal-safety.7, sysvipc.7: Update timestamp 2019-10-11 10:45:02 +02:00
man2 clone.2: Allocate child's stack using mmap(2) rather than malloc(3) 2019-11-14 12:19:21 +01:00
man3 strftime.3: wfix 2019-11-13 20:35:53 +01:00
man4 mount.2, pidfd_open.2, fuse.4: Minor fix: s/file system/filesystem/ 2019-10-13 21:04:32 +02:00
man5 resolv.conf.5: srcfix 2019-11-07 13:21:53 +01:00
man6 intro.6: wfix 2017-08-25 21:41:03 +02:00
man7 uts_namespaces.7: Add a little more detail on scope of UTS namespaces 2019-11-09 09:09:18 +01:00
man8 ld.so.8: tfix 2019-08-26 23:14:49 +02:00
scripts scripts: mark them executable 2018-05-31 21:34:32 +02:00
CONTRIBUTING CONTRIBUTING: New file with some starting tips on how to contribute 2019-09-13 15:59:08 +02:00
Changes Ready for 5.04 2019-10-11 23:07:30 +02:00
Changes.old Changes.old: Fix typos in 5.03 change log 2019-10-11 22:36:08 +02:00
Makefile Makefile: Remove a redundant comment 2017-11-20 10:38:10 +01:00
README README: tfix 2017-05-13 20:14:15 +02:00
man-pages-5.04.Announce Start of man-pages-5.04: updating .Announce and .lsm files 2019-10-11 11:01:23 +02:00
man-pages-5.04.lsm Ready for 5.04 2019-10-11 23:07:30 +02:00

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.