Commit Graph

8147 Commits

Author SHA1 Message Date
Michael Kerrisk ac2eb791b3 pivot_root.2: pivot_root() affects only other processes in the same mount 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-23 13:11:18 +02:00
Michael Kerrisk 7cc1a16df6 pivot_root.2: Introduce mount namespaces in the very first sentence
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk fdc558bda9 pivot_root.2: Note capability requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 81b24320d8 pivot_root.2: Mention mount namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk f42778c4e5 pivot_root.2: SEE ALSO: add mount_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 78f662e1c7 pivot_root.2: wfix
"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-23 13:11:18 +02:00
Michael Kerrisk 93dc6336f3 pivot_root.2: Reword some text that is currently rather hard to parse
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 5f5751d37f pivot_root.2: Minor tweak
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 14e47dbe60 pivot_root.2: Minor fix: place some text at a more logical location in the page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk e5f5563cba kill.2: Minor clarification
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 21:34:26 +02:00
Michael Kerrisk a24fc082d0 rt_sigqueueinfo.2: Rename 'uinfo' argument to 'info'
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-19 21:27:44 +02:00
Michael Kerrisk 8637b7a635 rt_sigqueueinfo.2: The rules for 'si_code' don't apply when sending a signal 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-19 21:26:04 +02:00
Michael Kerrisk 1573536578 rt_sigqueueinfo.2: Note that 'si_code' can't be specified as SI_KERNEL
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 20:55:00 +02:00
Michael Kerrisk debedd946c rt_sigqueueinfo.2: Minor restructuring in preparation for next patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 20:51:15 +02:00
Mike Frysinger 5dd76c4449 setns.2: Fix CLONE_NEWNS restriction info
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-19 08:37:45 +02:00
Michael Kerrisk 9914d8bdb8 ptrace.2: Fix description of 'is_error' field in 'struct ptrace_syscall_info'
Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 20:48:34 +02:00
Nikola Forró c4f0c33fb6 mmap.2: Fix EINVAL conditions
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-13 16:26:22 +02:00
Matti Moell 17ea6db2d6 io_submit.2: Fix kernel version numbers for 'aio_rw_flags' flags
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: 2f72816f86 ("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-13 14:57:53 +02:00
Michael Kerrisk 6812112d03 move_pages.2: Some reworking of Yang Xu's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Yang Xu b5874806cb move_pages.2: Mark E2BIG as deprecated
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-13 13:48:18 +02:00
Shawn Anastasio 6e164fba7e syscall.2: Add information for powerpc64
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-13 11:54:11 +02:00
Michael Kerrisk 227a368231 ptrace.2: Clarify meaning of ptrace_syscall_info 'is_error' field
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:50:02 +02:00
Michael Kerrisk 9d8f542d1f ptrace.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:50:02 +02:00
Michael Kerrisk f04534d22c ptrace.2: Describe the PTRACE_GET_SYSCALL_INFO 'op' value in more detail
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:56 +02:00
Michael Kerrisk 93c37f08be ptrace.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:56 +02:00
Michael Kerrisk 1c0955b15a ptrace.2: Minor tweaks to Dmitry Levin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:51 +02:00
Dmitry V. Levin a60e8f1bb3 ptrace.2: Document struct ptrace_syscall_info
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 08:48:26 +02:00
Christopher M. Riedl 5f0922e7a0 mprotect.2: wfix
Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-11 15:00:19 +02:00
Michael Kerrisk 7fd5cf65c4 syscalls.2: Add clone3() and pidfd_open()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 13:43:56 +02:00
Michael Kerrisk 519f86ca43 syscalls.2: Add fsconfig(), fsmount(), fsopen(), fspick(), move_mount(), open_tree()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 13:43:56 +02:00
Michael Kerrisk 6d2c81ea36 syscalls.2: Add new syscalls in 5.1
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-10 13:33:08 +02:00
Michael Kerrisk c3543fab53 ptrace.2: Minor tweaks to Dmitry Levin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:49:01 +02:00
Dmitry V. Levin fc91449cb5 ptrace.2: Document PTRACE_GET_SYSCALL_INFO
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-10 12:45:14 +02:00
Michael Kerrisk fec82988e7 syscall.2: Update name of syscall instruction for riscv
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-10 12:45:14 +02:00
Jakub Wilk b5e1b804f9 fanotify_mark.2: Document FAN_MOVE_SELF
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk 10fa1da2a3 fanotify_mark.2: Add kernel version numbers for some FAN_* constants
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk bbd7edea6e fanotify_mark.2: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Michael Kerrisk b6088873ae prctl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-27 13:56:13 +02:00
Eric Biggers ff085a5e44 socket.2: tfix
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk d837569d1e uname.2: Replace reference to namespaces(7) with reference to uts_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 16ea6936c7 getdomainname.2: Add mention of UTS namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 79ea68831f gethostname.2: Mention UTS namespaces
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk ed4f87f0c8 clone.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 21:54:16 +02:00
Michael Kerrisk c031ffcc56 statx.2: Clarify details of a case where an invalid 'mask' value may be rejected
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-20 09:29:49 +02:00
Michael Kerrisk 0b9a799587 prctl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 08:35:43 +02:00
Michael Kerrisk 63121bd499 pldd.1, bpf.2, chdir.2, clone.2, fanotify_init.2, fanotify_mark.2, intro.2, 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-02 08:34:32 +02:00
Michael Kerrisk 8d7dde9f9c setxattr.2: Place new ERANGE error in correct alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01 19:33:38 +02:00
Michael Kerrisk cada754ad1 setxattr.2: Tweaks to Finn O'Leary's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01 19:33:38 +02:00
Finn O'Leary acea950099 setxattr.2: Add ERANGE to 'ERRORS' section
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-08-01 19:33:38 +02:00
Yang Xu c14f79303f prctl.2: Correct some details for PR_SET_TIMERSLACK
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-30 08:25:37 +02:00
Michael Kerrisk 0bdda5d08e poll.2: Note that poll() equivalent code for ppoll() is not quite equivalent
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-30 08:25:27 +02:00
Michael Kerrisk 6f4a00d62f mount.2: ERRORS: Add a couple of EINVAL errors for MS_MOVE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-28 09:17:06 +02:00
Michael Kerrisk 0610c6f1f8 mount.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:28:08 +02:00
Michael Kerrisk a68bb0b38d mount.2: SEE ALSO: add chroot(2) and pivot_root(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:27:18 +02:00
Michael Kerrisk a39e880f67 pivot_root.2: 'put_old' can't be a mount point with MS_SHARED propagation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:22:59 +02:00
Michael Kerrisk 34a0f19c76 pivot_root.2: SEE ALSO: add mount(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 17:10:58 +02:00
Michael Kerrisk 1a0b1fd76b pivot_root.2: ERRORS: EINVAL occurs if 'new_root' or its parent has shared propagation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 17:10:06 +02:00
Michael Kerrisk 37704bfc8f pivot_root.2: 'new_root' must be a mount point
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-26 16:54:16 +02:00
Michael Kerrisk 4d4708bfd2 getgroups.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-16 13:50:05 +02:00
Jakub Wilk ed386413f8 execve.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 10:15:48 -06:00
Michael Kerrisk 069be4fd22 bpf.2: Correct kernel version for JIT support on s390
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 18:05:50 +02:00
Michael Kerrisk 4c63ee20b0 tkill.2: glibc 2.30 provides a wrapper for tgkill()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-08 12:23:55 +02:00
Michael Kerrisk 343cdc5ac9 clone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, 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-25 06:38:01 +02:00
Michael Kerrisk 173eb06cd8 ptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"
Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:04:58 +02:00
Michael Kerrisk 63059c4b52 execve.2: Some tweaks to Shawn Landden's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:38 +02:00
Shawn Landden 60f16bf2fe execve.2: Add more detail about Shebangs
Signed-off-by: Shawn Landden <shawn@git.icu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:37 +02:00
Michael Kerrisk 44dceef0cd execve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127)
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 21:06:11 +02:00
Michael Kerrisk 815d0561d0 execve.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:47:10 +02:00
Michael Kerrisk 8fa1a0223e execve.2: ffix: remove spaces that suggest a space is needed after #!
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:45:00 +02:00
Michael Kerrisk fc894c8f55 execve.2: Linux is not alone in ignoring the set-UID and set-GID bits for scripts
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:42:10 +02:00
Michael Kerrisk 283db6f607 chdir.2: Add ENOTDIR error for fchdir()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-17 20:36:37 +02:00
Mark Wielaard f92ea96bab pkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.
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-14 17:09:00 +02:00
Mark Wielaard a4a0b74234 mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0
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-14 17:06:50 +02:00
Michael Kerrisk eae836e071 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: s/object/filesystem object/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Michael Kerrisk 817c8240f3 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew Bobrowski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Matthew Bobrowski 0a4db6dc74 fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and 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-08 08:37:54 +02:00
Petr Vaněk 59a4d9b398 syscalls.2: tfix
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:22:36 +02:00
Michael Kerrisk cb7c96bfdd prctl.2: tfix
Reported-by: Tomas Skäre <tomas.skare@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16 12:22:32 -05:00
Michael Kerrisk 2e3023c413 execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, 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-09 09:43:09 +02:00
Jakub Wilk 60ae21db4c intro.1, execve.2, getcontext.3, passwd.5, bpf-helpers.7: wfix
Use gender-neutral pronouns.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-06 14:49:18 -05:00
Michael Kerrisk 14a848f0f1 sched_setaffinity.2: Correct details of return value of sched_getaffinity() 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-05 13:02:30 -05:00
Michael Kerrisk 3a66e3293d execve.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05 07:36:37 -05:00
Michael Kerrisk 4a696f5ebd execve.2: Note that stack+environ size is also limited to 3/4 of _STK_LIM
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>
2019-05-05 07:34:13 -05:00
Michael Kerrisk c7dc46d0a2 close.2: srcfix (comment on EINTR error)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05 06:14:45 -05:00
Slavomir Kaslev 5ca397fa3e tee.2: EAGAIN can occur when called on nonblocking file descriptors
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05 05:28:17 -05:00
Slavomir Kaslev 4b5e751062 splice.2: EAGAIN can occur when called on nonblocking file descriptors
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-05 05:27:55 -05:00
Michael Kerrisk 4727b7b062 setfsuid.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-04-25 16:06:50 -05:00
Michael Kerrisk 6ab62ed869 clone.2: CLONE_CHILD_SETTID has effect before clone() returns *in the child*
CLONE_CHILD_SETTID may not have had effect by the time clone()
returns in the parent, which could bre relevant if the
CLONE_VM flag is employed. The relevant kernel code is in
schedule_tail(), which is called in ret_from_fork()
in the child.

See https://bugzilla.kernel.org/show_bug.cgi?id=203105

Demonstration using the program shown below (inspired by a simpler
example from Jakub):

$ ./a.out
parent start: ctid =     0    ptid =  6212
child start:  ctid =  6212    ptid =  6212
child later:  ctid =  6212    ptid =  6212
cat parent later: ctid =  6212    ptid =  6212
f.child -- bye

$ cat prog.c

static volatile pid_t ctid, ptid;

static int
child_fn(void *arg)
{
    printf("child start:  ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(1);
    printf("child later:  ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(2);
    printf("child -- bye\n");
    return 0;
}

int
main(void)
{
    void *stack = malloc(0x1000);
    char *stack_top = (char *) stack + 0x1000;
    int flags =  SIGCHLD | CLONE_VM |
                 // CLONE_VFORK |
                 CLONE_PARENT_SETTID | CLONE_CHILD_SETTID;

    if (clone(child_fn, stack_top, flags, NULL, &ptid, NULL, &ctid) == -1) {
        perror("clone");
        exit(EXIT_SUCCESS);
    }

    fprintf(stderr, "parent start: ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(2);
    fprintf(stderr, "parent later: ctid = %5d    ptid = %5d\n", ctid, ptid);

    if (wait(NULL) == -1) {
        perror("wait");
        exit(EXIT_FAILURE);
    }

    exit(EXIT_SUCCESS);
}

Reported-by: Jakub Nowak <jakub.jakub.nowak@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-04-15 14:17:39 +02:00
Lucas Werkmeister 001c282788 io_getevents.2: wsfix: fix stray tab
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-04-14 19:12:34 +02:00
Michael Kerrisk 5ea5bb212b syscalls.2: Remove crufty text about i386 syscall dispatch table
The removed text long ago ceased to be accurate. Nowadays, the
dispatch table is autogenerated when building the kernel (via
the kernel makefile, arch/x86/entry/syscalls/Makefile).

Reported-by: Andreas Korb <andreas.d.korb@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-04-12 10:56:59 +02:00
Michael Kerrisk 2ef9216b22 bpf.2: Update kernel version info for JIT compiler
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-04-04 11:53:38 +02:00
Michael Kerrisk d478d0defe setfsgid.2: Rewrite for improved clarity and defer to setfsuid() for details
Rewrite for improved clarity and defer to setfsuid(2) for the
rationale of the fsGID rather than repeating the same details
in this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-26 06:11:58 +01:00
Michael Kerrisk 5d3b92e534 setfsuid.2: Rewrite for improved clarity and to hint history more explicitly
The current text reads somewhat clumsily. Rewrite it to introduce
the eUID and fsUID in parallel, and more clearly hint at the the
historical rationale for the fsUID, which is detailed lower in
the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-26 05:58:54 +01:00
Abhinav Upadhyay 96ed2f3ff4 bpf.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-20 08:57:56 +01:00
Michael Kerrisk 03349e33f9 accept.2: Note that 'addrlen' is left unchanged in the event of an error
See http://austingroupbugs.net/view.php?id=836.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-18 17:30:23 +01:00
Michael Kerrisk 1a29a70ded pipe.2: Note that 'pipefd' is left unchanged in the event of an error
See http://austingroupbugs.net/view.php?id=467.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-18 17:30:23 +01:00
Michael Kerrisk 1548a03a6b socketpair.2: Clarify that 'sv' is left unchanged in the event of an error
See also http://austingroupbugs.net/view.php?id=483.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-18 17:30:23 +01:00
Michael Kerrisk f77c624f27 execve.2: SEE ALSO: refer to exec(3) (rather than execl(3))
Reported-by: Dr. Jürgen Sauermann <mail@xn--jrgen-sauermann-zvb.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-08 17:56:13 +01:00
Michael Kerrisk 3f5755f6ef execve.2, exec.3: Consistently use the term 'pathname' (not 'path')
Reported-by: Dr. Jürgen Sauermann <mail@xn--jrgen-sauermann-zvb.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-08 17:52:17 +01:00
Michael Kerrisk c49cdd1ce0 execve.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-08 17:50:06 +01:00
Jakub Wilk 69b5b8df00 syscalls.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-08 17:40:27 +01:00
Jakub Wilk 71b1370219 sched_setattr.2: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-08 16:26:19 +01:00
Michael Kerrisk 880c3f67ef Removed trailing white space at end of lines 2019-03-06 17:18:15 +01:00
Michael Kerrisk 9ba0180298 getent.1, iconv.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, pldd.1, sprof.1, time.1, _syscall.2, accept.2, add_key.2, adjtimex.2, bind.2, bpf.2, capget.2, chown.2, chroot.2, clock_getres.2, clone.2, connect.2, copy_file_range.2, epoll_ctl.2, epoll_wait.2, eventfd.2, fanotify_init.2, fanotify_mark.2, fcntl.2, fsync.2, futex.2, getcpu.2, getdents.2, getgid.2, getgroups.2, getpid.2, gettid.2, gettimeofday.2, getuid.2, getxattr.2, inotify_add_watch.2, inotify_init.2, ioctl_fat.2, ioctl_ns.2, ioctl_userfaultfd.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, listxattr.2, lseek.2, madvise.2, memfd_create.2, migrate_pages.2, mount.2, mprotect.2, mremap.2, msgctl.2, msgop.2, nfsservctl.2, open_by_handle_at.2, perf_event_open.2, pipe.2, pivot_root.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, readahead.2, readdir.2, readlink.2, reboot.2, recvmmsg.2, removexattr.2, rename.2, request_key.2, s390_guarded_storage.2, s390_runtime_instr.2, s390_sthyi.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, seccomp.2, select.2, select_tut.2, semctl.2, sendmmsg.2, set_thread_area.2, setgid.2, setns.2, setuid.2, setxattr.2, shmctl.2, sigaction.2, signalfd.2, sigsuspend.2, socket.2, socketpair.2, spu_run.2, stat.2, statx.2, subpage_prot.2, syscalls.2, sysctl.2, tee.2, timer_create.2, timerfd_create.2, truncate.2, uname.2, unshare.2, userfaultfd.2, ustat.2, vmsplice.2, write.2, CPU_SET.3, __ppc_get_timebase.3, alloca.3, argz_add.3, asprintf.3, backtrace.3, basename.3, bsd_signal.3, bstring.3, bswap.3, bzero.3, cacos.3, cacosh.3, catan.3, catanh.3, catgets.3, clock_getcpuclockid.3, cmsg.3, confstr.3, ctermid.3, ctime.3, des_crypt.3, dl_iterate_phdr.3, dlinfo.3, dlsym.3, duplocale.3, end.3, endian.3, errno.3, exec.3, exit.3, ferror.3, fgetws.3, fmemopen.3, fnmatch.3, fopencookie.3, fputws.3, frexp.3, ftw.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrouplist.3, getifaddrs.3, getline.3, getlogin.3, getmntent.3, getnameinfo.3, getopt.3, getpass.3, getprotoent_r.3, getpwnam.3, getservent_r.3, getsubopt.3, glob.3, gnu_get_libc_version.3, hsearch.3, if_nameindex.3, index.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isatty.3, iswblank.3, iswspace.3, lockf.3, makecontext.3, mallinfo.3, malloc.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbrtowc.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memchr.3, mq_getattr.3, mq_notify.3, newlocale.3, nl_langinfo.3, offsetof.3, perror.3, posix_spawn.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_mutexattr_setrobust.3, pthread_rwlockattr_setkind_np.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, putenv.3, qsort.3, rand.3, random.3, readdir.3, regex.3, resolver.3, rpmatch.3, rtime.3, scanf.3, sem_wait.3, setaliasent.3, setbuf.3, stpcpy.3, stpncpy.3, strcat.3, strchr.3, strcmp.3, strcpy.3, strdup.3, strerror.3, strfromd.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strsep.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, system.3, termios.3, trunc.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscat.3, wcscpy.3, wcslen.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wcsstr.3, wcstok.3, wcstombs.3, wcwidth.3, wprintf.3, xcrypt.3, console_codes.4, dsp56k.4, full.4, initrd.4, lirc.4, loop.4, st.4, tty.4, vcs.4, charmap.5, core.5, host.conf.5, locale.5, proc.5, repertoiremap.5, resolv.conf.5, termcap.5, tmpfs.5, tzfile.5, aio.7, capabilities.7, cgroup_namespaces.7, cgroups.7, charsets.7, complex.7, epoll.7, fanotify.7, feature_test_macros.7, inotify.7, ip.7, locale.7, man-pages.7, man.7, namespaces.7, pid_namespaces.7, pkeys.7, pthreads.7, rtld-audit.7, sched.7, signal.7, sock_diag.7, socket.7, tcp.7, udp.7, unicode.7, user_namespaces.7, utf-8.7, zdump.8, zic.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:10 +01:00
Michael Kerrisk a5e76996e2 sched_setattr.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:10 +01:00
Michael Kerrisk 5fa62195f5 sched_setattr.2: Note that SCHED_FLAG_DL_OVERRUN SIGXCPU signal is process-directed
And further note that this is probably a bug.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:10 +01:00
Michael Kerrisk c3eba6648e sched_setattr.2: wfix
Reported-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:10 +01:00
Michael Kerrisk 111f1b5e91 sched_setattr.2: wfix: s/task/thread/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:10 +01:00
Michael Kerrisk 927b72f45e sched_setattr.2: Remove mention of GRUB for bandwidth reclaim
Mention of a specific algorithm is probably too much detail for
the manual page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:12:04 +01:00
Michael Kerrisk b8bd34ac06 sched_setattr.2: Add a bit more detail for SCHED_DEADLINE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:02:00 +01:00
Michael Kerrisk c7456cdd92 sched_setattr.2: Minor tweaks to Claudio Scordino's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:02:00 +01:00
Claudio Scordino 87b4fd4b0c sched_setattr.2: Document SCHED_FLAG_DL_OVERRUN and SCHED_FLAG_RECLAIM
This patch documents two additional flags recently introduced
for the attr.sched_flags field of sched_setattr().

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-03-06 15:02:00 +01:00
Michael Kerrisk 0c479e1954 mmap.2: Bump timestamp for William Kucharski's review of "Fix description of treatment of the hint"
Reviewed-by: William Kucharski <william.kucharski@oracle.com>

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 15:38:35 +01:00
Michael Kerrisk 6474f351fd fanotify_mark.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 15:32:50 +01:00
Michael Kerrisk d1a719857b locale.1, memusage.1, pldd.1, _syscall.2, add_key.2, bind.2, bpf.2, chown.2, clone.2, copy_file_range.2, eventfd.2, execve.2, futex.2, getdents.2, getrlimit.2, ioctl_fat.2, ioctl_ns.2, kcmp.2, kexec_load.2, keyctl.2, listxattr.2, lseek.2, membarrier.2, memfd_create.2, mmap.2, mprotect.2, msgop.2, open_by_handle_at.2, perf_event_open.2, pipe.2, readdir.2, readlink.2, readv.2, recvmmsg.2, request_key.2, sched_setaffinity.2, seccomp.2, select.2, select_tut.2, sendmmsg.2, setns.2, signalfd.2, spu_run.2, stat.2, sysctl.2, tee.2, timer_create.2, timerfd_create.2, truncate.2, uname.2, unshare.2, userfaultfd.2, ustat.2, wait.2, CPU_SET.3, __ppc_get_timebase.3, argz_add.3, asprintf.3, backtrace.3, basename.3, bswap.3, bzero.3, cacos.3, cacosh.3, catan.3, catanh.3, catgets.3, clock_getcpuclockid.3, confstr.3, ctime.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, end.3, endian.3, fgetws.3, fmemopen.3, fopencookie.3, fputws.3, frexp.3, ftw.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrouplist.3, getifaddrs.3, getline.3, getlogin.3, getopt.3, getpass.3, getprotoent_r.3, getpwnam.3, getservent_r.3, getsubopt.3, glob.3, gnu_get_libc_version.3, hsearch.3, if_nameindex.3, index.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, iswblank.3, iswspace.3, makecontext.3, mallinfo.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbrtowc.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memchr.3, mq_getattr.3, mq_notify.3, newlocale.3, nl_langinfo.3, offsetof.3, perror.3, posix_spawn.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_mutexattr_setrobust.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, qsort.3, rand.3, readdir.3, regex.3, rpmatch.3, rtime.3, scanf.3, sem_wait.3, setaliasent.3, setbuf.3, stpcpy.3, stpncpy.3, strcat.3, strchr.3, strcpy.3, strdup.3, strerror.3, strfromd.3, strftime.3, strlen.3, strnlen.3, strsep.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, termios.3, tsearch.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscat.3, wcscpy.3, wcslen.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wcsstr.3, wcstok.3, wcstombs.3, wcwidth.3, wprintf.3, console_codes.4, dsp56k.4, full.4, initrd.4, loop.4, vcs.4, charmap.5, core.5, elf.5, locale.5, proc.5, repertoiremap.5, sysfs.5, termcap.5, aio.7, bpf-helpers.7, cgroups.7, charsets.7, complex.7, fanotify.7, feature_test_macros.7, inotify.7, locale.7, man-pages.7, man.7, pkeys.7, pthreads.7, rtld-audit.7, sock_diag.7, unix.7, user_namespaces.7, utf-8.7: Use '\e' rather than '\\' to get a backslash
Quoting Branden:

*roff escape sequences may sometimes look like C escapes, but that
is misleading.  *roff is in part a macro language and that means
recursive expansion to arbitrary depths.

You can get away with "\\" in a context where no macro expansion
is taking place, but try to spell a literal backslash this way in
the argument to a macro and you will likely be unhappy with
results.

Try viewing the attached file with "man -l".

"\e" is the preferred and portable way to get a portable "escape
literal" going back to CSTR #54, the original Bell Labs troff
paper.

groff(7) discusses the issue:

  \\     reduces to a single backslash; useful to delay its
         interpretation as escape character in copy mode.  For a
         printable backslash, use \e, or even better \[rs], to be
         independent from the current escape character.

As of groff 1.22.4, groff_man(7) does as well:

  \e     Widely used in man pages to represent a backslash output
         glyph.  It works reliably as long as the .ec request is
         not used, which should never happen in man pages, and it
         is slightly more portable than the more exact ‘\(rs’
         (“reverse solidus”) escape sequence.

People not concerned with portability to extremely old troffs should
probably just use \(rs (or \[rs]), as it means "the backslash
glyph", not "the glyph corresponding to whatever the current escape
character is".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 15:32:50 +01:00
Michael Kerrisk 8fb01fdeac adjtimex.2, futex.2, mremap.2, seccomp.2, getnameinfo.3, random.3, console_codes.4, sysfs.5, sched.7, unicode.7: Use zero‐width space in appropriate locations
Quoting Branden:

    *roff systems will interpret the period in the unpatched
    page as sentence-ending punctuation and put inter-sentence
    spacing after it.  (This might not be visible on
    nroff/terminal devices, but it is more likely to be on
    typesetter/PostScript/PDF output).

    groff_man(7) in groff 1.22.4 attempts to throw man page
    writers a bone here:

     \&     Zero‐width space.  Append to an input line to prevent
            an end‐of‐ sentence punctuation sequence from being
            recognized as such, or insert at the beginning of an
            input line to prevent a dot or apostrophe from being
            interpreted as the beginning of a roff request.

Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 15:32:41 +01:00
Michael Kerrisk e79c051d18 kexec_load.2: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 11:17:01 +01:00
Michael Kerrisk d8012462d7 fallocate.2, futex.2, getrandom.2, mprotect.2, posix_spawn.3, address_families.7, ipv6.7, sock_diag.7, socket.7: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:31:55 +01:00
Michael Kerrisk 91e377715b set_thread_area.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:29:42 +01:00
Michael Kerrisk b3a696eb94 pkey_alloc.2: srcfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:22:06 +01:00
Michael Kerrisk 7d281e0ab3 perf_event_open.2: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:20:14 +01:00
Michael Kerrisk f711139679 epoll_ctl.2, ioctl_userfaultfd.2, keyctl.2, ptrace.2, socket.7: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:06:04 +01:00
Michael Kerrisk b30b425ba1 fallocate.2, getgid.2, getpid.2, getuid.2, lseek.2, set_thread_area.2, tzset.3: srcfix: fix some unconventional markup
No (intended) changes to generated output

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:03:58 +01:00
Michael Kerrisk 6614e29264 keyctl.2, mlock.2, timerfd_create.2, write.2, nl_langinfo.3, posix_spawn.3: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 10:00:28 +01:00
Michael Kerrisk 2bb165ec65 ptrace.2: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 09:49:38 +01:00
Bjarni Ingi Gislason 266791fbe0 man2/bpf.2: srcfix: Some fixes that only change fonts
1) Use single-font macros for a single argument.

2) Use quotation marks for arguments containing a space.

3) Use roman font for punctuation marks.

  The output has only changes of the font for a punctuation mark.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 09:21:36 +01:00
Michael Kerrisk b20da8c78a stat.2: tfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-27 08:20:46 +01:00
Michael Kerrisk f7246c6de3 msgctl.2, semctl.2, shmctl.2: Add kernel version for *_STAT_ANY operation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 21:03:53 +01:00
Michael Kerrisk 906e981b47 seccomp.2: (Briefly) document SECCOMP_FILTER_FLAG_SPEC_ALLOW
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 21:01:32 +01:00
Michael Kerrisk ce61c76fba fanotify_init.2: Add a little more detail on FAN_REPORT_TID
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Michael Kerrisk d43a1d3e75 fanotify_init.2: Minor tweaks to Amir Goldstein's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
nixiaoming ebfb6feee6 fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
fanotify_init.2: add new flag FAN_REPORT_TID
fanotify.7: update description of member pid in
    struct fanotify_event_metadata

Signed-off-by: nixiaoming <nixiaoming@huawei.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Michael Kerrisk 953d1e0792 fanotify_mark.2, fanotify.7: Minor tweaks to Amir Goldstein's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Amir Goldstein b2f8214d47 fanotify_mark.2, fanotify.7: Document FAN_MARK_FILESYSTEM
Monitor fanotify events on the entire filesystem.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Michael Kerrisk fd1eb8a782 fanotify_mark.2, fanotify.7: Minor tweaks to Matthew Bobrowski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Matthew Bobrowski fc37d2f1c8 fanotify_mark.2, fanotify.7: Document FAN_OPEN_EXEC and FAN_OPEN_EXEC_PERM
New event masks have been added to the fanotify API. Documentation to
support the use and behaviour of these new masks has been added
accordingly.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Michael Kerrisk 6f2028776a inotify_add_watch.2: Minor fixes to Henry Wilson's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Henry Wilson 4e821a8a65 inotify_add_watch.2: Note errors that can occur for IN_MASK_CREATE
Note EEXIST error that occurs when requesting a watch on a path
which is already watched with IN_MASK_CREATE.

Note EINVAL error also occurs when requesting a watch specifying
both IN_MASK_CREATE and IN_MASK_ADD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 17:39:00 +01:00
Michael Kerrisk 53cbdde870 nfsservctl.2: Add VERSIONS section noting that this system call no longer exists
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 10:14:33 +01:00
Michael Kerrisk b9a23a3e77 ustat.2: Starting with version 2.28, glibc no longer provides a wrapper function
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-26 10:12:18 +01:00
Michael Kerrisk d8be53ac0d getcpu.2: Note version where glibc wrapper was added
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 16:42:56 +01:00
Tobias Klauser 04e590e6a5 getcpu.2: getcpu() now has a glibc wrapper; remove mention of syscall(2)
The glibc wrapper was added in glibc 2.29, release on 1 Feb 2019.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 16:40:59 +01:00
Oded Elisha 527bd1d7ae bpf.2: Fix bug in example
mtk: checked also against examples in samples/bpf
in kernel source to confirm.

Signed-off-by: Oded Elisha <oded123456@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 16:35:49 +01:00
Michael Kerrisk 1f4b844646 fsync.2: fix
Reported-by: ruschein <ruschein@protonmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 16:05:40 +01:00
Michael Kerrisk 3a1ba1bb21 sched_setaffinity.2: tfix in example shell session (s/grep/egrep)
Reported-by: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 16:01:28 +01:00
Jann Horn f58e9ed092 mmap.2: Fix description of treatment of the hint
The current manpage reads to me as if the kernel will always pick
a free space close to the requested address, but that's not the
case:

mmap(0x600000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x600000000000
mmap(0x600000000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0x7f5042859000

You can also see this in the various implementations of
->get_unmapped_area() - if the specified address isn't available,
the kernel basically ignores the hint (apart from the 5level
paging hack).

Clarify how this works a bit.

Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 15:56:54 +01:00
Benjamin Peterson c4b7b812d3 stat.2: SEE ALSO: add statx(2)
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 15:47:25 +01:00
Jakub Wilk 78e8660dc1 mlock.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 15:43:09 +01:00
Eugene Syromyatnikov ff5fa0ace3 getrlimit.2: Correct information about large limits on 32-bit architectures
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 15:08:51 +01:00
Michael Kerrisk a5819baa01 syscalls.2: Comment out details of a few system calls that only ever briefly existed
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 14:22:12 +01:00
Michael Kerrisk d0a395a234 syscalls.2: Various edits of Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 14:20:54 +01:00
Eugene Syromyatnikov e07c81fef8 syscalls.2: Update syscall table
Added: arc_gettls, arc_settls, arc_usr_cmpxchg, arch_prctl,
atomic_barrier, atomic_cmpxchg_32, bfin_spinlock, breakpoint,
clone2, cmpxchg, cmpxchg_badaddr, dma_memcpy, execv, get_tls,
getdomainname, getdtablesize, gethostname, getxgid, getxpid,
getxuid, metag_get_tls, metag_set_fpu_flags,metag_set_tls,
metag_set_global_bit, newfstatat, old_adjtimex, oldumount,
or1k_atomic, pread, pwrite, riscv_flush_icache,
sched_get_affinity, sched_set_affinity, set_tls, setaltroot,
sethae, setpgrp, spill, sram_alloc, sram_free, swapcontext,
switch_endian, sys_debug_setcontext, syscall, sysmips, timerfd,
usr26, usr32, xtensa.

Uncommented: memory_ordering

Renamed: ppc_rtas to rtas (__NR_rtas), ppc_swapcontext to
swapcontext (__NR_swacontext).

Typo: s/remaed/renamed to/

Other: s/ia64/IA-64/, s/Sparc/SPARC/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 13:27:14 +01:00
Nikola Forró 92a76772c6 socket.2: Remove notes concerning AF_ALG and AF_XDP
All address families are now documented in address_families.7,
which is already present in SEE ALSO section. Also, the AF_ALG
note contains dead link to kernel HTML documentation.

Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 12:01:23 +01:00
Eugene Syromyatnikov 49c3b22619 socket.2: Reinstate AF_VSOCK mention
It has its own man page, so it probably makes sense to mention
it here.

* man2/socket.2 (.SH DESCRIPTION): Add mention of AF_VSOCK back.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 11:11:33 +01:00
Eugene Syromyatnikov ec5fc56cbb socket.2: tfix
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 11:09:09 +01:00
Eugene Syromyatnikov 22570de1e1 socket.2, address_families.7: Mention that address family names are Linux-specific
* man2/socket.2 (.SH DESCRIPTION): Mention that the list of
  address families is Linux-specific.
* man7/address_families.7 (.SH DESCRIPTION): Likewise.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 11:07:52 +01:00
Michael Kerrisk 7ef57ea1a0 sigaction.2: Minot tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 11:05:50 +01:00
Eugene Syromyatnikov e1836e9d9e sigaction.2: Describe obsolete usage of struct sigcontext as signal handler argument
* man2/sigaction.2 (.SS Undocumented): Provide information about
  relation between the second argument of sa_handler and
  uc_mcontext field of the struct ucontext structure.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 10:53:22 +01:00
Michael Kerrisk e4092d5e51 fcntl.2: Briefly explain the meaning of the 'l_sysid' field in 'struct flock'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 10:50:46 +01:00
Eugene Syromyatnikov 27ede97d14 fcntl.2: Mention that l_sysid is not used even if present
Some architectures do provide an 'l_sysid' declaration in
struct flock; however, it is not used anyway.

* man2/fcntl.2 (.SH NOTES): Note that l_sysid field is not used on
Linux even if present on some architectures.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 10:49:32 +01:00
Michael Kerrisk c3a208e9d9 capget.2: Remove first paragraph, which repeats details from capabilities(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-25 10:48:57 +01:00
Michael Kerrisk 241771957c capget.2: Relocate a misplaced sentence
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-23 22:03:20 +01:00
Michael Kerrisk ed474f00fe gettid.2: Glibc provides a wrapper since version 2.30
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-23 22:03:20 +01:00
Michael Kerrisk 563bf760bf setns.2: When joining a user namespace, it must be a descendant user namespace
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-23 22:03:20 +01:00
Michael Kerrisk 962f9d0969 capget.2: Remove crufty sentence suggesting use of deprecated functions
Remove crufty sentence suggesting use of deprecated capsetp(3) and
capgetp(3); the manual page for those functions has long (at least
as far back as 2007) noted that they are deprecated.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-23 21:58:23 +01:00
Michael Kerrisk 3cc069d5d8 setfsgid.2, setfsuid.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-02-16 07:52:30 +01:00
Ignat Loskutov 4f53f6aca8 fsync.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-25 09:00:38 +13:00
Michael Kerrisk dcd7215c2a io_submit.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-25 08:59:54 +13:00
Jeff Moyer 19dc28eb9d io_submit.2: Fix the description of aio_data
aio_data is not a kernel-internal field.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-25 08:59:19 +13:00
Lucas Werkmeister a25c60362b close.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-16 05:39:14 +13:00
Michael Kerrisk 352c4c5ca6 open.2: Minor fixes to Eugene's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:42:35 +13:00
Eugene Syromiatnikov 6deb3733ac open.2: Mention presence of unused O_RSYNC definition
O_RSYNC is defined in <asm/fcntl.h> on HP PA-RISC, but is not
used anyway.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:35:10 +13:00
Michael Kerrisk d40e0bfc27 open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:34:38 +13:00
Michael Kerrisk 319e9b31ed open.2: Minor fixes to Eugene's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:32:39 +13:00
Eugene Syromiatnikov 8132c11589 open.2: Document FASYNC usage in Linux UAPI headers
Linux's <asm/fcntl.h> defines FASYNC instead of O_ASYNC; document
this peculiarity.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:30:47 +13:00
Michael Kerrisk ecb110e846 rename.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:25:18 +13:00
Eugene Syromiatnikov 5fc33f3827 rename.2: Some additional notes regarding RENAME_WHITEOUT
Add a note regarding other implementations of whiteout inodes
and update filesystem support information.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:24:50 +13:00
Michael Kerrisk b0f5ce2757 getgid.2, getpid.2, getuid.2, pipe.2: Remove mention of other syscalls that use second retval register
This information is already summarized in syscall(2), so there's
no need to repeat it in each page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:21:17 +13:00
Michael Kerrisk 127f815c99 syscall.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:18:39 +13:00
Michael Kerrisk 17eb18e79a syscall.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:18:39 +13:00
Michael Kerrisk 0e80287f28 syscall.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:18:39 +13:00
Michael Kerrisk 7548a84a6c syscall.2: Rework table to render within 80 columns
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:18:39 +13:00
Michael Kerrisk 03936fb4ce getgid.2, getpid.2, getuid.2, pipe.2, syscall.2: Minor tweaks to Eugene's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 06:18:39 +13:00
Eugene Syromiatnikov 70ea1968cc getgid.2, getpid.2, getuid.2, pipe.2, syscall.2: Describe 2nd return value peculiarity
Some architectures (ab)use second return value register for additional
return value in some system calls. Let's describe this.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-10 05:46:35 +13:00
Eugene Syromiatnikov f3f3ab82ee syscall.2: ffix
Add missing .RE.

Fixes: 2ad7b4c46c ("syscall.2: Elaborate x32 ABI specifics")
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-01-09 16:58:31 +13:00
Michael Kerrisk 43e3c5518b select.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-23 19:09:33 +01:00
Michael Kerrisk 3d335319e7 write.2: RETURN VALUE: clarify details of partial write and
As reported by Nadav Har'El in
https://bugzilla.kernel.org/show_bug.cgi?id=197961

    The write(2) manual page has this paragraph:

    "On  success,  the  number  of bytes written is returned
    (zero indicates nothing was written).  It is not an error
    if  this  number  is  smaller than the number of bytes
    requested; this may happen for example because the disk
    device was filled.  See also NOTES."

    I find a few problems with this paragraph:

    1. It's not clear what "See also NOTES." refers to (does it
       refer to anything?). What in the NOTES is relevant here?

    2. The paragraph seems to suggest that write(2) of a
       non-empty buffer may sometimes return even 0 in case of an
       error like the device being filled. I think this is wrong
       - if there was an error after already writing some number
       of bytes, this non-zero number is returned. But if there's
       an error before writing any bytes, -1 will be returned
       (and the error reason in errno) - 0 will not be returned
       unless the given count is 0 (that case is explained in the
       following paragraph).

    3. The paragraph doesn't explain what a user should do
       after a short write (i.e., write(2) returning less than
       count). How would the user know why there was an error, or
       if there even was one? I think users should be told what
       to do next because this information is part of how to use
       this API correctly. I think users should be told to retry
       the rest of the write (i.e., write(fd, buf+ret, count-ret)
       and this will either succeed in writing some more data if
       the error reason was solved, or the second write will
       return -1 and the error reason in errno.

Reported-by: Nadav Har'El <nyh@math.technion.ac.il>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-23 19:09:33 +01:00
Michael Kerrisk acac1139a6 getxattr.2, removexattr.2, setxattr.2: ERRORS: replace ENOATTR with ENODATA
ENOATTR is not a standard error code, but rather one that is
defined in 'libattr' as a synonym for ENODATA. The manual pages
should use the error code actually returned by the kernel APIs.

See also https://bugzilla.kernel.org/show_bug.cgi?id=201995

Reported-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Reviewed-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-23 19:09:18 +01:00
Michael Kerrisk d70a2e571d mount.2: wfix (clarify effect of unbindable propagation type)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-14 11:35:40 +01:00
snyh 2e75672790 syscall.2: Fix wrong retval register number in alpha architecture
alpha use v0 e.g. $0 as the return value register both in
syscall ABI and C ABI.

see also
https://github.com/torvalds/linux/blob/master/arch/alpha/kernel/entry.S#L479

The normal Alpha C ABI use a0~a5 to pass arguments and use v0 as
the return value register. See here
https://www2.cs.arizona.edu/projects/alto/Doc/local/alpha.register.html

The syscall ABI use v0 as the trap number, a0~a5 to pass arguments
and use a3 as a indicator (bool type) whether has a error occurred.

We can also see the libc's syscall wrapper implements at
https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/alpha/syscall.S.html
The v0 is the normal used as return register, and we can see the
return processing doesn't do anything about a0 which is the wrong
register of currently syscall(2) description.

p.s. I found this wrong description because I'm porting Go gc to
a new CPU architecture which is similar to Alpha, And I use the
wrong register at first, then I have inspect the kernel code and
objdump to ensure the right syscall ABI.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-08 14:44:15 +01:00
Vince Weaver 34211ee3f2 perf_event_open.2: Fix wording in multiplexing description
Back in 2014 (37bee118ad) the text
describing when multiplexing happens was changed in a confusing way.
This is an attempt to clarify things a bit.

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-03 22:10:30 +01:00
Michael Kerrisk 07ca8b34a0 madvise.2: Minor tweaks to Michal Hocko's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-01 09:53:19 +01:00
Michal Hocko 9bbc50e6e0 madvise.2: MADV_FREE clarify swapless behavior
Since 93e06c7a6453 ("mm: enable MADV_FREE for swapless system") we
handle MADV_FREE on a swapless system the same way as with the
swap available. Clarify that fact in the man page.

Reported-by: Niklas Hambüchen <mail@nh2.me>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-01 09:48:46 +01:00
Michael Kerrisk 7f11e32c39 accept.2, copy_file_range.2, eventfd.2, inotify_init.2, pipe.2, readahead.2, signalfd.2, socket.2, timerfd_create.2: Clarify the distinction between "file descriptor" and "file description"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-01 09:42:01 +01:00
Michael Kerrisk 735e291284 eventfd.2: Move text noting that eventfd() creates a FD earlier in the page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-01 09:30:07 +01:00
Michael Kerrisk 839d161f0f clone.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-12-01 09:21:05 +01:00
Michael Kerrisk a202ed9396 ioctl_console.2, ctime.3: tfix
Reported-by: Anatoly Borodin <anatoly.borodin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-11-27 18:28:31 +01:00
Dmitry V. Levin b29cd73f56 ptrace.2: Do not say that PTRACE_O_TRACESYSGOOD may not work
Remove the old statement that PTRACE_O_TRACESYSGOOD may not work
on all architectures.  As far as I can tell, all kernel code
properly tests PT_TRACESYSGOOD flag and sets the 7th bit in the
exit code passed to ptrace_notify().

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-11-27 08:14:54 +01:00
Michael Kerrisk 4a5a783d8f prctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-11-24 20:54:48 +01:00
Michael Kerrisk a32c96b894 prctl.2: Explain the circumstances in which the parent-death signal is sent
To test the behavior documented by this patch, the following
demos employ the program shown at the foot of this commit message.

First, show that the pdeath signal is sent when the parent
terminates:

$ ./pdeath_signal 0 10 4
Parent (18595) about to sleep for 4 seconds
Child about to set PR_SET_PDEATHSIG
Child about to sleep
Parent (18595) terminating
*********** Child (18596) got signal; si_pid = 18595; si_uid = 1000
            Parent PID is now 1403
$ Child about to exit

But the signal is not sent if the parent terminates before the
child uses PR_SET_PDEATHSIG:

$ ./pdeath_signal 2 10  0
Parent (18707) about to sleep for 0 seconds
Parent (18707) terminating
Child about to sleep 2 seconds before setting PR_SET_PDEATHSIG
$ Child about to set PR_SET_PDEATHSIG
Child about to sleep
Child about to exit

Demonstrate that the pdeath signal is sent on termination of each
ancestor subreaper process:

$ ./pdeath_signal 2 10 3 7 6 5
18786 marked itself as a subreaper
18786 subreaper about to sleep 7 seconds
18787 marked itself as a subreaper
18787 subreaper about to sleep 6 seconds
18788 marked itself as a subreaper
18788 subreaper about to sleep 5 seconds
Parent (18789) about to sleep for 3 seconds
Child about to sleep 2 seconds before setting PR_SET_PDEATHSIG
Child about to set PR_SET_PDEATHSIG
Child about to sleep
Parent (18789) terminating
*********** Child (18790) got signal; si_pid = 18789; si_uid = 1000
            Parent PID is now 18788
18788 subreaper about to terminate
*********** Child (18790) got signal; si_pid = 18788; si_uid = 1000
            Parent PID is now 18787
18787 subreaper about to terminate
*********** Child (18790) got signal; si_pid = 18787; si_uid = 1000
            Parent PID is now 18786
18786 subreaper about to terminate
*********** Child (18790) got signal; si_pid = 18786; si_uid = 1000
            Parent PID is now 1403
$ Child about to exit

But in the case where some subreapers terminate before they
have a chance to adopt the child, the terminations of those
subreapers do not result in a signal for the child:

$ ./pdeath_signal 2 10 3 5 6 7
18836 marked itself as a subreaper
18836 subreaper about to sleep 5 seconds
18837 marked itself as a subreaper
18837 subreaper about to sleep 6 seconds
18838 marked itself as a subreaper
18838 subreaper about to sleep 7 seconds
Parent (18839) about to sleep for 3 seconds
Child about to sleep 2 seconds before setting PR_SET_PDEATHSIG
Child about to set PR_SET_PDEATHSIG
Child about to sleep
Parent (18839) terminating
*********** Child (18840) got signal; si_pid = 18839; si_uid = 1000
            Parent PID is now 18838
18836 subreaper about to terminate
$ 18837 subreaper about to terminate
18838 subreaper about to terminate
*********** Child (18840) got signal; si_pid = 18838; si_uid = 1000
            Parent PID is now 1403
Child about to exit

============================

/* pdeath_signal.c */

                        } while (0)

static void
handler(int sig, siginfo_t *si, void *ucontext)
{
    printf("*********** Child (%ld) got signal; si_pid = %d; si_uid = %d\n",
            (long) getpid(), si->si_pid, si->si_uid);
    printf("            Parent PID is now %ld\n", (long) getppid());
}

int
main(int argc, char *argv[])
{
    struct sigaction sa;
    int childPreSleep, childPostSleep, parentSleep;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s child-pre-sleep "
                "[child-post-sleep [parent-sleep [subreaper-sleep...]]]\n",
                argv[0]);
        exit(EXIT_FAILURE);
    }

    childPreSleep = atoi(argv[1]);
    if (argc > 2)
        childPostSleep = atoi(argv[2]);
    if (argc > 3)
        parentSleep = atoi(argv[3]);

    /* Optionally create a series of subreapers */

    if (argc > 4) {
        for (int sr = 4; sr < argc; sr++) {
            if (prctl(PR_SET_CHILD_SUBREAPER, 1) == -1)
                errExit("prctl");
            printf("%ld marked itself as a subreaper\n", (long) getpid());
            switch (fork()) {
            case -1:
                errExit("fork");
            case 0:
                break;
            default:
                printf("%ld subreaper about to sleep %s seconds\n",
                        (long) getpid(), argv[sr]);
                sleep(atoi(argv[sr]));
                printf("%ld subreaper about to terminate\n", (long) getpid());
                exit(EXIT_SUCCESS);
            }
        }
    }

    switch (fork()) {
    case -1:
        errExit("fork");

    case 0:
        sa.sa_flags = SA_SIGINFO;
        sigemptyset(&sa.sa_mask);
        sa.sa_sigaction = handler;
        if (sigaction(SIGUSR1, &sa, NULL) == -1)
            errExit("sigaction");

        if (childPreSleep > 0) {
            printf("Child about to sleep %d seconds before setting "
                    "PR_SET_PDEATHSIG\n", childPreSleep);
            sleep(childPreSleep);
        }

        printf("Child about to set PR_SET_PDEATHSIG\n");
        if (prctl(PR_SET_PDEATHSIG, SIGUSR1) == -1)
            errExit("prctl");

        printf("Child about to sleep\n");
        for (int j = 0; j < childPostSleep; j++)
            sleep(1);

        printf("Child about to exit\n");
        exit(EXIT_SUCCESS);

    default:
        printf("Parent (%ld) about to sleep for %d seconds\n",
                (long) getpid(), parentSleep);
        sleep(parentSleep);
        printf("Parent (%ld) terminating\n", (long) getpid());
        exit(EXIT_SUCCESS);
    }
}

Reported-by: Jann Horn <jann@thejh.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-11-24 13:00:52 +01:00