aboutsummaryrefslogtreecommitdiffstats
path: root/man2
AgeCommit message (Collapse)AuthorFilesLines
2019-10-25clone.2: Minor improvements following clone3() additionsMichael Kerrisk1-35/+27
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25clone.2: srcfix: update copyrightMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25clone3.2: New link to clone(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25clone.2: Document clone3()Michael Kerrisk1-43/+214
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24clone.2: wfixMichael Kerrisk1-4/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24clone.2: Minor change: move a paragraph from DESCRIPTION to NOTESMichael Kerrisk1-5/+6
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24clone.2: Add some subsection headingsMichael Kerrisk1-1/+7
Again, in preparation for adding clone3() documentation. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24clone.2: Rename arguments for consistency with clone3()Michael Kerrisk1-40/+40
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-13mount.2, pidfd_open.2, fuse.4: Minor fix: s/file system/filesystem/Michael Kerrisk2-2/+2
Reported-by: Marko Myllynen <myllynen@redhat.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-13wait.2: Clarify semantics of waitpid(0, ...)Michael Kerrisk1-1/+2
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-12wait.2: waitid() can be used to wait on children in same process group as callerMichael Kerrisk1-0/+6
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-12wait.2: Add P_PIDFD for waiting on a child referred to by a PID file descriptorMichael Kerrisk1-0/+7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Note the waitid() use case for PID file descriptorsMichael Kerrisk1-1/+7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Minor fix: add some structure to text on use casesMichael Kerrisk1-1/+9
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Add a subsection header "Use cases for PID file descriptors"Michael Kerrisk1-0/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Make it a little more explicit the CLONE_PIDFD returns a PID FDMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Minor wording improvementMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12pidfd_open.2: Remove a redundant sentenceMichael Kerrisk1-5/+0
clone() CLONE_PIDFD is already mentioned elsewhere in NOTES. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12select.2: POLLIN_SET/POLLOUT_SET/POLLEX_SET are now defined in terms of EPOLL*Michael Kerrisk1-6/+7
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-11localedef.1, close.2, copy_file_range.2, execve.2, get_robust_list.2, ↵Michael Kerrisk26-26/+26
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-10pidfd_open.2: Further enhancements to fork() + pidfd_open() textMichael Kerrisk1-0/+9
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-10pidfd_open.2: wfixMichael Kerrisk1-1/+1
Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: tfixMichael Kerrisk1-1/+1
Reported-by: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: Enhance the discussion of usage of fork() + pidfd_open()Michael Kerrisk1-5/+25
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-10pidfd_open.2: Explain how pidfd_open() can be used to with fork()Michael Kerrisk1-0/+21
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: Minor wording improvementMichael Kerrisk1-4/+2
Reported-by: Daniel Colascione <dancol@google.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: tfixMichael Kerrisk1-1/+1
Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: Fixes after review comments from Florian WeimerMichael Kerrisk1-1/+4
Reported-by: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: wfixMichael Kerrisk1-1/+1
Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: Add some missing errorsMichael Kerrisk1-0/+16
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-10pidfd_open.2: Improve description in exampleMichael Kerrisk1-6/+4
Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: Add a comment on system call number in example codeMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: read(2) of a PID file descriptor fails with EINVALMichael Kerrisk1-1/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: wfixMichael Kerrisk1-2/+2
Reported-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: wfixMichael Kerrisk1-1/+1
Reported-by: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: Add <sys/types.h> to SYNOPSISMichael Kerrisk1-0/+3
Reported-by: Florian Weimer <fw@deneb.enyo.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: tfixMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: tfixMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: SEE ALSO: add pidfd_open(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: Opening /proc/PID doesn't yield a pollable file descriptorMichael Kerrisk1-0/+13
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-10sigaction.2: SEE ALSO: add pidfd_send_signal(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10rt_sigqueueinfo.2: SEE ALSO: add pidfd_send_signal(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10kill.2: SEE ALSO: add pidfd_send_signal(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_send_signal.2: New page documenting pidfd_send_signal(2)Michael Kerrisk1-0/+254
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pidfd_open.2: New page documenting pidfd_open(2)Michael Kerrisk1-0/+164
Notes from a conversation on linux-man@ with Christian Brauner: [[ > [*} By the way, going forward, can we call these things > "process FDs", rather than "PID FDs"? The API names are what > they are, an that's okay, but these just as we have socket > FDs that refer to sockets, directory FDs that refer to > directories, and timer FDs that refer to timers, and so on, > these are FDs that refer to *processes*, not "process IDs". > It's a little thing, but I think the naming better, and > it's what I propose to use in the manual pages. The naming was another debate and we ended with this compromise. I would just clarify that a pidfd is a process file descriptor. I wouldn't make too much of a deal of hiding the shortcut "pidfd". People are already using it out there in the wild and it's never proven a good idea to go against accepted practice. ]] Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: Refer to pidfd_open(2) for the purpose of PID file descriptorsMichael Kerrisk1-0/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: Minor wording improvementsMichael Kerrisk1-5/+5
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: Remove a CLONE_PIDFD detail that wasn't true in the final ↵Michael Kerrisk1-10/+0
implementation Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: The close-on-exec flag is set on the new FD returned by CLONE_PIDFDMichael Kerrisk1-0/+1
In the kernel source (kernel/fork.c::copy_process()), there is: pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops, pid, O_RDWR | O_CLOEXEC); Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: ffix (split a paragraph)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: Minor tweaks to Christian Brauner's patchMichael Kerrisk1-3/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: srcfix: wrap source at sentence boundariesMichael Kerrisk1-4/+9
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10clone.2: Document CLONE_PIDFDChristian Brauner1-0/+51
Add an entry for CLONE_PIDFD. This flag is available starting with kernel 5.2. If specified, a process file descriptor ("pidfd") referring to the child process will be returned in the ptid argument. Signed-off-by: Christian Brauner <christian@brauner.io> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Update the copyright and licenseMichael Kerrisk1-7/+23
After my rewriting, almost nothing of the original page remains, so update the copyright. As the author, I'm relicensing to the "verbatim" license most commonly used in man pages. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Minor wording tweaksMichael Kerrisk1-8/+10
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Another couple of s/filesystem/mount/Michael Kerrisk1-2/+2
This is consistent with some earlier changes suggested by Eric Biederman. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Tweak text of an EINVAL error to correspond to DESCRIPTIONMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Relegate text about what pivot_root() may or may not do to NOTESMichael Kerrisk1-27/+24
The text stating that "pivot_root() may or may not change the current root and the current working directory of any processes or threads which use the old root directory" was written 19 years ago, before the system call itself was even finalized in the kernel. The implementation has never changed, and it won't change in the future, since that would cause user-space breakage. The existence of that text in DESCRIPTION, followed by qualifying text stating what the implementation actually does (and has always done) makes for confusing reading. Therefore, relegate this text to a historical note in NOTES (so that readers with long memories can see why the manual page was changed) and rework the text in DESCRIPTION accordingly. Reported-by: Philipp Wendler <ml@philippwendler.de> Reported-by: Eric W. Biederman <ebiederm@xmission.com> Reported-by: Reid Priedhorsky <reidpr@lanl.gov> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Add a subsection header for the pivot_root(".", ".") discussionMichael Kerrisk1-0/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: Minor change: relocate a paragraph in NOTESMichael Kerrisk1-12/+12
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10pivot_root.2: s/root filesystem/root mount/Michael Kerrisk1-4/+4
As suggested by Eric Biederman. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09pivot_root.2: Reword one of the restrictions on 'new_root'Michael Kerrisk1-6/+3
A suggested by Eric Biederman Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09pivot_root.2: Change "filesystem" to "mount" in various placesMichael Kerrisk1-3/+5
Quoting Eric: If we are going to be pedantic "filesystem" is really the wrong concept here. The section about bind mount clarifies it, but I wonder if there is a better term. I think I would say: "new_root and put_old must not be on the same mount as the current root." I think using "mount" instead of "filesystem" keeps the concepts less confusing. As I am reading through this email and seeing text that is trying to be precise and clear then hitting the term "filesystem" is a bit jarring. pivot_root doesn't care a thing for file systems. pivot_root only cares about mounts. And by a "mount" I mean the thing that you get when you create a bind mount or you call mount normally. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09pivot_root.2: Simplify discussion of restrictions for 'new_root'Michael Kerrisk1-9/+7
Philipp Wendler noted that the text on the restrictions for 'new_root' was slightly contradictory, and things could be clarified and simplified by describing the restrictions on 'new_root' in one place. Reported-by: Philipp Wendler <ml@philippwendler.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09pivot_root.2: Remove an imprecision in descriptionMichael Kerrisk1-3/+3
Remove the text that suggests that pivot_root() changes the root directory and CWD of process that have directory and CWD on the old root *filesystem*. Change "filesystem" to "directory". Reported-by: Philipp Wendler <ml@philippwendler.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08pivot_root.2: srcfix: FIXMEMichael Kerrisk1-0/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08pivot_root.2: Remove the term 'old_root'Michael Kerrisk1-4/+1
Reid noted a confusion between 'old_root' (my attempt at a shorthand for the old root point) and 'put_old. Eliminate the confusion by replacing the shorthand with "old root mount point". Reported-by: Reid Priedhorsky <reidpr@lanl.gov> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08mount.2: Describe the concept of "parent mounts"Michael Kerrisk1-0/+17
Reported-by: Reid Priedhorsky <reidpr@lanl.gov> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08mount.2: tfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08mount.2: Rework the text on mount namespaces a littleMichael Kerrisk1-4/+6
Eliminate the term "Per-process namespaces" and add a reference to mount_namespaces(7). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08mount.2: wfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08mount.2: NOTES: add subsection heading for /proc/[pid]/{mounts,mountinfo}Michael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-07pivot_root.2: Simplify pivot_root(".", ".") exampleMichael Kerrisk1-2/+0
Eric Biederman notes that the change in commit f646ac88ef83969 was not strictly necessary for this example, since one of the already documented requirements is that various mount points must not have shared propagation, or else pivot_root() will fail. So, simplify the example. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-05perf_event_open.2: SEE ALSO: add Documentation/admin-guide/perf-security.rstMichael Kerrisk1-0/+3
Reported-by: Alexey Budankov <alexey.budankov@linux.intel.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: Clarify that PR_MCE_KILL_GET returns value via function resultMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: wfix (for consistency)Michael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: RETURN VALUE: add some missing entriesMichael Kerrisk1-0/+2
Note success return for PR_GET_SPECULATION_CTRL and PR_GET_FP_MODE. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: Clarify that PR_GET_SPECULATION_CTRL returns value as function resultMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: grfixMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: wfix (for consistency with usage in rest of this page)Michael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02prctl.2: Clarify that PR_GET_FP_MODE returns value as function resultMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27sched_setparam.2, pthread_mutexattr_init.3, pthread_mutexattr_setrobust.3, ↵Michael Kerrisk1-1/+1
pthread_mutex_consistent.3, strtol.3, sched.7, uts_namespaces.7: SEE ALSO: correct list order Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27close.2, execve.2, io_submit.2, prctl.2, write.2: Remove section number from ↵Michael Kerrisk5-8/+8
references to function in its own page Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27copy_file_range.2, fanotify_mark.2, inotify_add_watch.2, ↵Michael Kerrisk8-88/+87
ioctl_fideduperange.2, kcmp.2, prctl.2, get_robust_list.2, tkill.2, ttyname.3: ERRORS: correct alphabetical order Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27copy_file_range.2: Kernel v5.3 updatesAmir Goldstein1-13/+76
Update with all the missing errors the syscall can return, the behaviour the syscall should have w.r.t. to copies within single files, etc. [Amir] updates for final released version. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27epoll_wait.2: tfixMichael Kerrisk1-1/+1
Reported-by: nilsocket <nilsocket@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25signalfd.2: tfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25pivot_root.2: tfixJakub Wilk1-2/+2
Remove duplicated words. Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25sched_setaffinity.2: RETURN VALUE: sched_getaffinity() syscall differs from ↵Michael Kerrisk1-1/+4
the wrapper In RETURN VALUE, point reader at subsection noting that the return value of the raw sched_setaffinity() system call differs from the wrapper function in glibc. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-24open.2: tfixMichael Kerrisk1-1/+1
Reported-by: Дилян Палаузов <dilyan.palauzov@aegee.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23signalfd.2: Rewrite the text on epoll semanticsMichael Kerrisk1-16/+26
I also verified the behavior reported by Andrew Clayton with the program below. $ ./epoll_signalfd PID of parent: 5661 PID of child: 5662 epoll_wait() returned 0 PID 5662: got signal 10 Successfully read signal, even though epoll_wait() didn't say FD was ready! 8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x---- /* epoll_signalfd.c */ #include <sys/signalfd.h> #include <signal.h> #include <sys/epoll.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) static void signalTest(int sfd, int epfd) { struct signalfd_siginfo fdsi; struct epoll_event rev; int ready; ssize_t s; usleep(50000); ready = epoll_wait(epfd, &rev, 1, 0); if (ready == -1) errExit("epoll_wait"); printf("epoll_wait() returned %d\n", ready); s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo)); if (s != sizeof(struct signalfd_siginfo)) errExit("read"); printf("PID %ld: got signal %d\n", (long) getpid(), fdsi.ssi_signo); if (ready == 0 && s > 0) printf("Successfully read signal, even though epoll_wait() " "didn't say FD was ready!\n"); } int main(int argc, char *argv[]) { struct epoll_event ev; sigset_t mask; int sfd, epfd; sigfillset(&mask); sigdelset(&mask, SIGINT); if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1) errExit("sigprocmask"); sfd = signalfd(-1, &mask, SFD_NONBLOCK); if (sfd == -1) errExit("signalfd"); epfd = epoll_create(5); if (epfd == -1) errExit("epoll_create"); ev.data.fd = sfd; ev.events = EPOLLIN; if (epoll_ctl(epfd, EPOLL_CTL_ADD, sfd, &ev) == -1) errExit("epoll_ctl"); switch (fork()) { case -1: errExit("fork"); case 0: printf("PID of child: %ld\n", (long) getpid()); raise(SIGUSR1); signalTest(sfd, epfd); break; default: printf("PID of parent: %ld\n", (long) getpid()); wait(NULL); break; } exit(EXIT_SUCCESS); } 8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x---- Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23signalfd.2: Note about interactions with epoll & forkAndrew Clayton1-0/+17
Using signalfd(2) with epoll(7) and fork(2) can lead to some head scratching. It seems that when a signalfd file descriptor is added to epoll you will only get notifications for signals sent to the process that added the file descriptor to epoll. So if you have a signalfd fd registered with epoll and then call fork(2), perhaps by way of daemon(3) for example. Then you will find that you no longer get notifications for signals sent to the newly forked process. User kentonv on ycombinator[0] explained it thus "One place where the inconsistency gets weird is when you use signalfd with epoll. The epoll will flag events on the signalfd based on the process where the signalfd was registered with epoll, not the process where the epoll is being used. One case where this can be surprising is if you set up a signalfd and an epoll and then fork() for the purpose of daemonizing -- now you will find that your epoll mysteriously doesn't deliver any events for the signalfd despite the signalfd otherwise appearing to function as expected." And another post from the same person[1]. And then there is this snippet from this kernel commit message[2] "If you share epoll fd which contains our sigfd with another process you should blame yourself. signalfd is "really special"." So add a note to the man page that points this out where people will hopefully find it sooner rather than later! [0]: https://news.ycombinator.com/item?id=9564975 [1]: https://stackoverflow.com/questions/26701159/sending-signalfd-to-another-process/29751604#29751604 [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d80e731ecab420ddcb79ee9d0ac427acbc187b4b Signed-off-by: Andrew Clayton <andrew@digital-domain.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Explain why various mount points can't have shared propagationMichael Kerrisk1-0/+3
Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Correct the list of mount points that can't be MS_SHAREDMichael Kerrisk1-3/+3
Eric Biederman noted that my list of directories that could not have shared propagation was incorrect. I had written that new_root could not be shared; rather it should be: the parent of the current root mount point. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Tweak pivot_root(".", ".") exampleMichael Kerrisk1-0/+2
Quoting Eric Biederman: The concern from our conversation at the container mini-summit was that there is a pathology if in your initial mount namespace all of the mounts are marked MS_SHARED like systemd does (and is almost necessary if you are going to use mount propagation), that if new_root itself is MS_SHARED then unmounting the old_root could propagate. So I believe the desired sequence is: >>> chdir(new_root); +++ mount("", ".", MS_SLAVE | MS_REC, NULL); >>> pivot_root(".", "."); >>> umount2(".", MNT_DETACH); The change to new new_root could be either MS_SLAVE or MS_PRIVATE. So long as it is not MS_SHARED the mount won't propagate back to the parent mount namespace. Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: pivot_root(".", ".") really is a thingMichael Kerrisk1-1/+38
LXC uses this [1]. I tested, to double-check, and it works. The fchdir() dance done by LXC is not needed though: fchdir(old_root); umount(".", MNT_DETACH); fchdir(new_root); As far as I can see, just the umount() is sufficient, since, after pivot_root(), oldi_root is at the top of the stack of mounts at "/" and thus (so long as CWD is at "/") the umount will remove the mount at the top of the stack. Eric Biederman confirmed my understanding by mail, and Philipp Wendler verified my results by experiment. [1] See the following commit in LXC: commit 2d489f9e87fa0cccd8a1762680a43eeff2fe1b6e Author: Serge Hallyn <serge.hallyn@ubuntu.com> Date: Sat Sep 20 03:15:44 2014 +0000 pivot_root: switch to a new mechanism (v2) Helped-by: Eric W. Biederman <ebiederm@xmission.com> Helped-by: Philipp Wendler <ml@philippwendler.de> Helped-by: Aleksa Sarai <asarai@suse.de> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Eliminate text suggesting that behavior may change in the futureMichael Kerrisk1-8/+13
After around 19 years, the behavior of pivot_root() has not been changed, and will almost certainly not change in the future. So, reword to remove the suggestion that the behavior may change. Also, more clearly document the effect of pivot_root() on the calling process's current working directory. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Rework a "hanging" description into an earlier paragraphMichael Kerrisk1-7/+6
The reference of "Note that this also applies" was vague. So combine this paragraph with an earlier one to make the linkage clearer. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Remove a note about a historical idea/expectationMichael Kerrisk1-4/+0
The idea that there might one day be a mechanism for kernel threads to explicitly relinquish access to the filesystem never came to pass (after 20 years), and the presence of text describing this idea is, IMO, a distraction. So, remove it. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: ffix (break up a paragraph)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Remove text describing case where current root is not a mount ↵Michael Kerrisk1-13/+7
point One kernel printk() later, my suspicions seem confirmed: the text describing the situation where the current root is not a mount point (because of a chroot()) seems to be bogus. (Perhaps it was true once upon a time.) In my testing, if the current root is not a mount point, an EINVAL error results. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: srcfix: FIXMEMichael Kerrisk1-0/+8
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Fix a technical detailMichael Kerrisk1-3/+1
In this text: If the current root is not a mount point (e.g., after an earlier chroot(2) or pivot_root())... mention of pivot_root() makes no sense, since (as noted in an earlier commit message for this page) 'new_root' in a previous pivot_root() must (since Linux 2.4.5) have been a mount point. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Minor change: rewrite the reference to pivot_root(8)Michael Kerrisk1-4/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Remove BUGS sectionMichael Kerrisk1-9/+5
One of these "bugs" is a philosophical point already covered elsewhere in the page, while the other is a somewhat obscure joke. Both pieces are a bit of a distraction, really. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Minor wording fixMichael Kerrisk1-2/+5
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Relocate details about kernel threads to NOTESMichael Kerrisk1-8/+14
This text is a side point that somewhat distracts from the flow in DESCRIPTION. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Add some more detail to the remaining EBUSY errorMichael Kerrisk1-1/+22
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Remove bogus a bogus EBUSY error caseMichael Kerrisk1-2/+1
The note that EBUSY is given if a filesystem is already mounted on 'Iput_old' was never really true. That restriction was in Linux 2.3.14, but removed in Linux 2.3.99-pre6 so it never made it to mainline. The relevant diff in pivot_root() was: error = -EBUSY; - if (d_new_root->d_sb == root->d_sb || d_put_old->d_sb == root->d_sb) + if (new_nd.mnt == root_mnt || old_nd.mnt == root_mnt) goto out2; /* loop */ - if (d_put_old != d_put_old->d_covers) - goto out2; /* mount point is busy */ error = -EINVAL; Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Add an example programMichael Kerrisk1-0/+134
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Minor fix: add a reference to a relevant piece in NOTESMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Relocate text on use cases and add text on purpose of ↵Michael Kerrisk1-9/+18
pivot_root(2) Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Rework the text on "future changes" to reflect that 20 years ↵Michael Kerrisk1-3/+7
have passed Some of the text was written long ago, and hinted that things might change in the future. However, 20 years have passed and these details have not changed, so rework the text to hint at that fact. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Mention containers as a use case for pivot_root()Michael Kerrisk1-1/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: srcfixMichael Kerrisk1-4/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: There is no restriction against 'put_old' being a mount pointMichael Kerrisk1-2/+0
As far as I can see from the source code, the statement that "No other filesystem may be mounted on 'put_old'" is incorrect. Even looking at the 2.4.0 source code, there I can't see such a restriction. In addition, some testing on a 5.0 kernel (mounting 'put_old' in the new mount namespace just before pivot_root()) did not result in an error for this case when calling pivot_root(). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: srcfix: add self to copyrightMichael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: pivot_root() affects only other processes in the same mount ↵Michael Kerrisk1-3/+5
namespace pivot_root() only affects the current working directory and root directory of other processes in the same mount namespace as the caller. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Introduce mount namespaces in the very first sentenceMichael Kerrisk1-3/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Note capability requirementsMichael Kerrisk1-4/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Mention mount namespacesMichael Kerrisk1-2/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: SEE ALSO: add mount_namespaces(7)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: wfixMichael Kerrisk1-1/+1
"At the time of writing" was ~20 years ago. Things have not so far changed. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Reword some text that is currently rather hard to parseMichael Kerrisk1-4/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Minor tweakMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23pivot_root.2: Minor fix: place some text at a more logical location in the pageMichael Kerrisk1-14/+14
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19kill.2: Minor clarificationMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19rt_sigqueueinfo.2: Rename 'uinfo' argument to 'info'Michael Kerrisk1-4/+4
This is more consistent with the naming in other pages that refer to a 'siginfo_t' structure. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19rt_sigqueueinfo.2: The rules for 'si_code' don't apply when sending a signal ↵Michael Kerrisk1-4/+8
to oneself The restriction on what values may be specified in 'si_code' apply only when sending a signal to a process other than the caller itself. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19rt_sigqueueinfo.2: Note that 'si_code' can't be specified as SI_KERNELMichael Kerrisk1-1/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19rt_sigqueueinfo.2: Minor restructuring in preparation for next patchMichael Kerrisk1-7/+12
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19setns.2: Fix CLONE_NEWNS restriction infoMike Frysinger1-2/+6
Threads are allowed to switch mount namespaces if the filesystem details aren't being shared. That's the purpose of the check in the kernel quoted by the comment: if (fs->users != 1) return -EINVAL; It's been this way since the code was originally merged in v3.8. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13ptrace.2: Fix description of 'is_error' field in 'struct ptrace_syscall_info'Michael Kerrisk1-1/+3
Reported-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13mmap.2: Fix EINVAL conditionsNikola Forró1-4/+4
Since introduction of MAP_SHARED_VALIDATE, in case flags contain both MAP_PRIVATE and MAP_SHARED, mmap() doesn't fail with EINVAL, it succeeds. The reason for that is that MAP_SHARED_VALIDATE is in fact equal to MAP_PRIVATE | MAP_SHARED. This is intended behavior, see: https://lwn.net/Articles/758594/ https://lwn.net/Articles/758598/ Signed-off-by: Nikola Forró <nforro@redhat.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13io_submit.2: Fix kernel version numbers for 'aio_rw_flags' flagsMatti Moell1-3/+3
Even though the RFW_* flags were first introduced in Linux 4.6, they could not be used with aio until 4.13 where the aio_rw_flags field was added to struct iocb (9830f4be159b "fs: Use RWF_* flags for AIO operations"). Correct the stated version for each flag. Fixes: 2f72816f8680 ("io_submit.2: Add kernel version numbers for various 'aio_rw_flags' flags") Signed-off-by: Matti Möll <Matti.Moell@opensynergy.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13move_pages.2: Some reworking of Yang Xu's textMichael Kerrisk1-2/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13move_pages.2: Mark E2BIG as deprecatedYang Xu1-1/+2
E2BIG was removed in 2.6.29, we should mark it as deprecated. Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13syscall.2: Add information for powerpc64Shawn Anastasio1-0/+7
Add powerpc64 to the calling convention tables. Signed-off-by: Shawn Anastasio <shawn@anastas.io> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: Clarify meaning of ptrace_syscall_info 'is_error' fieldMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: ffixMichael Kerrisk1-16/+16
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: Describe the PTRACE_GET_SYSCALL_INFO 'op' value in more detailMichael Kerrisk1-17/+41
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: ffixMichael Kerrisk1-23/+23
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: Minor tweaks to Dmitry Levin's patchMichael Kerrisk1-1/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12ptrace.2: Document struct ptrace_syscall_infoDmitry V. Levin1-1/+50
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-11mprotect.2: wfixChristopher M. Riedl1-1/+1
Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10syscalls.2: Add clone3() and pidfd_open()Michael Kerrisk1-0/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10syscalls.2: Add fsconfig(), fsmount(), fsopen(), fspick(), move_mount(), ↵Michael Kerrisk1-0/+6
open_tree() Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10syscalls.2: Add new syscalls in 5.1Michael Kerrisk1-0/+4
Add io_uring_enter(), io_uring_register(), io_uring_setup(), and pidfd_send_signal(). Signed-off-by:(), Michael(), Kerrisk(), <mtk.manpages@gmail.com>
2019-09-10ptrace.2: Minor tweaks to Dmitry Levin's patchMichael Kerrisk1-6/+7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10ptrace.2: Document PTRACE_GET_SYSCALL_INFODmitry V. Levin1-0/+21
PTRACE_GET_SYSCALL_INFO request was introduced by Linux kernel commit 201766a20e30f982ccfe36bebfad9602c3ff574a aka v5.3-rc1~65^2~23. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10syscall.2: Update name of syscall instruction for riscvMichael Kerrisk1-1/+1
As reported by Florin: In the first table, for the riscv Arch/ABI, the instruction should be ecall instead of scall. According the official manual, the instruction has been renamed. https://content.riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf "The SCALL and SBREAK instructions have been renamed to ECALL and EBREAK, respectively. Their encoding and functionality are unchanged." Reported-by: Florin Blanaru <florin.blanaru96@gmail.com> Reviewed-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10fanotify_mark.2: Document FAN_MOVE_SELFJakub Wilk1-0/+4
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10fanotify_mark.2: Add kernel version numbers for some FAN_* constantsJakub Wilk1-6/+14
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10fanotify_mark.2: ffixJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-27prctl.2: tfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26socket.2: tfixEric Biggers1-1/+1
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26uname.2: Replace reference to namespaces(7) with reference to uts_namespaces(7)Michael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26getdomainname.2: Add mention of UTS namespacesMichael Kerrisk1-1/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26gethostname.2: Mention UTS namespacesMichael Kerrisk1-3/+5
Reported-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26clone.2: tfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-20statx.2: Clarify details of a case where an invalid 'mask' value may be rejectedMichael Kerrisk1-1/+7
As reported by Simone: I was looking at version from 2017-09-15 but it's the same on: http://man7.org/linux/man-pages/man2/statx.2.html (2019-03-06) There is reported (about the mask argument) after the list of constants: > Note that the kernel does not reject values in mask other > than the above. Instead, it simply informs the caller which > values are sup‐ ported by this kernel and filesystem via the > statx.stx_mask field. But as reported in the error values, there can be EINVAL if mask has a reserved valued, and I found a check against STATX__RESERVED in fs/stat.c for this. So if you use a that bit (0x80000000U) the kernel will reject the value. Probably is better to say that the kernel do not enforce the use of only the listed values, but there are anyway reserved values so and so you cannot put whatever you want on mask (that apply to more values than UINT_MAX). Reported-by: Simone Piccardi <piccardi@truelite.it> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02prctl.2: ffixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02pldd.1, bpf.2, chdir.2, clone.2, fanotify_init.2, fanotify_mark.2, intro.2, ↵Michael Kerrisk24-24/+24
ipc.2, mount.2, mprotect.2, msgctl.2, msgget.2, msgop.2, pivot_root.2, pkey_alloc.2, poll.2, prctl.2, semctl.2, semget.2, semop.2, setxattr.2, shmctl.2, shmget.2, shmop.2, tkill.2, dlopen.3, exec.3, ftok.3, getutent.3, on_exit.3, strcat.3, cpuid.4, proc.5, capabilities.7, cgroup_namespaces.7, credentials.7, fanotify.7, mount_namespaces.7, namespaces.7, sched.7, signal.7, socket.7, unix.7, user_namespaces.7, vdso.7, xattr.7, ld.so.8: tstamp Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01setxattr.2: Place new ERANGE error in correct alphabetical orderMichael Kerrisk1-7/+7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01setxattr.2: Tweaks to Finn O'Leary's textMichael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01setxattr.2: Add ERANGE to 'ERRORS' sectionFinn O'Leary1-0/+7
Hi, Both the Ext2 filesystem handler and the Ext4 filesystem handler will return the ERANGE error code. Ext2 will return it if the name or value is too long to be able to be stored, Ext4 will return it if the name is too long. For reference, the relevant files/lines (with excerpts) are: fs/ext2/xattr.c: lines 394 to 396 in ext2_xattr_set > 394 name_len = strlen(name); > 395 if (name_len > 255 || value_len > sb->s_blocksize) > 396 return -ERANGE; fs/ext4/xattr.c: lines 2317 to 2318 in ext4_xattr_set_handle > 2317 if (strlen(name) > 255) > 2318 return -ERANGE; Other filesystems also return this code: xfs/libxfs/xfs_attr.h: lines 53 to 55 > * The maximum size (into the kernel or returned from the kernel) of an > * attribute value or the buffer used for an attr_list() call. Larger > * sizes will result in an ERANGE return code. It's possible that more filesystem handlers do this, a cursory grep shows that most of the filesystem xattr handler files mention ERANGE in some form. A suggested patch is below (I'm not 100% sure on the wording through). Thanks -- - Finn Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30prctl.2: Correct some details for PR_SET_TIMERSLACKYang Xu1-4/+7
In kernel/sys.c, arg2 is an unsigned long value and it will never less than 0. Also, since kernel commit id da8b44d5a9f8 (Linux 4.6), timer_slack_ns and default timer_slack_ns have been converted into u64, the return value of PR_GET_TIMERSLACK has been limited under ULONG_MAX. The timer slack value also can be inherited by a child created via fork(2). Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30poll.2: Note that poll() equivalent code for ppoll() is not quite equivalentMichael Kerrisk1-1/+18
As reported by Alan Stern: Here are two extracts from the man page for ppoll(2): Specifying a negative value in timeout means an infinite timeout. Other than the difference in the precision of the timeout argument, the following ppoll() call: ready = ppoll(&fds, nfds, tmo_p, &sigmask); is equivalent to atomically executing the following calls: sigset_t origmask; int timeout; timeout = (tmo_p == NULL) ? -1 : (tmo_p->tv_sec * 1000 + tmo_p->tv_nsec / 1000000); pthread_sigmask(SIG_SETMASK, &sigmask, &origmask); ready = poll(&fds, nfds, timeout); pthread_sigmask(SIG_SETMASK, &origmask, NULL); But if tmo_p->tv_sec is negative, the ppoll() call is not equivalent to the corresponding poll() call. The kernel rejects negative values of tv_sec with an EINVAL error; it does not interpret the value as meaning an infinite timeout. (Yes, the kernel interprets tmo_p == NULL as an infinite timeout, but the man page is still wrong for the case tmo_p->tv_sec < 0.) Suggested fix: Following the end of the second extract above, add: except that negative time values in tmo_p are not interpreted as an infinite timeout. Also, in the ERRORS section, change the text for EINVAL to: EINVAL The nfds value exceeds the RLIMIT_NOFILE value or *tmo_p contains an invalid (negative) time value. Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-28mount.2: ERRORS: Add a couple of EINVAL errors for MS_MOVEMichael Kerrisk1-0/+18
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26mount.2: tfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26mount.2: SEE ALSO: add chroot(2) and pivot_root(2)Michael Kerrisk1-0/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26pivot_root.2: 'put_old' can't be a mount point with MS_SHARED propagationMichael Kerrisk1-0/+9
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26pivot_root.2: SEE ALSO: add mount(2)Michael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26pivot_root.2: ERRORS: EINVAL occurs if 'new_root' or its parent has shared ↵Michael Kerrisk1-0/+12
propagation Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26pivot_root.2: 'new_root' must be a mount pointMichael Kerrisk1-4/+9
It appears that 'new_root' may not have needed to be a mount point on ancient kernels, but already in Linux 2.4.5, there was the diff shown below. Verified also by testing. @@ -1631,8 +1605,9 @@ * - we don't move root/cwd if they are not at the root (reason: if something * cared enough to change them, it's probably wrong to force them elsewhere) * - it's okay to pick a root that isn't the root of a file system, e.g. - * /nfs/my_root where /nfs is the mount point. Better avoid creating - * unreachable mount points this way, though. + * /nfs/my_root where /nfs is the mount point. It must be a mountpoint, + * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root + * first. */ asmlinkage long sys_pivot_root(const char *new_root, const char *put_old) @@ -1640,7 +1615,7 @@ struct dentry *root; struct vfsmount *root_mnt; struct vfsmount *tmp; - struct nameidata new_nd, old_nd; + struct nameidata new_nd, old_nd, parent_nd, root_parent; char *name; int error; @@ -1688,6 +1663,10 @@ if (new_nd.mnt == root_mnt || old_nd.mnt == root_mnt) goto out2; /* loop */ error = -EINVAL; + if (root_mnt->mnt_root != root) + goto out2; + if (new_nd.mnt->mnt_root != new_nd.dentry) + goto out2; /* not a mountpoint */ tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */ spin_lock(&dcache_lock); if (tmp != new_nd.mnt) { Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-16getgroups.2: ffixMichael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13execve.2: tfixJakub Wilk1-1/+1
Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13bpf.2: Correct kernel version for JIT support on s390Michael Kerrisk1-3/+3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-08tkill.2: glibc 2.30 provides a wrapper for tgkill()Michael Kerrisk1-2/+12
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25clone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, ↵Michael Kerrisk12-12/+12
semop.2, shmctl.2, shmget.2, shmop.2, ftok.3, proc.5, namespaces.7: Change reference to svipc(7) to sysvipc(7) Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21ptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"Michael Kerrisk1-1/+1
Reported-by: Alexey Izbyshev <izbyshev@ispras.ru> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21execve.2: Some tweaks to Shawn Landden's patchMichael Kerrisk1-6/+12
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21execve.2: Add more detail about ShebangsShawn Landden1-0/+6
Signed-off-by: Shawn Landden <shawn@git.icu> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19execve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather ↵Michael Kerrisk1-2/+7
than 127) Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19execve.2: ffixMichael Kerrisk1-0/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19execve.2: ffix: remove spaces that suggest a space is needed after #!Michael Kerrisk1-2/+2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19execve.2: Linux is not alone in ignoring the set-UID and set-GID bits for ↵Michael Kerrisk1-1/+2
scripts Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-17chdir.2: Add ENOTDIR error for fchdir()Michael Kerrisk1-0/+4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14pkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.Mark Wielaard2-0/+5
To get the pkey_alloc, pkey_free and pkey_mprotect functions _GNU_SOURCE needs to be defined before including sys/mman.h. Reviewed-by: Florian Weimer <fweimer@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0Mark Wielaard1-1/+1
The mprotect.2 NOTES say: On systems that do not support protection keys in hardware, pkey_mprotect() may still be used, but pkey must be set to 0. When called this way, the operation of pkey_mprotect() is equivalent to mprotect(). But this is not what the glibc manual says: It is also possible to call pkey_mprotect with a key value of -1, in which case it will behave in the same way as mprotect. Which is correct. Both the glibc implementation and the kernel check whether pkey is -1. 0 is not a valid pkey when memory protection keys are not supported in hardware. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08fanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: ↵Michael Kerrisk2-3/+3
s/object/filesystem object/ Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08fanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew ↵Michael Kerrisk2-12/+17
Bobrowski's patch Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and ↵Matthew Bobrowski2-4/+128
directory modification events Details relating to the new initialization flag FAN_REPORT_FID has been added. As part of the FAN_REPORT_FID feature, a new set of event masks are available and have been documented accordingly. A simple example program has been added to also support the understanding and use of FAN_REPORT_FID and directory modification events. Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08syscalls.2: tfixPetr Vaněk1-1/+1
Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16prctl.2: tfixMichael Kerrisk1-1/+1
Reported-by: Tomas Skäre <tomas.skare@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-09execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, ↵Michael Kerrisk4-4/+4
posix_memalign.3, stdarg.3, sysconf.3, tsearch.3, elf.5, hostname.7, inode.7: tstamp Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-06intro.1, execve.2, getcontext.3, passwd.5, bpf-helpers.7: wfixJakub Wilk1-1/+1
Use gender-neutral pronouns. Signed-off-by: Jakub Wilk <jwilk@jwilk.net> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05sched_setaffinity.2: Correct details of return value of sched_getaffinity() ↵Michael Kerrisk1-1/+7
syscall Things changed a little with: commit cd3d8031eb4311e516329aee03c79a08333141f1 Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Date: Fri Mar 12 16:15:36 2010 +0900 Reported-by: Brice Goglin <Brice.Goglin@inria.fr> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05execve.2: wfixMichael Kerrisk1-1/+1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05execve.2: Note that stack+environ size is also limited to 3/4 of _STK_LIMMichael Kerrisk1-0/+4
In fs/exec.c::prepare_arg_pages(), we have: limit = _STK_LIM / 4 * 3; limit = min(limit, bprm->rlim_stack.rlim_cur / 4); Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>