Commit Graph

21445 Commits

Author SHA1 Message Date
Michael Kerrisk d022c7fdf0 getcwd.2, mq_notify.2, mq_open.2, mq_timedreceive.2, mq_timedsend.2, mq_unlink.2: Reinstate links to section 3 pages that document system calls
Some of the links removed in commit 247c654385 should
have been kept, because in some cases there are real system
calls whose wrapper functions are documented in Section 3.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 13:41:38 +02:00
Michael Kerrisk 0a3bfcf774 syscalls.2: Remove duplicate entry for swapcontext(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 13:21:46 +02:00
Michael Kerrisk a35315178d ip.7: Minor wording fixes
Mainly cleaning up usages of "only".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:26:21 +02:00
Michael Kerrisk b5d7102ea4 ip.7: Minor edits to Stephen Smalley's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:22:55 +02:00
Stephen Smalley 755b3ecb73 ip.7: Document IP_PASSSEC for UDP sockets
Document the IP_PASSSEC socket option and SCM_SECURITY
ancillary/control message type for UDP sockets.

IP_PASSSEC for UDP sockets was introduced in Linux 2.6.17 [1].

Example NetLabel and IPSEC configurations and usage of this
option can be found in the SELinux Notebook [2] and SELinux
testsuite [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2c7946a7bf45ae86736ab3b43d0085e43947945c

[2] https://github.com/SELinuxProject/selinux-notebook

[3] https://github.com/SELinuxProject/selinux-testsuite

Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:52 +02:00
Michael Kerrisk 29494dfeb8 ip.7, unix.7: Minor edits to Stephen Smalley's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 14c11c826a unix.7: srcfix: rewrap source lines in Stephen Smalley's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 7e915f4c58 ip.7: srcfix: rewrap source lines in Stephen Smalley's patch
(No content changes.)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Stephen Smalley 3c63603499 socket.7,ip.7: Document SO_PEERSEC for AF_INET sockets
Augment the description of SO_PEERSEC to cover AF_INET sockets in
addition to the prior description for AF_UNIX.

SO_PEERSEC for TCP sockets was introduced in Linux 2.6.17 [1], and
SO_PEERSEC for SCTP sockets was introduced in Linux 4.17 [2].

This does not cover usage of SCM_SECURITY for UDP sockets, which
was also introduced in the same commit for 2.6.17.

Examples of the necessary labeled IPSEC and NetLabel
configurations to enable use of SO_PEERSEC for TCP and SCTP
sockets can be found in the SELinux Notebook [3] and the
selinux-testsuite [4].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2c7946a7bf45ae86736ab3b43d0085e43947945c

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d452930fd3b9031e59abfeddb2fa383f1403d61a

[3] https://github.com/SELinuxProject/selinux-notebook

[4] https://github.com/SELinuxProject/selinux-testsuite

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Stephen Smalley e6f90c3fb2 socket.7, unix.7: Add initial description for SO_PEERSEC
SO_PEERSEC was introduced for AF_UNIX stream sockets connected via
connect(2) in Linux 2.6.2 [1] and later augmented to support
AF_UNIX stream and datagram sockets created via socketpair(2) in
Linux 4.18 [2].  Document SO_PEERSEC in the socket.7 and unix.7
man pages following the example of the existing SO_PEERCRED
descriptions.  SO_PEERSEC is also supported on AF_INET sockets
when using labeled IPSEC or NetLabel but defer adding a
description of that support to a separate patch.

The module-independent description of the security context
returned by SO_PEERSEC is from Simon McVittie.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=da6e57a2e6bd7939f610d957afacaf6a131e75ed

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b811db2cb2aabc910e53d34ebb95a15997c33e7

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Cowritten-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 65c0f42710 sigevent.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:07:26 +02:00
Michael Kerrisk 0b62a2e3bd sigevent.7: Note that 'sigev_notify_thread_id' is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:02:51 +02:00
Michael Kerrisk efbe7900b9 system_data_types.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 09:59:36 +02:00
Michael Kerrisk 6b7bf192b9 system_data_types.7: Minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 00:16:50 +02:00
Alejandro Colomar 96c63a40af aiocb.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:27:22 +02:00
Michael Kerrisk 126e68fb73 system_data_types.7: Defer to aio(7) for further information about 'struct aiocb'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:26:29 +02:00
Alejandro Colomar def0975720 system_data_types.7: Document aiocb
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:25:19 +02:00
Alejandro Colomar b4a5c62b3b system_data_types.7: srcfix: cosmetic: Visually separate types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:13:36 +02:00
Michael Kerrisk 66c2f0b251 system_data_types.7: Add reference to sigevent(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:08:28 +02:00
Alejandro Colomar bcae58d752 system_data_types.7: Document sigevent
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:05:49 +02:00
Alejandro Colomar 8d1c20e01e 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-09-18 22:49:47 +02:00
Alejandro Colomar 62f4b73a5e regmatch_t.3: New link for new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:45:02 +02:00
Alejandro Colomar 6fdfb077b8 system_data_types.7: Document regmatch_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:42:50 +02:00
Alejandro Colomar f33cc31420 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-09-18 22:41:38 +02:00
Alejandro Colomar 924dea4c9c system_data_types.7: srcfix: Add FIXME notes
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:31:46 +02:00
Alejandro Colomar 1c0569eac3 regoff_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:31:15 +02:00
Alejandro Colomar 1415a39e39 system_data_types.7: Document regoff_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:29:27 +02:00
Alejandro Colomar f723e17664 ptrdiff_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:19:56 +02:00
Alejandro Colomar 515348d543 system_data_types.7: Document ptrdiff_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:19:07 +02:00
Alejandro Colomar dd06f85245 system_data_types.7: wfix: sort referenced types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:16:09 +02:00
Alejandro Colomar b6d3f94f29 system_data_types.7: srcfix: Remove TODO comment
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:15:38 +02:00
Michael Kerrisk c72ab20dc8 system_data_types.7: Add read(2) and write(2) to "See also" for size_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:08:02 +02:00
Alejandro Colomar 231b22152a size_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:06:55 +02:00
Alejandro Colomar eb3f724506 system_data_types.7: Document size_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:06:50 +02:00
Michael Kerrisk 3006c18803 feature_test_macros.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Michael Kerrisk 9f2a6007d1 intro.2, intro.3, feature_test_macros.7, standards.7: SEE ALSO: add system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Michael Kerrisk 866c73c89f system_data_types.7: Add SEE ALSO references to feature_test_macros(7) and standards(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Alejandro Colomar 9334a43e41 sigval.3, ssize_t.3, suseconds_t.3, time_t.3, timer_t.3, timespec.3, timeval.3: New links to new system_data_types(7) page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Alejandro Colomar cb7fd5031a system_data_types.7: Add a new page to document system data types
The initial version documents sigval, ssize_t, suseconds_t,
time_t, timer_t, timespec, and timeval.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:37:57 +02:00
Marko Hrastovec a23b00988a freeaddrinfo.3: Fix memory leaks in freeaddrinfo() examples
[mtk: the coding style used in the example could lead people to
inject memory leaks in their code if they cut/paste/modify the
code to replace "exit" paths with "return" paths from a library
function.]

[Marko, from the mail thread discussing this patch:]
You are right about terminating the process. However, people copy
that example and put the code in a function changing "exit" to
"return". There are a bunch of examples like that here
https://beej.us/guide/bgnet/html/#poll, for instance. That error
bothered me when reading the network programming guide
https://beej.us/guide/bgnet/html/. Than I looked for information
elsewhere:

https://stackoverflow.com/questions/6712740/valgrind-reporting-that-getaddrinfo-is-leaking-memory

https://stackoverflow.com/questions/15690303/server-client-sockets-freeaddrinfo3-placement

And finally, I checked manual pages and saw where these errors
come from.

When you change that to a function and return without doing
freeaddrinfo, that is a memory leak. I believe an example should
show good programming practices. Relying on exiting and clearing
the memory in that case is not such a case. In my opinion, these
examples lead people to make mistakes in their programs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 09:12:24 +02:00
Michael Kerrisk 966d17b1c5 sigaction.2: Use correct POSIX type for siginfo_t.si_value
Reported-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-16 16:26:12 +02:00
Michael Kerrisk 15e2ed1500 man-pages.7: Add some more requests re code examples
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 10:44:00 +02:00
Michael Kerrisk 6e68441741 man-pages.7: Soften the statement that ideal programs should be short
Sometimes, a longer program is needed. See
https://twitter.com/shuveb/status/1305689727715086337.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 10:43:20 +02:00
Michael Kerrisk 1aaa7bcd6a fanotify.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 07:39:27 +02:00
Alejandro Colomar 8eb90116f1 add_key.2, clock_getres.2, clone.2, futex.2, getdents.2, getpid.2, getrlimit.2, ioctl_ns.2, kcmp.2, keyctl.2, memfd_create.2, request_key.2, stat.2, timer_create.2, wait.2, clock_getcpuclockid.3, dl_iterate_phdr.3, getgrent_r.3, getpwent_r.3, getpwnam.3, posix_spawn.3, pthread_getcpuclockid.3, strcat.3, feature_test_macros.7, user_namespaces.7: Switch printf() casts to use [u]intmax_t + %ju / %jd
Let's move to the 21st century. Instead of casting system data
types to long/long long/etc. in printf() calls, instead cast to
intmax_t or uintmax_t, the largest available signed/unsigned
integer types.

[mtk: rewrote commit message]

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 07:39:19 +02:00
Alejandro Colomar 6fd153d540 clock_getres.2: Cast 'time_t' to 'int' for printf() and fix the length modifiers
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Reviewed-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar f6fbffeae5 userfaultfd.2: Use 'PRIx64' rather than "%llx" when printing 64-bit fixed-width types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar adb2084109 rtld-audit.7: Use "%u" rather than "%d" when printing 'unsigned int' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar 1bdfc7fc42 open_by_handle_at.2: Use "%u" rather than "%d" when printing 'unsigned int' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar 982dfed192 mprotect.2: Use "%p" rather than casting to 'long' when printing pointer values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:06:46 +02:00