Commit Graph

19168 Commits

Author SHA1 Message Date
Michael Kerrisk 169d728330 pthread_create.3: Minor fix: reorder table items
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-04-05 20:12:18 +02:00
Michael Kerrisk 8efada9938 pthread_create.3: Minor tweaks to Frederic Brault's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-04-05 20:12:18 +02:00
Frederic Brault af6e958b58 pthread_create.3: Note default thread stack size for several architectures
I am trying to fix a FIXME in the pthread_create.3 manpage.
It says info about default thread stack size should be put in
pthread_attr_setstacksize.3.

And pthread_attr_setstacksize.3 says "For details on the default
stack size of new threads, see pthread_create(3)".

So I list the default values for several architectures, starting
from glibc 2.12 (and still valid on current git glibc).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-04-05 20:12:07 +02:00
Michael Kerrisk 218d4d5b2e wait4.2: Soften the warning against the use of wait3()/wait4()
These functions are nonstandard, but there is no replacement.

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

Reported-by: Martin Mares <mj@ucw.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-04-01 04:59:48 +02:00
Michael Kerrisk 6c35ad5db2 ld.so.8: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-28 05:03:32 +02:00
Michael Kerrisk 1de4fe15be ld.so.8: Remove unneeded mention of PATH in discussion of LD_LIBRARY_PATH
This brief sentence doesn't add value to the text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-28 05:01:22 +02:00
Mike Frysinger 91c4caa051 ld.so.8: Make lack of separator escaping explicit
Make it clear that the delimiters in LD_PRELOAD, LD_LIBRARY_PATH,
and LD_AUDIT cannot be escaped so people don't try various methods
(such as \:) to workaround it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-28 04:59:19 +02:00
Jann Horn f23ba9ce98 tsearch.3: tdelete() can return dangling pointers
POSIX says that deleting the root node must cause tdelete() to
return some unspecified non-NULL pointer. Glibc implements it by
returning a dangling pointer to the (freed) root node:

$ cat bogus_tdelete.c

static void *root = NULL;

static void *xmalloc(unsigned n) {
    void *p;
    p = malloc(n);
    if (!p)
        err(1, "malloc");
    return p;
}

static int compare(const void *pa, const void *pb) {
    if (*(int *) pa < *(int *) pb)
        return -1;
    if (*(int *) pa > *(int *) pb)
        return 1;
    return 0;
}

int main(void) {
    int *ptr;
    void *val, *parent;

    ptr = xmalloc(sizeof(int));
    *ptr = 1234;
    val = tsearch((void*)ptr, &root, compare);
    assert(*(int**)val == ptr);
    printf("root: %p\n", root);

    parent = tdelete((void*)ptr, &root, compare);
    printf("tdelete return value: %p; new root: %p\n", parent, root);

    return 0;
}
$ gcc -o bogus_tdelete bogus_tdelete.c -std=gnu99 -Wall
$ gdb ./bogus_tdelete
GNU gdb (GDB) 7.9-gg19
[...]
(gdb) break free
Function "free" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (free) pending.
(gdb) run
Starting program: /usr/local/google/home/jannh/tmp/bogus_tdelete
[...]
root: 0x555555756030

Breakpoint 1, 0x00007ffff7ab54e0 in free () from [...]
(gdb) print (void*)$rdi
$1 = (void *) 0x555555756030
(gdb) cont
Continuing.
tdelete return value: 0x555555756030; new root: (nil)
[Inferior 1 (process 56564) exited normally]
(gdb) quit

Therefore, explicitly note that tdelete() may return bad pointers
that must not be accessed.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-27 22:29:10 +02:00
Jann Horn f119ba87ea tsearch.3: Clarify items vs nodes
The manpage claimed that tsearch() returns a pointer to a data
item. This is incorrect; tsearch() returns a pointer to the
corresponding tree node, which can also be interpreted as a
pointer to a pointer to the data item.

Since this API is quite unintuitive, also add a clarifying
sentence.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-27 22:25:29 +02:00
Jann Horn 19d371260e open.2: Document more -ETXTBSY conditions
The first one happens in
do_filp_open -> path_openat -> do_last -> handle_truncate -> do_truncate
-> notify_change -> simple_setattr -> setattr_prepare -> inode_newsize_ok.

Demo:

[...]
[...]
[...]
open("/x", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ETXTBSY (Text file busy)
[...]
[...]
open("/x", O_WRONLY|O_CREAT, 0666)      = 3
dup2(3, 1)                              = 1
close(3)                                = 0
read(0, "\0\0\0\0[...]"..., 512) = 512
write(1, "\0\0\0\0[...]"..., 512) = 512
[...]

The second one is in kernel_read_file -> deny_write_access.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-27 22:19:49 +02:00
Michael Kerrisk 3f6061d025 socket.7: Fix error in SO_INCOMING_CPU code snippet
The last argument is passed by value, not reference.
Reported-by: Tomi Salminen <tsalminen@forcepoint.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-27 22:06:52 +02:00
Michael Kerrisk d8c64e25f8 network_namespaces.7: Add cross reference to unix(7)
For further information on UNIX domain abstract sockets.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 6bd80e8b63 clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 82f9cb98f6 clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 39ad46695f time.7: Mention clock_gettime()/clock_settime() rather than [gs]ettimeofday()
gettimeofday() is declared obsolete by POSIX. Mention instead
the modern APIs for working with the realtime clock.

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

Reported-by: Enrique Garcia <cquike@arcor.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 8f8b643d85 sysfs.5: Add brief note on /sys/fs/smackfs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk ecf0eb2435 getrlimit.2: CAP_SYS_RESOURCE capability is required in *initial user namespace*
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 30c5868ea4 seccomp.2: Note which architectures support seccomp BPF
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk d0eae5b5e0 seccomp.2: wfix: s/prctl/ptrace/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk f36293a2df seccomp.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:36 +01:00
Michael Kerrisk 84819acab3 mount.2: Remove a couple of obsolete EBUSY errors
As far as I can tell, these EBUSY errors disappeared
with the addition of stackable mounts in Linux 2.4.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:35 +01:00
Michael Kerrisk 2b623a23a7 bpf.2: Update list of architectures that support JITed eBPF
And note kernel version numbers where support is added.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:35 +01:00
Michael Kerrisk 5a29959a67 bpf.2: Kernel 4.15 added CONFIG_BPF_JIT_ALWAYS_ON
This causes the JIT compiler to be always on and
forces bpf_jit_enable to 1.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-16 08:50:25 +01:00
Michael Kerrisk 036b0619f7 seccomp.2: Note that execve() may change syscall numbers during life of process
On a multiarch/multi-ABI platform such as modern x86, each
architecture/ABI (x86-64, x32, i386)has its own syscall numbers,
which means a seccomp() filter may see different syscall numbers
over the life of the process if that process uses execve() to
execute programs that has a different architectures/ABIs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-05 12:55:50 +01:00
Michael Kerrisk a3dcaaa2ba seccomp.2: in EXAMPLE, clearly note that x32 syscalls are >= X32_SYSCALL_BIT
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-05 12:55:50 +01:00
Michael Kerrisk 050f349421 mount.2: ERRORS: add EBUSY for the case of trying to stack same mount twice
It is not possible to consecutively stack mounts of the
same source+target inside the same mount namespace.

For example, if procfs was already mounted against /proc in
this mount namespace:

    $ sudo mount -t proc none /proc
    mount: /proc: none already mounted or mount point busy.

See the following code in fs/namespace.c:

        /* Refuse the same filesystem on the same mount point */
        err = -EBUSY;
        if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb &&
            path->mnt->mnt_root == path->dentry)
                goto unlock;

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-05 12:55:50 +01:00
Michael Kerrisk 4a870c6849 elf.5: SEE ALSO: add patchelf(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-03-02 14:34:41 +01:00
Michael Kerrisk 6b49df2229 mount_namespaces.7: Note another case where shared "peer groups" are formed
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-25 16:42:16 +01:00
Michael Kerrisk 46af719866 mount_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-25 16:37:08 +01:00
Michael Kerrisk a21658aad3 network_namespaces.7: Network namespaces isolate the UNIX domain abstract socket namespace
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 23:04:53 +01:00
Michael Kerrisk 365a54c70b mmap.2: Clarify that when addr==NULL, address chosen by kernel is page-aligned
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 19:34:28 +01:00
Michael Kerrisk 9c8ed83514 wait.2: wait() and waitpid() block the calling thread (not process)
Reported-by: Robin Kuzmin <kuzmin.robin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 19:02:50 +01:00
Mattias Andrée f3e8dec6c7 recvmmsg.2: tfix
recvmmsq -> recvmmsg

Signed-off-by: Mattias Andrée <maandree@kth.se>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 18:59:42 +01:00
Michael Kerrisk e5a062a42f ldconfig.8: tfix
Reported-by: Howard Johnson <hwj@BridgeportContractor.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 18:58:04 +01:00
Adam Borowski 89c2d890df syscall.2: Add riscv
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-24 18:54:02 +01:00
Michael Kerrisk aeeb48005e user_namespaces.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-23 10:38:47 +01:00
Michael Kerrisk 1a7e08e367 namespaces.7: Note an idiosyncracy of /proc/[pid]/ns/pid_for_children
/proc/[pid]/ns/pid_for_children has a value only after first
child is created in PID namespace. Verified by experiment.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-21 17:31:48 +01:00
Michael Kerrisk 0813749503 capabilities.7: remove redundant mention of PTRACE_SECCOMP_GET_FILTER
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-21 10:38:17 +01:00
Michael Kerrisk 9863b9acfe xattr.7: SEE ALSO: add selinux(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-21 08:43:14 +01:00
Michael Kerrisk 511e0bd08b fallocate.2: Since Linux 4.16, Btrfs supports FALLOC_FL_ZERO_RANGE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-19 18:51:07 +01:00
Michael Kerrisk 517b7ac44a makedev.3: Since glibc 2.28, <sys/types.h> no longer defines these macroa
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-19 18:39:15 +01:00
Michael Kerrisk b59de1c652 execve.2: More explicitly describe effect of execve() in the opening paragraph
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-16 12:29:38 +01:00
Michael Kerrisk aba7005cdc execve.2: Note that describing execve as "executing a new process" is misleading
This misdescription is so common that it's worth calling it out
explicitly.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-16 12:21:09 +01:00
Michael Kerrisk 7747ed9789 cgroups.7: cgroup.events transitions generate POLLERR as well as POLLPRI
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-10 09:46:14 +01:00
Michael Kerrisk a43454393f group.5: SEE ALSO: add vigr(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-10 07:22:56 +01:00
Michael Kerrisk a77696adca passwd.5: SEE ALSO: add vipw(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-10 07:22:56 +01:00
Michael Kerrisk 23fadc9b53 filesystems.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-10 07:22:53 +01:00
Michael Kerrisk 20894689e3 filesystems.5: Add an entry for tmpfs(5)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-09 07:20:11 +01:00
Michael Kerrisk 017b630f83 filesystems.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-09 07:15:30 +01:00
Michael Kerrisk 3115293a0e tmpfs.5: Update timestamp as marker of bad author commit
The author of 462a385e9a
was Mike Fryinger, not Carsten Grohmann. I (mtk) messed
while amending the commit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2018-02-09 07:15:27 +01:00