Commit Graph

20255 Commits

Author SHA1 Message Date
Michael Kerrisk d89d14246a clone3.2: New link to clone(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 16:32:33 +02:00
Michael Kerrisk faa0e55ae9 clone.2: Document clone3()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 15:39:04 +02:00
Michael Kerrisk e2bf12346d clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 15:34:14 +02:00
Michael Kerrisk b7cf324fd8 clone.2: Minor change: move a paragraph from DESCRIPTION to NOTES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:26:26 +02:00
Michael Kerrisk 5fbce8f22b clone.2: Add some subsection headings
Again, in preparation for adding clone3() documentation.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:25:14 +02:00
Michael Kerrisk 81c2368f46 clone.2: Rename arguments for consistency with clone3()
Sometime soon, we'll have to add documentation of clone3() to this
page. As a preparatorys step, make the names of the clone()
arguments the same as the fields in the clone3() 'args' struct:

    ctid        ==> child_pid
    ptid        ==> parent_tid
    newtls      ==> tld
    child_stack ==> stack

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:13:44 +02:00
Michael Kerrisk 576b9ea7ae abort.3: wfix
Reported-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-16 21:47:20 +02:00
Michael Kerrisk f83eb6bf0d mount.2, pidfd_open.2, fuse.4: Minor fix: s/file system/filesystem/
Reported-by: Marko Myllynen <myllynen@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-13 21:04:32 +02:00
Michael Kerrisk ff8ddd1121 wait.2: Clarify semantics of waitpid(0, ...)
As noted in kernel commit 821cc7b0b205c0df64cce59aacc330af251fa8f7,
threads create an ambiguity: what if the calling process's PGID
is changed by another thread while waitpid(0, ...) is blocked?
So, clarify that waitpid(0, ...) means wait for children whose
PGID matches the caller's PGID at the time of the call to
waitpid().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-13 00:20:46 +02:00
Michael Kerrisk bc4a678613 wait.2: waitid() can be used to wait on children in same process group as caller
Since Linux 5.4, idtype == P_PGID && id == 0 can be used to wait
on children in same process group as caller.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk f3ea12fb84 wait.2: Add P_PIDFD for waiting on a child referred to by a PID file descriptor
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk 9e1b1cd286 pidfd_open.2: Note the waitid() use case for PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk d069725512 pidfd_open.2: Minor fix: add some structure to text on use cases
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk ecefd5997f pidfd_open.2: Add a subsection header "Use cases for PID file descriptors"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:35 +02:00
Michael Kerrisk ecf77dbc1c pidfd_open.2: Make it a little more explicit the CLONE_PIDFD returns a PID FD
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:53 +02:00
Michael Kerrisk 6c7331a414 pidfd_open.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:53 +02:00
Michael Kerrisk 441632abcc pidfd_open.2: Remove a redundant sentence
clone() CLONE_PIDFD is already mentioned elsewhere in NOTES.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:46 +02:00
Michael Kerrisk 0b1348ba35 getauxval.3: Clarify that AT_BASE_PLATFORM and AT_EXECFN return pointers to strings
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942207

Reported-by: Witold Baryluk <witold.baryluk@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 14:23:15 +02:00
Michael Kerrisk 23c167c6a5 select.2: POLLIN_SET/POLLOUT_SET/POLLEX_SET are now defined in terms of EPOLL*
Since kernel commit a9a08845e9acbd224e4ee466f5c1275ed50054e8, the
equivalence between select() and poll()/epoll is defined in terms
of the EPOLL* constants, rather than the POLL* constants.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 13:49:27 +02:00
Jakub Wilk bce2cf9805 mount_namespaces.7: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 23:45:12 +02:00
Jakub Wilk 22bff75859 strptime.3: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 23:45:02 +02:00
Michael Kerrisk 5eb7b3cb3a Ready for 5.04 2019-10-11 23:07:30 +02:00
Michael Kerrisk 5d5a4ce13b Changes.old: Fix typos in 5.03 change log
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 22:36:08 +02:00
Michael Kerrisk 3bbd397157 Ready for 5.04 2019-10-11 22:15:52 +02:00
Michael Kerrisk c9f0cf93bb Start of man-pages-5.04: updating Changes and Changes.old 2019-10-11 11:01:23 +02:00
Michael Kerrisk 2c5d0a7d93 Start of man-pages-5.04: updating .Announce and .lsm files 2019-10-11 11:01:23 +02:00
Michael Kerrisk 7e3d2b865b Start of man-pages-5.04: renaming .Announce and .lsm files 2019-10-11 11:01:23 +02:00
Michael Kerrisk e12e9986fa Ready for 5.03 2019-10-11 10:56:00 +02:00
Michael Kerrisk 867c9b3408 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
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 10:45:02 +02:00
Michael Kerrisk cdb9217972 Changes: Ready for 5.03
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 10:45:02 +02:00
Michael Kerrisk 20a3713221 pidfd_open.2: Further enhancements to fork() + pidfd_open() text
Christian noted that SA_NOCLDWAIT also matters in this scenario.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk b869edcbc9 pidfd_open.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 8f57d60f5c pidfd_open.2: tfix
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 13ad736507 pidfd_open.2: Enhance the discussion of usage of fork() + pidfd_open()
After review comments from Christian and Daniel.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Reported-by: Daniel Colascione <dancol@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 59341b5269 pidfd_open.2: Explain how pidfd_open() can be used to with fork()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 6059228b26 pidfd_send_signal.2: Minor wording improvement
Reported-by: Daniel Colascione <dancol@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 6ff9a0d85e pidfd_send_signal.2: tfix
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk d651cc6015 pidfd_send_signal.2: Fixes after review comments from Florian Weimer
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk f831492d2b pidfd_send_signal.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 1a5adccc69 pidfd_open.2: Add some missing errors
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 57a436eb4c pidfd_open.2: Improve description in example
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4e547536bb pidfd_open.2: Add a comment on system call number in example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk ad0434de58 pidfd_open.2: read(2) of a PID file descriptor fails with EINVAL
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 9e9bf5383a pidfd_open.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 1523b08d3b pidfd_open.2: wfix
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 465f610c4c pidfd_open.2: Add <sys/types.h> to SYNOPSIS
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4654d63c35 pidfd_send_signal.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 690fbab2ee pidfd_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk d883766832 clone.2: SEE ALSO: add pidfd_open(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 30d0d39a4f pidfd_open.2: Opening /proc/PID doesn't yield a pollable file descriptor
Thus, pidfd_open() is the preferred way of obtaining a PID
file descriptor.

Notes from a conversation with Christian Brauner:

[[
> A further question... We now have three ways of getting a
> process file descriptor [*]:
>
> open() of /proc/PID
> pidfd_open()
> clone()/clone3() with CLONE_PIDFD
>
> I thought the FD was supposed to be equivalent in all three cases.
> However, if I try (on kernel 5.3) poll() an FD returned by opening
> /proc/PID, poll() tells me POLLNVAL for the FD. Is that difference
> intentional? (I am guessing it is not.)

It's intentional.
The short answer is that /proc/<pid> is a convenience for sending
signals.
The longer answer is that this stems from a heavy debate about what a
process file descriptor was supposed to be and some people pushing for
at least being able to use /proc/<pid> dirfds while ignoring security
problems as soon as you're talking about returning those fds from
clone(); not to mention the additional problems discovered when trying
to implementing this.
A "real" pidfd is one from CLONE_PIDFD or pidfd_open() and all features
such as exit notification, read, and other future extensions will only
be implemented on top of them.
As much as we'd have liked to get rid of two different file descriptor
types it doesn't hurt us much and is not that much different from what
we will e.g. see with fsinfo() in the new mount api which needs to work
on regular fds gotten via open()/openat() and mountfds gotten from
fsopen() and fspick(). The mountfds will also allow for advanced
operations that the other ones will not. There's even an argument to be
made that fds you will get from open()/openat() and openat2() are
different types since they have very different behavior; openat2()
returning fds that are non arbitrarily upgradable etc.
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00