Commit Graph

21760 Commits

Author SHA1 Message Date
Michael Kerrisk 5582acd15e Ready for 5.09 2020-11-01 21:08:55 +01:00
Michael Kerrisk c9be570549 Changes: whitespace cleanups 2020-11-01 21:08:45 +01:00
Michael Kerrisk 548f91f86e memusage.1, pldd.1, sprof.1, add_key.2, bind.2, bpf.2, clone.2, dup.2, epoll_ctl.2, eventfd.2, fanotify_init.2, fanotify_mark.2, futex.2, getdents.2, getpid.2, getrlimit.2, intro.2, ioctl_fat.2, ioctl_ns.2, kcmp.2, keyctl.2, membarrier.2, memfd_create.2, mprotect.2, msgctl.2, msgop.2, nfsservctl.2, open.2, open_by_handle_at.2, openat2.2, outb.2, perf_event_open.2, pivot_root.2, recv.2, recvmmsg.2, request_key.2, sched_setaffinity.2, sched_setattr.2, seccomp.2, select.2, send.2, signalfd.2, spu_run.2, sysctl.2, timer_create.2, userfaultfd.2, wait.2, CPU_SET.3, abs.3, argz_add.3, backtrace.3, bsearch.3, bswap.3, clock_getcpuclockid.3, cmsg.3, dl_iterate_phdr.3, dlinfo.3, dlopen.3, drand48.3, drand48_r.3, duplocale.3, encrypt.3, endian.3, envz_add.3, errno.3, ffs.3, fopencookie.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrent_r.3, getgrouplist.3, getifaddrs.3, getline.3, getprotoent_r.3, getpwent_r.3, getpwnam.3, getservent_r.3, hsearch.3, insque.3, intro.3, lrint.3, lround.3, lseek64.3, mallinfo.3, malloc_hook.3, malloc_info.3, mbsinit.3, mbstowcs.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, perror.3, posix_fallocate.3, posix_spawn.3, printf.3, psignal.3, pthread_attr_init.3, pthread_create.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_sigmask.3, qsort.3, rand.3, random.3, rpc.3, rtnetlink.3, scalbln.3, shm_open.3, stdarg.3, strcat.3, strerror.3, strfmon.3, strptime.3, strsignal.3, strtod.3, strtok.3, strtol.3, strtoul.3, tsearch.3, wordexp.3, loop.4, vcs.4, veth.4, core.5, locale.5, slabinfo.5, cgroup_namespaces.7, cpuset.7, credentials.7, fanotify.7, feature_test_macros.7, inotify.7, ip.7, kernel_lockdown.7, man.7, mount_namespaces.7, namespaces.7, pid_namespaces.7, rtld-audit.7, sigevent.7, sock_diag.7, standards.7, unix.7, user_namespaces.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:06:59 +01:00
Michael Kerrisk ac46781f3d Changes: Ready for 5.09
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:06:53 +01:00
Michael Kerrisk 152ce70f53 pthread_attr_init.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:06:53 +01:00
Alejandro Colomar 23a74bd771 openat.2: SYNOPSIS: return long
The Linux kernel uses long as the return type for this syscall.
As glibc provides no wrapper, use the same type the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 19:04:11 +01:00
Alejandro Colomar a024704790 mq_getsetattr.2: Use 'const' when appropriate
The Linux kernel uses the following:

ipc/mqueue.c:1480:
SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
		const struct mq_attr __user *, u_mqstat,
		struct mq_attr __user *, u_omqstat)

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:23:38 +01:00
Michael Kerrisk 706d4f73ae pthread_attr_init.3: SEE ALSO: add pthread_attr_init(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 96841f0e25 pthread_sigmask.3: SEE ALSO: add pthread_attr_setsigmask_np(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 340f4f9e7c pthread_attr_setsigmask_np.3: New page for pthread_attr_setsigmask_np() + pthread_attr_getsigmask_np()
Add a page documenting the pthread_attr_setsigmask_np(3) and
pthread_attr_getsigmask_np() functions added in glibc 2.32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 2e33563284 statx.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 07:17:20 +01:00
Michael Kerrisk e9c09849cc dlopen.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-31 10:17:00 +01:00
Alejandro Colomar 68219aba7f futex.2: ffix
That comment wrapped on an 80-column terminal.
Divide it into two lines.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 21:05:10 +01:00
Alejandro Colomar 2253ecf016 futex.2: Use appropriate types
The Linux kernel uses the following:

kernel/futex.c:3778:
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
		struct __kernel_timespec __user *, utime, u32 __user *, uaddr2,
		u32, val3)

Since there is no glibc wrapper, use the same types the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 20:16:08 +01:00
Alejandro Colomar 8a60718ef0 futex.2: srcfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 20:15:59 +01:00
Alejandro Colomar 13e88b7070 getdents.2: Use appropriate types
[mtk: Applied patch manually]

getdents():
This function has no glibc wrapper.
As such, we should use the same types the Linux kernel uses:
Use 'long' as the return type.

getdents64():
The glibc wrapper uses:
ssize_t getdents64(int, void *, size_t);

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-29 20:10:56 +01:00
Michael Kerrisk 833ba57027 getdents.2: Minor tweak to Alex's patch
The text in NOTES doesn't really relate specifically to
the #include, so remove the comment on the #include.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:17:53 +01:00
Alejandro Colomar 2adfdd7795 getdents.2: SYNOPSIS: Add missing header and feature test macro
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:16:41 +01:00
Alejandro Colomar d70361dab7 getdents.2: wfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:14:02 +01:00
Alejandro Colomar 276dc9a3cc clock_getres.2: EXAMPLES: Use 'const' when appropriate
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:13:50 +01:00
Alejandro Colomar 93f369892a strtol.3: EXAMPLES: Simplify errno checking
(No expected change in behavior,)

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:12:22 +01:00
Alejandro Colomar b924e6b65a strtol.3: EXAMPLES: As the default base, use special value 0
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:11:25 +01:00
Alejandro Colomar d01c330357 strtol.3: EXAMPLES: Delimit output string using ""
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:11:12 +01:00
Michael Kerrisk 10414db19b man_show_fixme.sh: Don't hyphenate or justify the manual page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 09:42:41 +01:00
Michael Kerrisk 820e13fbd4 socket.7: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:20:31 +01:00
Sridhar Samudrala e8500ecc78 socket.7: Document SO_INCOMING_NAPI_ID
Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:15:43 +01:00
Michael Kerrisk f36f4f855b strtol.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:01:01 +01:00
Michael Kerrisk b6a968bca7 strtol.3: srcfix: Add myself to copyright
I added the xample program in 2006, but omitted to add myself to the
copyright.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 20:00:23 +01:00
Michael Kerrisk 30d41ce662 FIXME_list.sh: Fix broken regexp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 19:42:47 +01:00
Michael Kerrisk 4111ac7675 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:59:36 +01:00
Michael Kerrisk 0f66701491 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:55:07 +01:00
Alexey Budankov d19b29a5bc perf_event_open.2: Update the man page with CAP_PERFMON related information
Extend this page with the information about CAP_PERFMON capability
designed to secure performance monitoring and observability
operation in a system according to the principle of least
privilege [1] (POSIX IEEE 1003.1e, 2.2.2.39).

[1] https://sites.google.com/site/fullycapable/, posix_1003.1e-990310.pdf

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:53:10 +01:00
Alejandro Colomar 900d564055 system_data_types.7: off_t: Add note about _FILE_OFFSET_BITS
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:34:55 +01:00
Michael Kerrisk 8573214f58 lseek64.3: Since glibc 2.28. the 'llseek' symbol is no longer available
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:08:18 +01:00
Jann Horn 20e43cd694 proc.5: Document inaccurate RSS due to SPLIT_RSS_COUNTING
[mtk: Manually applied patch, because of conflicts with other
merged changes; also added an edit suggested by Jann; see the
thread at
https://lore.kernel.org/linux-man/20201012114940.1317510-1-jannh@google.com/]

Since 34e55232e59f7b19050267a05ff1226e5cd122a5 (introduced back in
v2.6.34), Linux uses per-thread RSS counters to reduce cache
contention on the per-mm counters. With a 4K page size, that means
that you can end up with the counters off by up to 252KiB per
thread.

Example:

$ cat rsstest.c
#include <stdlib.h>
#include <err.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/eventfd.h>
#include <sys/prctl.h>
void dump(int pid) {
  char cmd[1000];
  sprintf(cmd,
    "grep '^VmRSS' /proc/%d/status;"
    "grep '^Rss:' /proc/%d/smaps_rollup;"
    "echo",
    pid, pid
  );
  system(cmd);
}
int main(void) {
  eventfd_t dummy;
  int child_wait = eventfd(0, EFD_SEMAPHORE|EFD_CLOEXEC);
  int child_resume = eventfd(0, EFD_SEMAPHORE|EFD_CLOEXEC);
  if (child_wait == -1 || child_resume == -1) err(1, "eventfd");
  pid_t child = fork();
  if (child == -1) err(1, "fork");
  if (child == 0) {
    if (prctl(PR_SET_PDEATHSIG, SIGKILL)) err(1, "PDEATHSIG");
    if (getppid() == 1) exit(0);
    char *mapping = mmap(NULL, 80 * 0x1000, PROT_READ|PROT_WRITE,
                         MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    for (int i=0; i<40; i++) mapping[0x1000 * i] = 1;
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    for (int i=40; i<80; i++) mapping[0x1000 * i] = 1;
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    exit(0);
  }

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  exit(0);
}
$ gcc -o rsstest rsstest.c && ./rsstest
VmRSS:	      68 kB
Rss:                 616 kB

VmRSS:	      68 kB
Rss:                 776 kB

VmRSS:	     812 kB
Rss:                 936 kB

$

Let's document that those counters aren't entirely accurate.

Reported-by: Mark Mossberg <mark.mossberg@gmail.com>
Signed-off-by: Jann Horn <jannh@google.com>

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:52:08 +01:00
Michael Kerrisk 14948ad6ec proc.5: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk bd13ace0c5 proc.5: ffix: use a hanging list as is done elsewhere in the page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Alejandro Colomar 4492c4bf2c system_data_types.7: ffix
Format section names inside each type.
Follow the same pattern as in stat.2 (see line 158: ".IR Note :")

Before this ffix, it was visually harder to find sections inside a type.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Alejandro Colomar 476e632b65 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 2fbfb575b8 capabilities.7: Under CAP_SYS_ADMIN, group "sub-capabilities" together
CAP_BPF, CAP_PERFMON, and CAP_CHECKPOINT_RESTORE have all been
added to split out the power of CAP_SYS_ADMIN into weaker pieces.
Group all of these capabilities together in the list under
CAP_SYS_ADMIN, to make it clear that there is a pattern to these
capabilities.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 045c5bde77 capabilities.7: CAP_SYS_ADMIN implies CAP_CHECKPOINT_RESTORE
But the latter, weaker capability is preferred.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk a526aa4040 capabilities.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 71f6247f3c capabilities.7: Document the CAP_CHECKPOINT_RESTORE capability added in Linux 5.9
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 167f94b707 proc.5: Update capability requirements for accessing /proc/[pid]/map_files
The requirements changed with kernel commit 12886f8ab10ce6.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 1e516a820b pid_namespaces.7: Update capability requirements for /proc/sys/kernel/ns_last_pid
Since Linux 5.9, CONFIG_CHECKPOINT_RESTORE also allows writing to
/proc/sys/kernel/ns_last_pid.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 1e4d6750e0 clone.2: CAP_CHECKPOINT_RESTORE can now be used to employ 'set_tid'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 874355e30b capabilities.7: Add kernel doc reference for CAP_PERFMON
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk f7cf9c0bf0 capabilities.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 3af4e9733e posix_fallocate.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Érico Rolim d5ee3a149e posix_fallocate.3: add EOPNOTSUPP error code.
As can be seen in

https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3

musl libc returns the syscall's errors directly, which means it
doesn't perform the same emulation as glibc, and can return
EOPNOTSUPP to an application, which isn't listed in ERRORS.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00