Patches from others
cover Patches from others
Hi Michael,
Here is a patch set including patches from others, patches of mine fixing bug reports of others, tweaks to others' patches, and small patches of mine.
I resent in this patch set all the patches that I sent a few weeks ago, so you can ignore any older threads of mine.
Cheers,
Alex
--
Alejandro Colomar (11):
readv.2: Minor tweaks to Will's patch
vdso.7: Remove outdated limitation for powerpc vdso.7: Add y2038 compliant gettime for ppc/32 posixoptions.7: Fix legacy functions list (s/getcwd/getwd/) printf.3: wfix
futex.2: Minor tweaks to Kurt's patch capabilities.7: Minor tweaks to Kir's patch seccomp_unotify.2: Minor tweaks to Rodrigo's patch strstr.3: Add special case for empty needle sigaction.2: Apply minor tweaks to Peter's patch strlen.3, wcslen.3: Add recommendations for safer variants
Dan Robertson (1):
man2/fallocate.2: tfix documentation of shared blocks
Jakub Wilk (3):
seccomp_unotify.2: tfix
proc.5: tfix
scripts/bash_aliases: tfix
Kir Kolyshkin (3):
capabilities.7: tfix
user_namespaces.7: fix a ref
capabilities.7, user_namespaces.7: describe CAP_SETFCAP
Kurt Kanzenbach (1):
futex.2: Document FUTEX_LOCK_PI2
Peter Collingbourne (1):
sigaction.2: Document SA_EXPOSE_TAGBITS and the flag support detection
protocol
Richard Palethorpe (1):
wait.2: Add ESRCH for when pid == INT_MIN
Rodrigo Campos (1):
seccomp_unotify.2: Add doc for SECCOMP_ADDFD_FLAG_SEND
Sagar Patel (1):
tkill.2: tfix
Shawn Landden (1):
execve.2: Fix absolute/relative pathname
Thomas Voss (1):
Various pages: Consistently use '*argv[]'
Viet Than (1):
time.2: wfix regarding year-2038
Will Manley (1):
readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
kXuan (1):
recv.2: tfix
Štěpán Němec (2):
path_resolution.7: tfix
namespaces.7: fix confusion caused by text reorganization
наб (2):
ascii.7: add vertical rule to separate the two columns pipe.7: also mention writev(2) in atomicity sexion
man2/bpf.2 | 2 +- man2/copy_file_range.2 | 2 +- man2/execve.2 | 9 ++- man2/fallocate.2 | 2 +- man2/futex.2 | 110 +++++++++++++++++++++---------- man2/membarrier.2 | 4 +- man2/perf_event_open.2 | 2 +- man2/readv.2 | 11 +++- man2/recv.2 | 2 +- man2/seccomp.2 | 2 +- man2/seccomp_unotify.2 | 30 ++++++++- man2/sigaction.2 | 133 ++++++++++++++++++++++++++++++++++++++ man2/time.2 | 2 +- man2/tkill.2 | 2 +- man2/wait.2 | 9 +++ man3/bsearch.3 | 2 +- man3/getopt.3 | 2 +- man3/getsubopt.3 | 2 +- man3/printf.3 | 2 +- man3/pthread_setname_np.3 | 2 +- man3/strlen.3 | 6 ++ man3/strstr.3 | 8 +++ man3/wcslen.3 | 9 ++- man3/wordexp.3 | 2 +- man5/proc.5 | 2 +- man7/ascii.7 | 2 +- man7/capabilities.7 | 9 ++- man7/fanotify.7 | 2 +- man7/namespaces.7 | 4 +- man7/path_resolution.7 | 2 +- man7/pipe.7 | 2 + man7/posixoptions.7 | 2 +- man7/user_namespaces.7 | 8 ++- man7/vdso.7 | 27 +------- scripts/bash_aliases | 2 +- 35 files changed, 330 insertions(+), 89 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/32 readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
From: Will Manley <[email protected]>
To save the next person before they fall foul of it. See
<https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u>
and <https://github.com/tokio-rs/tokio/issues/3803> for more information.
--- man2/readv.2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
man2/readv.2 +10 -1
@@ -243,7 +243,9 @@ If some data was successfully read, it will return the number of bytes read. If no bytes were read, it will return \-1 and set .IR errno to -.BR EAGAIN . +.BR EAGAIN +(but see +.BR BUGS ")." Currently, this flag is meaningful only for .BR preadv2 (). .TP
@@ -425,6 +427,13 @@ iov[1].iov_len = strlen(str1); nwritten = writev(STDOUT_FILENO, iov, 2); .EE .in +.SH BUGS +Linux v5.9 and v5.10 have a bug where +.BR preadv2() +with the +.BR RWF_NOWAIT +flag may return 0 even when not at end of file. See +https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u .SH SEE ALSO .BR pread (2), .BR read (2),
Signature · 1 line
2.32.0
Re: [PATCH 01/32] readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
Hello Will and Alex,
Quoted 8 lines · Alejandro Colomar
From: Will Manley <[email protected]>
To save the next person before they fall foul of it. See
<https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u>
and <https://github.com/tokio-rs/tokio/issues/3803> for more information.Signed-off-by Will Manley <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Patch applied, but see my follow-up mail.
Thanks,
Michael
Quoted 34 lines
--- man2/readv.2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)man2/readv.2 +10
-1@@ -243,7 +243,9 @@ If some data was successfully read, it will return the number of bytes read. If no bytes were read, it will return \-1 and set .IR errno to -.BR EAGAIN . +.BR EAGAIN +(but see +.BR BUGS ")." Currently, this flag is meaningful only for .BR preadv2 (). .TP@@ -425,6 +427,13 @@ iov[1].iov_len = strlen(str1); nwritten = writev(STDOUT_FILENO, iov, 2); .EE .in +.SH BUGS +Linux v5.9 and v5.10 have a bug where +.BR preadv2() +with the +.BR RWF_NOWAIT +flag may return 0 even when not at end of file. See +https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u .SH SEE ALSO .BR pread (2), .BR read (2),
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 2/32 readv.2: Minor tweaks to Will's patch
In reply to Alejandro Colomar--- man2/readv.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
man2/readv.2 +2 -2
@@ -245,7 +245,7 @@ If no bytes were read, it will return \-1 and set to .BR EAGAIN (but see -.BR BUGS ")." +.BR BUGS ). Currently, this flag is meaningful only for .BR preadv2 (). .TP
@@ -433,7 +433,7 @@ Linux v5.9 and v5.10 have a bug where with the .BR RWF_NOWAIT flag may return 0 even when not at end of file. See -https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u +https://lore.kernel.org\:/linux-fsdevel\:/[email protected]\:/T\:/#u .SH SEE ALSO .BR pread (2), .BR read (2),
Signature · 1 line
2.32.0
Re: [PATCH 02/32] readv.2: Minor tweaks to Will's patch
Hello Alex,
Quoted 2 lines · Alejandro Colomar
Cc Will Manley <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Patch applied, but see my follow-up mail.
Thanks,
Michael
Quoted 27 lines
--- man2/readv.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)man2/readv.2 +2
-2@@ -245,7 +245,7 @@ If no bytes were read, it will return \-1 and set to .BR EAGAIN (but see -.BR BUGS ")." +.BR BUGS ). Currently, this flag is meaningful only for .BR preadv2 (). .TP@@ -433,7 +433,7 @@ Linux v5.9 and v5.10 have a bug where with the .BR RWF_NOWAIT flag may return 0 even when not at end of file. See -https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u +https://lore.kernel.org\:/linux-fsdevel\:/[email protected]\:/T\:/#u .SH SEE ALSO .BR pread (2), .BR read (2),
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 02/32] readv.2: Minor tweaks to Will's patch
Hi Alex and Will
Will, thanks for taking time to write up the patch!
Quoted 7 lines · Michael Kerrisk (man-pages)
Hello Alex,
Quoted 2 lines · Alejandro Colomar
Cc Will Manley <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>Patch applied, but see my follow-up mail.
Alex, see the follow-up patch that I applied, below.
Cheers,
Michael
commit 76dec7bbd4e8761249a339db5f13f7e63a37aac3 (HEAD -> master)
Author: Michael Kerrisk <[email protected]> Date: Sun Aug 8 04:34:37 2021 +0200
readv.2: Minor fixes (part 2) to Will Manley's patch
Mainly: I generally don't want us to be including URLs to mailing list discussions in a manual page. Either, the issue in the discussion is worth writing up in the manual page (so that the reader doesn't have to look elsewhere), or the details are less important, in which case it is sufficient to note the existence of the bug. I think this is an example of the latter.
man2/readv.2 +8 -3
@@ -428,12 +428,17 @@ nwritten = writev(STDOUT_FILENO, iov, 2); .EE .in .SH BUGS -Linux v5.9 and v5.10 have a bug where +Linux 5.9 and 5.10 have a bug where .BR preadv2() with the .BR RWF_NOWAIT -flag may return 0 even when not at end of file. See -https://lore.kernel.org\:/linux-fsdevel\:/[email protected]\:/T\:/#u +flag may return 0 even when not at end of file. +.\" See +.\" <https://lore.kernel.org/linux-fsdevel/[email protected]/T/#u> +.\" The bug was introduced in +.\" efa8480a831 fs: RWF_NOWAIT should imply IOCB_NOIO +.\"and fixed in +.\" 06c0444290 mm/filemap.c: generic_file_buffered_read() now uses find_get_pages_contig .SH SEE ALSO .BR pread (2), .BR read (2),
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 3/32 vdso.7: Remove outdated limitation for powerpc
In reply to Alejandro ColomarChristophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html
(as of today, flagged 2021-03-22)
ppc/32 and ppc/64 sections both have the following note:
The CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE clocks are not supported by the __kernel_clock_getres and __kernel_clock_gettime interfaces; the kernel falls back to the real system call
This note has been wrong from quite some time now,
since commit 654abc69ef2e
("powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") and commit 5c929885f1bb
("powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") ]
--- man7/vdso.7 | 26 -------------------------- 1 file changed, 26 deletions(-)
man7/vdso.7 +0 -26
@@ -385,19 +385,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks are -.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS ppc/64 functions .\" See linux/arch/powerpc/kernel/vdso64/vdso64.lds.S The table below lists the symbols exported by the vDSO.
@@ -423,19 +410,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks are -.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS riscv functions .\" See linux/arch/riscv/kernel/vdso/vdso.lds.S The table below lists the symbols exported by the vDSO.
Signature · 1 line
2.32.0
Re: [PATCH 03/32] vdso.7: Remove outdated limitation for powerpc
Hello Alex,
Quoted 1 line · Alejandro Colomar
Christophe Leroy via Bugzilla:
For the commit message, it would be good to have a URL for the bug. (I could not find the bug.)
Quoted 18 lines
[
https://man7.org/linux/man-pages/man7/vdso.7.html
(as of today, flagged 2021-03-22)ppc/32 and ppc/64 sections both have the following note:
The
CLOCK_REALTIME_COARSEandCLOCK_MONOTONIC_COARSEclocks are not supported by the__kernel_clock_getresand__kernel_clock_gettimeinterfaces; the kernel falls back to the real system callThis note has been wrong from quite some time now,
since commit654abc69ef2e
("powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") and commit5c929885f1bb
("powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") ]
Quoted 2 lines
Reported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
In cases such as this, I prefer not to drop the historical info. See below.
Quoted 38 lines
--- man7/vdso.7 | 26 -------------------------- 1 file changed, 26 deletions(-)man7/vdso.7 +0
-19@@ -385,19 +385,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks are -.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS ppc/64 functions .\" See linux/arch/powerpc/kernel/vdso64/vdso64.lds.S The table below lists the symbols exported by the vDSO.@@ -423,19 +410,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks are
man7/vdso.7 __kernel_sync_dicache_p5 LINUX_2.6.15 · line 415
Quoted 10 lines
man7/vdso.7 +0
-7-.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS riscv functions .\" See linux/arch/riscv/kernel/vdso/vdso.lds.S The table below lists the symbols exported by the vDSO.
I instead applied the patch below.
Cheers,
Michael
man7/vdso.7 +6 -2
@@ -386,7 +386,9 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .ft P \} .PP -The +In kernel versions before Linux 5.6, +.\" commit 654abc69ef2e69712e6d4e8a6cb9292b97a4aa39 +the .B CLOCK_REALTIME_COARSE and .B CLOCK_MONOTONIC_COARSE
@@ -424,7 +426,9 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .ft P \} .PP -The +In kernel versions before Linux 4.16, +.\" commit 5c929885f1bb4b77f85b1769c49405a0e0f154a1 +the .B CLOCK_REALTIME_COARSE and .B CLOCK_MONOTONIC_COARSE
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 03/32] vdso.7: Remove outdated limitation for powerpc
Hello Michael,
Quoted 7 lines · Michael Kerrisk (man-pages)
Hello Alex,
Quoted 1 line · Alejandro Colomar
Christophe Leroy via Bugzilla:
For the commit message, it would be good to have a URL for the bug. (I could not find the bug.)
That's right. <https://bugzilla.kernel.org/show_bug.cgi?id=213419>
Quoted 19 lines
Quoted 19 lines
[
https://man7.org/linux/man-pages/man7/vdso.7.html
(as of today, flagged 2021-03-22)ppc/32 and ppc/64 sections both have the following note:
The
CLOCK_REALTIME_COARSEandCLOCK_MONOTONIC_COARSEclocks are not supported by the__kernel_clock_getresand__kernel_clock_gettimeinterfaces; the kernel falls back to the real system callThis note has been wrong from quite some time now,
since commit654abc69ef2e
("powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") and commit5c929885f1bb
("powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE") ]
Quoted 5 lines
Quoted 2 lines
Reported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>In cases such as this, I prefer not to drop the historical info. See below.
And also right.
Quoted 73 lines
Quoted 39 lines
--- man7/vdso.7 | 26 -------------------------- 1 file changed, 26 deletions(-)man7/vdso.7 +0
-19@@ -385,19 +385,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks are -.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS ppc/64 functions .\" See linux/arch/powerpc/kernel/vdso64/vdso64.lds.S The table below lists the symbols exported by the vDSO.@@ -423,19 +410,6 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .in .ft P \} -.PP -The -.B CLOCK_REALTIME_COARSE -and -.B CLOCK_MONOTONIC_COARSE -clocks areman7/vdso.7 __kernel_sync_dicache_p5 LINUX_2.6.15 · line 415
Quoted 10 lines
man7/vdso.7 +0
-7-.I not -supported by the -.I __kernel_clock_getres -and -.I __kernel_clock_gettime -interfaces; -the kernel falls back to the real system call. .SS riscv functions .\" See linux/arch/riscv/kernel/vdso/vdso.lds.S The table below lists the symbols exported by the vDSO.I instead applied the patch below.
Cheers,
Michael
man7/vdso.7 +3
-1@@ -386,7 +386,9 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .ft P \} .PP -The +In kernel versions before Linux 5.6, +.\" commit 654abc69ef2e69712e6d4e8a6cb9292b97a4aa39 +the .B CLOCK_REALTIME_COARSE and .B CLOCK_MONOTONIC_COARSE
man7/vdso.7 __kernel_sync_dicache_p5 LINUX_2.6.15 · line 431
Quoted 7 lines
man7/vdso.7 +3
-1@@ -424,7 +426,9 @@ __kernel_sync_dicache_p5 LINUX_2.6.15 .ft P \} .PP -The +In kernel versions before Linux 4.16, +.\" commit 5c929885f1bb4b77f85b1769c49405a0e0f154a1 +the
Much better!
Thanks,
Alex
Quoted 6 lines
man7/vdso.7 +0
-0.B CLOCK_REALTIME_COARSE and .B CLOCK_MONOTONIC_COARSE
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
PATCH 4/32 vdso.7: Add y2038 compliant gettime for ppc/32
In reply to Alejandro ColomarChristophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html (2021-03-22)
In ppc32 functions section, the Y2038 compliant function __kernel_clock_gettime64() is missing.
It was added by commit d0e3fc69d00d
("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32") ]
.../linux$ git describe d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00d
--- man7/vdso.7 | 1 + 1 file changed, 1 insertion(+)
man7/vdso.7 +1 -0
@@ -371,6 +371,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 +__kernel_clock_gettime64 LINUX_5.10 __kernel_datapage_offset LINUX_2.6.15 __kernel_get_syscall_map LINUX_2.6.15 __kernel_get_tbfreq LINUX_2.6.15
Signature · 1 line
2.32.0
Re: [PATCH 04/32] vdso.7: Add y2038 compliant gettime for ppc/32
Hello Alex
Again, let us add the bug in the commit message:
https://bugzilla.kernel.org/show_bug.cgi?id=213421
I have not yet applied this. See below.
Quoted 26 lines · Alejandro Colomar
Christophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html (2021-03-22)In ppc32 functions section, the Y2038 compliant function
__kernel_clock_gettime64()is missing.It was added by commit
d0e3fc69d00d
("powerpc/vdso: Provide__kernel_clock_gettime64()on vdso32") ].../linux$ git describe
d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00dReported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man7/vdso.7 | 1 + 1 file changed, 1 insertion(+)man7/vdso.7 +0
-0
man7/vdso.7 symbol version · line 374
Quoted 4 lines
man7/vdso.7 +1
-0@@ -371,6 +371,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 +__kernel_clock_gettime64 LINUX_5.10
Is it really 5.10? By contrast, I see
$ git describe --contains d0e3fc69d00d v5.11-rc1~76^2~251
And indeed the symbol __kernel_clock_gettime64 does not seem to be present in the Linux 5.10 sources.
Cheers,
Michael
Quoted 4 lines
man7/vdso.7 +0
-0__kernel_datapage_offset LINUX_2.6.15 __kernel_get_syscall_map LINUX_2.6.15 __kernel_get_tbfreq LINUX_2.6.15
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 04/32] vdso.7: Add y2038 compliant gettime for ppc/32
Hello Michael,
Quoted 5 lines · Michael Kerrisk (man-pages)
Hello Alex
Again, let us add the bug in the commit message:
Sure.
Quoted 37 lines
I have not yet applied this. See below.
Quoted 26 lines · Alejandro Colomar
Christophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html (2021-03-22)In ppc32 functions section, the Y2038 compliant function
__kernel_clock_gettime64()is missing.It was added by commit
d0e3fc69d00d
("powerpc/vdso: Provide__kernel_clock_gettime64()on vdso32") ].../linux$ git describe
d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00dReported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man7/vdso.7 | 1 + 1 file changed, 1 insertion(+)man7/vdso.7 +0
-0man7/vdso.7 symbol version · line 374
Quoted 4 lines
man7/vdso.7 +1
-0@@ -371,6 +371,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 +__kernel_clock_gettime64 LINUX_5.10Is it really 5.10? By contrast, I see
Quoted 5 lines
$ git describe --contains d0e3fc69d00d v5.11-rc1~76^2~251And indeed the symbol
__kernel_clock_gettime64does not seem to be present in the Linux 5.10 sources.
It seems I was wrong. I forgot --contains!
It is 5.11.
Thanks,
Alex
Quoted 12 lines
Cheers,
Michael
Quoted 4 lines
man7/vdso.7 +0
-0__kernel_datapage_offset LINUX_2.6.15 __kernel_get_syscall_map LINUX_2.6.15 __kernel_get_tbfreq LINUX_2.6.15
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 04/32] vdso.7: Add y2038 compliant gettime for ppc/32
Hi Alex,
Quoted 48 lines · Alejandro Colomar (man-pages)
Hello Michael,
Quoted 5 lines · Michael Kerrisk (man-pages)
Hello Alex
Again, let us add the bug in the commit message:
Sure.
Quoted 37 lines
I have not yet applied this. See below.
Quoted 26 lines · Alejandro Colomar
Christophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html (2021-03-22)In ppc32 functions section, the Y2038 compliant function
__kernel_clock_gettime64()is missing.It was added by commit
d0e3fc69d00d
("powerpc/vdso: Provide__kernel_clock_gettime64()on vdso32") ].../linux$ git describe
d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00dReported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man7/vdso.7 | 1 + 1 file changed, 1 insertion(+)man7/vdso.7 +0
-0man7/vdso.7 symbol version · line 374
Quoted 4 lines
man7/vdso.7 +1
-0@@ -371,6 +371,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 +__kernel_clock_gettime64 LINUX_5.10Is it really 5.10? By contrast, I see
Quoted 8 lines
Quoted 5 lines
$ git describe --contains d0e3fc69d00d v5.11-rc1~76^2~251And indeed the symbol
__kernel_clock_gettime64does not seem to be present in the Linux 5.10 sources.It seems I was wrong. I forgot --contains!
It is 5.11.
Okay. I applied the patch below.
Cheers,
Michael
commit ae5cc0dc572116c9f4125a1de52e6c613e6659f3 (HEAD -> master)
Author: Michael Kerrisk <[email protected]> Date: Sun Aug 8 04:22:49 2021 +0200
vdso.7: Minor tweak to Alejandro Colomar's patch
The correct kernel version seems to 5.11, not 5.10:
$ git describe --contains d0e3fc69d00d
v5.11-rc1~76^2~251
man7/vdso.7 +1 -1
@@ -370,7 +370,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 -__kernel_clock_gettime64 LINUX_5.10 +__kernel_clock_gettime64 LINUX_5.11 __kernel_datapage_offset LINUX_2.6.15 __kernel_get_syscall_map LINUX_2.6.15 __kernel_get_tbfreq LINUX_2.6.15
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 04/32] vdso.7: Add y2038 compliant gettime for ppc/32
In reply to Alejandro ColomarHi Alex,
Quoted 12 lines · Alejandro Colomar
Christophe Leroy via Bugzilla:
[
https://man7.org/linux/man-pages/man7/vdso.7.html (2021-03-22)In ppc32 functions section, the Y2038 compliant function
__kernel_clock_gettime64()is missing.It was added by commit
d0e3fc69d00d
("powerpc/vdso: Provide__kernel_clock_gettime64()on vdso32") ]
Quoted 5 lines
.../linux$ git describe
d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00dReported-by Christophe Leroy <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Patch applied. But see the follow-up mail.
Thanks,
Michael
Quoted 17 lines
--- man7/vdso.7 | 1 + 1 file changed, 1 insertion(+)man7/vdso.7 +1
-0@@ -371,6 +371,7 @@ symbol version _ __kernel_clock_getres LINUX_2.6.15 __kernel_clock_gettime LINUX_2.6.15 +__kernel_clock_gettime64 LINUX_5.10 __kernel_datapage_offset LINUX_2.6.15 __kernel_get_syscall_map LINUX_2.6.15 __kernel_get_tbfreq LINUX_2.6.15
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 5/32 posixoptions.7: Fix legacy functions list (s/getcwd/getwd/)
In reply to Alejandro ColomarAlan:
[
The on-line copy of the manual page "posixoptions(7)" dated 2018-04-30 has an entry for "getcwd()" in the section headed "XSI - _XOPEN_LEGACY - _SC_XOPEN_LEGACY".
I believe that entry should be "getwd()" as that is the API call which was present in X/Open-6 but withdrawn in X/Open-7. ]
--- man7/posixoptions.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man7/posixoptions.7 +1 -1
@@ -968,7 +968,7 @@ The following functions are present: .IR fcvt () .IR ftime () .IR gcvt () -.IR getcwd () +.IR getwd () .IR index () .IR mktemp () .IR rindex ()
Signature · 1 line
2.32.0
Re: [PATCH 05/32] posixoptions.7: Fix legacy functions list (s/getcwd/getwd/)
Hello Alan, Alex,
Quoted 10 lines · Alejandro Colomar
Alan:
[
The on-line copy of the manual page "posixoptions(7)" dated 2018-04-30 has an entry for "getcwd()" in the section headed "XSI -_XOPEN_LEGACY-_SC_XOPEN_LEGACY".
I believe that entry should be "getwd()" as that is the API call which was present in X/Open-6 but withdrawn in X/Open-7. ]
Quoted 2 lines
Reported-by Alan Peakall <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man7/posixoptions.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man7/posixoptions.7 +1
-1@@ -968,7 +968,7 @@ The following functions are present: .IR fcvt () .IR ftime () .IR gcvt () -.IR getcwd () +.IR getwd () .IR index () .IR mktemp () .IR rindex ()
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 6/32 man2/fallocate.2: tfix documentation of shared blocks
In reply to Alejandro ColomarFrom: Dan Robertson <[email protected]>
Fix a typo in the documentation of using fallocate to allocate shared blocks. The flag FALLOC_FL_UNSHARE should instead be documented as FALLOC_FL_UNSHARE_RANGE.
--- man2/fallocate.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/fallocate.2 +1 -1
@@ -81,7 +81,7 @@ Preallocating zeroed blocks beyond the end of the file in this manner is useful for optimizing append workloads. .PP If the -.B FALLOC_FL_UNSHARE +.B FALLOC_FL_UNSHARE_RANGE flag is specified in .IR mode , shared file data extents will be made private to the file to guarantee
Signature · 1 line
2.32.0
Re: [PATCH 06/32] man2/fallocate.2: tfix documentation of shared blocks
Hello Dan, Alex,
Quoted 10 lines · Alejandro Colomar
From: Dan Robertson <[email protected]>
Fix a typo in the documentation of using fallocate to allocate shared blocks. The flag
FALLOC_FL_UNSHAREshould instead be documented asFALLOC_FL_UNSHARE_RANGE.Fixes 63a599c657d8 ("man2/fallocate.2: Document behavior with shared blocks")Signed-off-by Dan Robertson <[email protected]>Reviewed-by Darrick J. Wong <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man2/fallocate.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/fallocate.2 +1
-1@@ -81,7 +81,7 @@ Preallocating zeroed blocks beyond the end of the file in this manner is useful for optimizing append workloads. .PP If the -.B FALLOC_FL_UNSHARE +.B FALLOC_FL_UNSHARE_RANGE flag is specified in .IR mode , shared file data extents will be made private to the file to guarantee
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 7/32 printf.3: wfix
In reply to Alejandro Colomar--- man3/printf.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man3/printf.3 +1 -1
@@ -115,7 +115,7 @@ is the same as except that it outputs to a file descriptor, .IR fd , instead of to a -.I stdio +.I FILE stream. .PP The functions
Signature · 1 line
2.32.0
Re: [PATCH 07/32] printf.3: wfix
Hello Alex and Sergey,
Quoted 11 lines · Alejandro Colomar
Reported-by Sergey Petrakov <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/printf.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man3/printf.3 +0
-0
man3/printf.3 is the same as · line 121
Quoted 8 lines
man3/printf.3 +1
-1@@ -115,7 +115,7 @@ is the same as except that it outputs to a file descriptor, .IR fd , instead of to a -.I stdio +.I FILE stream. .PP The functions
Why this change? What is wrong with the existing text?
Thanks,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 07/32] printf.3: wfix
Hi Michael,
Quoted 9 lines · Michael Kerrisk (man-pages)
Hello Alex and Sergey,
Quoted 6 lines · Alejandro Colomar
Reported-by Sergey Petrakov <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/printf.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
man3/printf.3 is the same as · line 121
Quoted 13 lines
man3/printf.3 +1
-1@@ -115,7 +115,7 @@ is the same as except that it outputs to a file descriptor, .IR fd , instead of to a -.I stdio +.I FILE stream. .PP The functionsWhy this change? What is wrong with the existing text?
I seem to remember that my thoughts when I saw the report were:
stdio is marked in italics, which usually would mean a type (by the context), but it's not a type, so probably the author meant FILE and wrote stdio as a typo. But it could also be that the author meant '.BR stdio (7)', and it's only a ffix.
What do you think?
Thanks,
Alex
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 07/32] printf.3: wfix
Quoted 1 line · Alejandro Colomar (man-pages)
stdio (7)', and it's only a ffix.
s/7/3/
Re: [PATCH 07/32] printf.3: wfix
Hello Alex,
Quoted 6 lines · Alejandro Colomar (man-pages)
Quoted 1 line · Alejandro Colomar (man-pages)
stdio (7)', and it's only a ffix.
s/7/3/
I dropped the original patch, and made ir
.BR stdio (3)
This is a case where it would have been good to ask the proposer for a commit message explaining the motivation for the original patch (when that patch was submitted).
Cheers,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 07/32] printf.3: wfix
Hello Michael and Alex,
Quoted 10 lines · Michael Kerrisk (man-pages)
Hello Alex,
Quoted 5 lines · Alejandro Colomar (man-pages)
Quoted 1 line · Alejandro Colomar (man-pages)
stdio (7)', and it's only a ffix.
s/7/3/
Quoted 7 lines
I dropped the original patch, and made ir
.BR stdio (3)
This is a case where it would have been good to ask the proposer for a commit message explaining the motivation for the original patch (when that patch was submitted).
A few paragraphs at the beginning of the description section of printf(3) briefly describe the functions in the printf() family. In these paragraphs, a word in italics almost always represents a token of C source code:
1) the identifier (format, stream, str, fd, size, ap) or the type (va_list) of a parameter in the function declarations at the top of the man page;
2) the identifier (va_end, va_arg) for a function-like macro;
3) the identifier (stdout) for the standard output stream.
There is one exception to this rule - stdio. This word represents a library, not a token. It's not a big problem, of course, but I think that similar formatting of different things may be confusing.
The original patch was an attempt to fix this issue. The final one (by Michael Kerrisk):
-.I stdio
+.BR stdio (3)
is a more suitable solution.
I'm sorry that I didn't include this explanation in the initial email.
--
Regards,
Sergey Petrakov
Re: [PATCH 07/32] printf.3: wfix
Hello Sergey,
[...]
Quoted 2 lines
I'm sorry that I didn't include this explanation in the initial email.
No problem. We're all learning...
Cheers,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 8/32 Various pages: Consistently use '*argv[]'
In reply to Alejandro ColomarFrom: Thomas Voss <[email protected]>
Scripted change:
$ find man? -type f \ | sed -i 's/int argc, char \*\*argv/int argc, char \*argv\[\]/';
--- man2/bpf.2 | 2 +- man2/copy_file_range.2 | 2 +- man2/membarrier.2 | 4 ++-- man2/perf_event_open.2 | 2 +- man2/seccomp.2 | 2 +- man3/bsearch.3 | 2 +- man3/getopt.3 | 2 +- man3/getsubopt.3 | 2 +- man3/pthread_setname_np.3 | 2 +- man3/wordexp.3 | 2 +- man7/fanotify.7 | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-)
man2/bpf.2 +1 -1
@@ -1212,7 +1212,7 @@ riscv (since Linux 5.1). * 4. print number of received TCP/UDP packets every second */ int -main(int argc, char **argv) +main(int argc, char *argv[]) { int sock, map_fd, prog_fd, key; long long value = 0, tcp_cnt, udp_cnt;
man2/copy_file_range.2 +1 -1
@@ -236,7 +236,7 @@ or server-side-copy (in the case of NFS). #include <unistd.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { int fd_in, fd_out; struct stat stat;
man2/membarrier.2 +2 -2
@@ -358,7 +358,7 @@ slow_path(int *read_a) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { int read_a, read_b;
@@ -444,7 +444,7 @@ slow_path(int *read_a) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { int read_a, read_b;
man2/perf_event_open.2 +1 -1
@@ -3762,7 +3762,7 @@ perf_event_open(struct perf_event_attr *hw_event, pid_t pid, } int -main(int argc, char **argv) +main(int argc, char *argv[]) { struct perf_event_attr pe; long long count;
man2/seccomp.2 +1 -1
@@ -1199,7 +1199,7 @@ install_filter(int syscall_nr, int t_arch, int f_errno) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { if (argc < 5) { fprintf(stderr, "Usage: "
man3/bsearch.3 +1 -1
@@ -124,7 +124,7 @@ compmi(const void *m1, const void *m2) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { qsort(months, nr_of_months, sizeof(months[0]), compmi); for (int i = 1; i < argc; i++) {
man3/getopt.3 +1 -1
@@ -491,7 +491,7 @@ with most of its features. #include <getopt.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { int c; int digit_optind = 0;
man3/getsubopt.3 +1 -1
@@ -160,7 +160,7 @@ The following program expects suboptions following a "\-o" option. #include <stdio.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { enum { RO_OPT = 0,
man3/pthread_setname_np.3 +1 -1
@@ -180,7 +180,7 @@ threadfunc(void *parm) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { pthread_t thread; int rc;
man3/wordexp.3 +1 -1
@@ -240,7 +240,7 @@ is approximately that of "ls [a-c]*.c". #include <wordexp.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { wordexp_t p; char **w;
man7/fanotify.7 +1 -1
@@ -1069,7 +1069,7 @@ $ \fBmkdir \-p /home/user/testdir\fP # In another terminal #define BUF_SIZE 256 int -main(int argc, char **argv) +main(int argc, char *argv[]) { int fd, ret, event_fd, mount_fd; ssize_t len, path_len;
Signature · 1 line
2.32.0
Re: [PATCH 08/32] Various pages: Consistently use '*argv[]'
Hi Alex, Thomas,
Quoted 9 lines · Alejandro Colomar
From: Thomas Voss <[email protected]>
Scripted change:
$ find man? -type f \ | sed -i 's/int argc, char \*\*argv/int argc, char \*argv\[\]/';Signed-off-by Thomas Voss <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Applied.
Cheers,
Michael
Quoted 167 lines
--- man2/bpf.2 | 2 +- man2/copy_file_range.2 | 2 +- man2/membarrier.2 | 4 ++-- man2/perf_event_open.2 | 2 +- man2/seccomp.2 | 2 +- man3/bsearch.3 | 2 +- man3/getopt.3 | 2 +- man3/getsubopt.3 | 2 +- man3/pthread_setname_np.3 | 2 +- man3/wordexp.3 | 2 +- man7/fanotify.7 | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-)man2/bpf.2 +1
-1@@ -1212,7 +1212,7 @@ riscv (since Linux 5.1). * 4. print number of received TCP/UDP packets every second */ int -main(int argc, char **argv) +main(int argc, char *argv[]) { int sock, map_fd, prog_fd, key; long long value = 0, tcp_cnt, udp_cnt;man2/copy_file_range.2 +1
-1@@ -236,7 +236,7 @@ or server-side-copy (in the case of NFS). #include <unistd.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { int fd_in, fd_out; struct stat stat;man2/membarrier.2 +2
-2@@ -358,7 +358,7 @@ slow_path(int *read_a) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { int read_a, read_b;@@ -444,7 +444,7 @@ slow_path(int *read_a) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { int read_a, read_b;man2/perf_event_open.2 +1
-1@@ -3762,7 +3762,7 @@ perf_event_open(struct perf_event_attr *hw_event, pid_t pid, } int -main(int argc, char **argv) +main(int argc, char *argv[]) { struct perf_event_attr pe; long long count;man2/seccomp.2 +1
-1@@ -1199,7 +1199,7 @@ install_filter(int syscall_nr, int t_arch, int f_errno) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { if (argc < 5) { fprintf(stderr, "Usage: "man3/bsearch.3 +1
-1@@ -124,7 +124,7 @@ compmi(const void *m1, const void *m2) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { qsort(months, nr_of_months, sizeof(months[0]), compmi); for (int i = 1; i < argc; i++) {man3/getopt.3 +1
-1@@ -491,7 +491,7 @@ with most of its features. #include <getopt.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { int c; int digit_optind = 0;man3/getsubopt.3 +1
-1@@ -160,7 +160,7 @@ The following program expects suboptions following a "\-o" option. #include <stdio.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { enum { RO_OPT = 0,man3/pthread_setname_np.3 +1
-1@@ -180,7 +180,7 @@ threadfunc(void *parm) } int -main(int argc, char **argv) +main(int argc, char *argv[]) { pthread_t thread; int rc;man3/wordexp.3 +1
-1@@ -240,7 +240,7 @@ is approximately that of "ls [a-c]*.c". #include <wordexp.h> int -main(int argc, char **argv) +main(int argc, char *argv[]) { wordexp_t p; char **w;man7/fanotify.7 +1
-1@@ -1069,7 +1069,7 @@ $ \fBmkdir \-p /home/user/testdir\fP # In another terminal #define BUF_SIZE 256 int -main(int argc, char **argv) +main(int argc, char *argv[]) { int fd, ret, event_fd, mount_fd; ssize_t len, path_len;
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 9/32 path_resolution.7: tfix
In reply to Alejandro ColomarFrom: Štěpán Němec <[email protected]>
--- man7/path_resolution.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man7/path_resolution.7 +1 -1
@@ -63,7 +63,7 @@ argument). The current working directory is inherited from the parent, and can be changed by use of the .BR chdir (2) -system call.) +system call. .PP Pathnames starting with a \(aq/\(aq character are called absolute pathnames. Pathnames not starting with a \(aq/\(aq are called relative pathnames.
Signature · 1 line
2.32.0
Re: [PATCH 09/32] path_resolution.7: tfix
Hello Alex, Štěpán,
Quoted 4 lines · Alejandro Colomar
From: Štěpán Němec <[email protected]>
Signed-off-by Štěpán Němec <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man7/path_resolution.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man7/path_resolution.7 +1
-1@@ -63,7 +63,7 @@ argument). The current working directory is inherited from the parent, and can be changed by use of the .BR chdir (2) -system call.) +system call. .PP Pathnames starting with a \(aq/\(aq character are called absolute pathnames. Pathnames not starting with a \(aq/\(aq are called relative pathnames.
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 10/32 futex.2: Document FUTEX_LOCK_PI2
In reply to Alejandro ColomarFrom: Kurt Kanzenbach <[email protected]>
FUTEX_LOCK_PI2 is a new futex operation which was recently introduced into the Linux kernel. It works exactly like FUTEX_LOCK_PI. However, it has support for selectable clocks for timeouts. By default CLOCK_MONOTONIC is used. If FUTEX_CLOCK_REALTIME is specified then the timeout is measured against CLOCK_REALTIME.
This new operation addresses an inconsistency in the futex interface:FUTEX_LOCK_PI only works with timeouts based on CLOCK_REALTIME in contrast to all the other PI operations.
Document the FUTEX_LOCK_PI2 command.
--- man2/futex.2 | 53 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-)
man2/futex.2 +49 -4
@@ -241,10 +241,13 @@ and so on. This option bit can be employed only with the .BR FUTEX_WAIT_BITSET , .BR FUTEX_WAIT_REQUEUE_PI , -and (since Linux 4.5) .\" commit 337f13046ff03717a9e99675284a817527440a49 -.BR FUTEX_WAIT +.BR FUTEX_WAIT , +and +(since Linux v5.14.0) +.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae +.BR FUTEX_LOCK_PI2 operations. .IP If this option is set, the kernel measures the
@@ -904,7 +907,9 @@ value to 0 if the previous value was the expected TID. If a futex is already acquired (i.e., has a nonzero value), waiters must employ the .B FUTEX_LOCK_PI -operation to acquire the lock. +or +.B FUTEX_LOCK_PI2 +operations to acquire the lock. If other threads are waiting for the lock, then the .B FUTEX_WAITERS bit is set in the futex value;
@@ -964,6 +969,8 @@ Note that the PI futex operations must be used as paired operations and are subject to some additional requirements: .IP * 3 .B FUTEX_LOCK_PI +, +.B FUTEX_LOCK_PI2 and .B FUTEX_TRYLOCK_PI pair with
@@ -1122,6 +1129,27 @@ arguments are ignored. .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\" .TP +.BR FUTEX_LOCK_PI2 " (since Linux 5.14.0)" +.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae +This operation works similar like +.BR FUTEX_LOCK_PI . +The only difference is the +timeout argument. +.BR FUTEX_LOCK_PI2 +has support for selectable clocks. +.IP +If +.I timeout +is not NULL, the structure it points to specifies +an absolute timeout. +If +.I timeout +is NULL, the operation can block indefinitely. +.IP +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.TP .BR FUTEX_TRYLOCK_PI " (since Linux 2.6.18)" .\" commit c87e2837be82df479a6bae9f155c43516d2feebc This operation tries to acquire the lock at
@@ -1168,6 +1196,8 @@ arguments are ignored. .\" commit c87e2837be82df479a6bae9f155c43516d2feebc This operation wakes the top priority waiter that is waiting in .B FUTEX_LOCK_PI +or +.B FUTEX_LOCK_PI2 on the futex address provided by the .I uaddr argument.
@@ -1379,6 +1409,9 @@ Returns the number of waiters that were woken up. .B FUTEX_LOCK_PI Returns 0 if the futex was successfully locked. .TP +.B FUTEX_LOCK_PI2 +Returns 0 if the futex was successfully locked. +.TP .B FUTEX_TRYLOCK_PI Returns 0 if the futex was successfully locked. .TP
@@ -1435,6 +1468,7 @@ is not equal to the expected value .TP .BR EAGAIN .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The futex owner thread ID of
@@ -1448,6 +1482,7 @@ Try again. .TP .BR EDEADLK .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The futex word at
@@ -1536,11 +1571,14 @@ The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state\(emthat is, it detected a waiter which waits in .BR FUTEX_LOCK_PI +or +.BR FUTEX_LOCK_PI2 on .IR uaddr . .TP .B EINVAL .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_UNLOCK_PI ) The kernel detected an inconsistency between the user-space state at
@@ -1590,6 +1628,8 @@ that is, the kernel detected a waiter which waits on .I uaddr via .BR FUTEX_LOCK_PI +or +.BR FUTEX_LOCK_PI2 (instead of .BR FUTEX_WAIT_REQUEUE_PI ). .TP
@@ -1618,6 +1658,7 @@ The system-wide limit on the total number of open files has been reached. .TP .BR ENOMEM .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The kernel could not allocate memory to hold state information.
@@ -1634,11 +1675,13 @@ option was specified in but the accompanying operation was neither .BR FUTEX_WAIT , .BR FUTEX_WAIT_BITSET , +.BR FUTEX_WAIT_REQUEUE_PI , nor -.BR FUTEX_WAIT_REQUEUE_PI . +.BR FUTEX_LOCK_PI2 . .TP .BR ENOSYS .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_UNLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ,
@@ -1649,6 +1692,7 @@ are not supported on some CPU variants. .TP .BR EPERM .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The caller is not allowed to attach itself to the futex at
@@ -1665,6 +1709,7 @@ The caller does not own the lock represented by the futex word. .TP .BR ESRCH .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The thread ID in the futex word at
Signature · 1 line
2.32.0
Re: [PATCH 10/32] futex.2: Document FUTEX_LOCK_PI2
Hi Michael,
Quoted 8 lines · Alejandro Colomar
From: Kurt Kanzenbach <[email protected]>
FUTEX_LOCK_PI2is a new futex operation which was recently introduced into the Linux kernel. It works exactly likeFUTEX_LOCK_PI. However, it has support for selectable clocks for timeouts. By defaultCLOCK_MONOTONICis used. IfFUTEX_CLOCK_REALTIMEis specified then the timeout is measured againstCLOCK_REALTIME.
Quoted 7 lines
This new operation addresses an inconsistency in the futex interface:
FUTEX_LOCK_PIonly works with timeouts based onCLOCK_REALTIMEin contrast to all the other PI operations.Document the
FUTEX_LOCK_PI2command.Signed-off-by Kurt Kanzenbach <[email protected]>
Please drop this one. I just found a small typo, and will add a Reviewed-by line received today.
Thanks,
Alex
Quoted 171 lines
--- man2/futex.2 | 53 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-)man2/futex.2 +49
-4@@ -241,10 +241,13 @@ and so on. This option bit can be employed only with the .BR FUTEX_WAIT_BITSET , .BR FUTEX_WAIT_REQUEUE_PI , -and (since Linux 4.5) .\" commit 337f13046ff03717a9e99675284a817527440a49 -.BR FUTEX_WAIT +.BR FUTEX_WAIT , +and +(since Linux v5.14.0) +.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae +.BR FUTEX_LOCK_PI2 operations. .IP If this option is set, the kernel measures the@@ -904,7 +907,9 @@ value to 0 if the previous value was the expected TID. If a futex is already acquired (i.e., has a nonzero value), waiters must employ the .B FUTEX_LOCK_PI -operation to acquire the lock. +or +.B FUTEX_LOCK_PI2 +operations to acquire the lock. If other threads are waiting for the lock, then the .B FUTEX_WAITERS bit is set in the futex value;@@ -964,6 +969,8 @@ Note that the PI futex operations must be used as paired operations and are subject to some additional requirements: .IP * 3 .B FUTEX_LOCK_PI +, +.B FUTEX_LOCK_PI2 and .B FUTEX_TRYLOCK_PI pair with@@ -1122,6 +1129,27 @@ arguments are ignored. .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\" .TP +.BR FUTEX_LOCK_PI2 " (since Linux 5.14.0)" +.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae +This operation works similar like +.BR FUTEX_LOCK_PI . +The only difference is the +timeout argument. +.BR FUTEX_LOCK_PI2 +has support for selectable clocks. +.IP +If +.I timeout +is not NULL, the structure it points to specifies +an absolute timeout. +If +.I timeout +is NULL, the operation can block indefinitely. +.IP +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.TP .BR FUTEX_TRYLOCK_PI " (since Linux 2.6.18)" .\" commit c87e2837be82df479a6bae9f155c43516d2feebc This operation tries to acquire the lock at@@ -1168,6 +1196,8 @@ arguments are ignored. .\" commit c87e2837be82df479a6bae9f155c43516d2feebc This operation wakes the top priority waiter that is waiting in .B FUTEX_LOCK_PI +or +.B FUTEX_LOCK_PI2 on the futex address provided by the .I uaddr argument.@@ -1379,6 +1409,9 @@ Returns the number of waiters that were woken up. .B FUTEX_LOCK_PI Returns 0 if the futex was successfully locked. .TP +.B FUTEX_LOCK_PI2 +Returns 0 if the futex was successfully locked. +.TP .B FUTEX_TRYLOCK_PI Returns 0 if the futex was successfully locked. .TP@@ -1435,6 +1468,7 @@ is not equal to the expected value .TP .BR EAGAIN .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The futex owner thread ID of@@ -1448,6 +1482,7 @@ Try again. .TP .BR EDEADLK .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The futex word at@@ -1536,11 +1571,14 @@ The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state\(emthat is, it detected a waiter which waits in .BR FUTEX_LOCK_PI +or +.BR FUTEX_LOCK_PI2 on .IR uaddr . .TP .B EINVAL .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_UNLOCK_PI ) The kernel detected an inconsistency between the user-space state at@@ -1590,6 +1628,8 @@ that is, the kernel detected a waiter which waits on .I uaddr via .BR FUTEX_LOCK_PI +or +.BR FUTEX_LOCK_PI2 (instead of .BR FUTEX_WAIT_REQUEUE_PI ). .TP@@ -1618,6 +1658,7 @@ The system-wide limit on the total number of open files has been reached. .TP .BR ENOMEM .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The kernel could not allocate memory to hold state information.@@ -1634,11 +1675,13 @@ option was specified in but the accompanying operation was neither .BR FUTEX_WAIT , .BR FUTEX_WAIT_BITSET , +.BR FUTEX_WAIT_REQUEUE_PI , nor -.BR FUTEX_WAIT_REQUEUE_PI . +.BR FUTEX_LOCK_PI2 . .TP .BR ENOSYS .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_UNLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ,@@ -1649,6 +1692,7 @@ are not supported on some CPU variants. .TP .BR EPERM .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The caller is not allowed to attach itself to the futex at@@ -1665,6 +1709,7 @@ The caller does not own the lock represented by the futex word. .TP .BR ESRCH .RB ( FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI , .BR FUTEX_CMP_REQUEUE_PI ) The thread ID in the futex word at
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 10/32] futex.2: Document FUTEX_LOCK_PI2
Quoted 15 lines · Alejandro Colomar (man-pages)
Hi Michael,
Quoted 12 lines · Alejandro Colomar
From: Kurt Kanzenbach <[email protected]>
FUTEX_LOCK_PI2is a new futex operation which was recently introduced into the Linux kernel. It works exactly likeFUTEX_LOCK_PI. However, it has support for selectable clocks for timeouts. By defaultCLOCK_MONOTONICis used. IfFUTEX_CLOCK_REALTIMEis specified then the timeout is measured againstCLOCK_REALTIME.This new operation addresses an inconsistency in the futex interface:
FUTEX_LOCK_PIonly works with timeouts based onCLOCK_REALTIMEin contrast to all the other PI operations.
Quoted 6 lines
Quoted 3 lines
Document the
FUTEX_LOCK_PI2command.Signed-off-by Kurt Kanzenbach <[email protected]>Please drop this one. I just found a small typo, and will add a Reviewed-by line received today.
Dropped.
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 11/32 futex.2: Minor tweaks to Kurt's patch
In reply to Alejandro Colomar--- man2/futex.2 | 69 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-)
man2/futex.2 +34 -35
@@ -222,9 +222,9 @@ This allows the kernel to make some additional performance optimizations. .\" taking reference counts on file backing store, and so on. .IP As a convenience, -.IR <linux/futex.h> +.I <linux/futex.h> defines a set of constants with the suffix -.BR _PRIVATE +.B _PRIVATE that are equivalents of all of the operations listed below, .\" except the obsolete FUTEX_FD, for which the "private" flag was .\" meaningless
@@ -247,19 +247,19 @@ This option bit can be employed only with the and (since Linux v5.14.0) .\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 operations. .IP If this option is set, the kernel measures the .I timeout against the -.BR CLOCK_REALTIME +.B CLOCK_REALTIME clock. .IP If this option is not set, the kernel measures the .I timeout against the -.BR CLOCK_MONOTONIC +.B CLOCK_MONOTONIC clock. .PP The operation specified in
@@ -968,9 +968,8 @@ PI futexes are operated on by specifying one of the values listed below in Note that the PI futex operations must be used as paired operations and are subject to some additional requirements: .IP * 3 -.B FUTEX_LOCK_PI -, -.B FUTEX_LOCK_PI2 +.BR FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , and .B FUTEX_TRYLOCK_PI pair with
@@ -1123,7 +1122,7 @@ The .IR uaddr2 , .IR val , and -.IR val3 +.I val3 arguments are ignored. .\" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -1135,7 +1134,7 @@ This operation works similar like .BR FUTEX_LOCK_PI . The only difference is the timeout argument. -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 has support for selectable clocks. .IP If
@@ -1466,7 +1465,7 @@ The value pointed to by is not equal to the expected value .IR val3 . .TP -.BR EAGAIN +.B EAGAIN .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1480,7 +1479,7 @@ is about to exit, but has not yet handled the internal state cleanup. Try again. .TP -.BR EDEADLK +.B EDEADLK .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1522,18 +1521,18 @@ a spurious wakeup; since Linux 2.6.22, this no longer happens. .TP .B EINVAL The operation in -.IR futex_op +.I futex_op is one of those that employs a timeout, but the supplied .I timeout argument was invalid .RI ( tv_sec was less than zero, or -.IR tv_nsec +.I tv_nsec was not less than 1,000,000,000). .TP .B EINVAL The operation specified in -.IR futex_op +.I futex_op employs one or both of the pointers .I uaddr and
@@ -1545,17 +1544,17 @@ the address is not four-byte-aligned. .RB ( FUTEX_WAIT_BITSET , .BR FUTEX_WAKE_BITSET ) The bit mask supplied in -.IR val3 +.I val3 is zero. .TP .B EINVAL .RB ( FUTEX_CMP_REQUEUE_PI ) .I uaddr equals -.IR uaddr2 +.I uaddr2 (i.e., an attempt was made to requeue to the same futex). .TP -.BR EINVAL +.B EINVAL .RB ( FUTEX_FD ) The signal number supplied in .I val
@@ -1570,9 +1569,9 @@ is invalid. The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state\(emthat is, it detected a waiter which waits in -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 on .IR uaddr . .TP
@@ -1588,7 +1587,7 @@ This indicates either state corruption or that the kernel found a waiter on .I uaddr which is waiting via -.BR FUTEX_WAIT +.B FUTEX_WAIT or .BR FUTEX_WAIT_BITSET . .TP
@@ -1601,9 +1600,9 @@ and the kernel state; .\" The kernel sees: I have non PI state for a futex you tried to .\" tell me was PI that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr2 . .TP
@@ -1613,9 +1612,9 @@ The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state; that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr . .TP
@@ -1627,9 +1626,9 @@ and the kernel state; that is, the kernel detected a waiter which waits on .I uaddr via -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 (instead of .BR FUTEX_WAIT_REQUEUE_PI ). .TP
@@ -1656,7 +1655,7 @@ Invalid argument. .RB ( FUTEX_FD ) The system-wide limit on the total number of open files has been reached. .TP -.BR ENOMEM +.B ENOMEM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1669,7 +1668,7 @@ Invalid operation specified in .TP .B ENOSYS The -.BR FUTEX_CLOCK_REALTIME +.B FUTEX_CLOCK_REALTIME option was specified in .IR futex_op , but the accompanying operation was neither
@@ -1679,7 +1678,7 @@ but the accompanying operation was neither nor .BR FUTEX_LOCK_PI2 . .TP -.BR ENOSYS +.B ENOSYS .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1690,7 +1689,7 @@ A run-time check determined that the operation is not available. The PI-futex operations are not implemented on all architectures and are not supported on some CPU variants. .TP -.BR EPERM +.B EPERM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1703,11 +1702,11 @@ the futex at .IR uaddr2 ). (This may be caused by a state corruption in user space.) .TP -.BR EPERM +.B EPERM .RB ( FUTEX_UNLOCK_PI ) The caller does not own the lock represented by the futex word. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,
@@ -1716,7 +1715,7 @@ The thread ID in the futex word at .I uaddr does not exist. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_CMP_REQUEUE_PI ) The thread ID in the futex word at .I uaddr2
@@ -1724,7 +1723,7 @@ does not exist. .TP .B ETIMEDOUT The operation in -.IR futex_op +.I futex_op employed the timeout specified in .IR timeout , and the timeout expired before the operation completed.
Signature · 1 line
2.32.0
Re: [PATCH 11/32] futex.2: Minor tweaks to Kurt's patch
Quoted 1 line · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>
Drop this one too.
Quoted 260 lines
--- man2/futex.2 | 69 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-)man2/futex.2 +34
-35@@ -222,9 +222,9 @@ This allows the kernel to make some additional performance optimizations. .\" taking reference counts on file backing store, and so on. .IP As a convenience, -.IR <linux/futex.h> +.I <linux/futex.h> defines a set of constants with the suffix -.BR _PRIVATE +.B _PRIVATE that are equivalents of all of the operations listed below, .\" except the obsolete FUTEX_FD, for which the "private" flag was .\" meaningless@@ -247,19 +247,19 @@ This option bit can be employed only with the and (since Linux v5.14.0) .\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 operations. .IP If this option is set, the kernel measures the .I timeout against the -.BR CLOCK_REALTIME +.B CLOCK_REALTIME clock. .IP If this option is not set, the kernel measures the .I timeout against the -.BR CLOCK_MONOTONIC +.B CLOCK_MONOTONIC clock. .PP The operation specified in@@ -968,9 +968,8 @@ PI futexes are operated on by specifying one of the values listed below in Note that the PI futex operations must be used as paired operations and are subject to some additional requirements: .IP * 3 -.B FUTEX_LOCK_PI -, -.B FUTEX_LOCK_PI2 +.BR FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , and .B FUTEX_TRYLOCK_PI pair with@@ -1123,7 +1122,7 @@ The .IR uaddr2 , .IR val , and -.IR val3 +.I val3 arguments are ignored. .\" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""@@ -1135,7 +1134,7 @@ This operation works similar like .BR FUTEX_LOCK_PI . The only difference is the timeout argument. -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 has support for selectable clocks. .IP If@@ -1466,7 +1465,7 @@ The value pointed to by is not equal to the expected value .IR val3 . .TP -.BR EAGAIN +.B EAGAIN .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1480,7 +1479,7 @@ is about to exit, but has not yet handled the internal state cleanup. Try again. .TP -.BR EDEADLK +.B EDEADLK .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1522,18 +1521,18 @@ a spurious wakeup; since Linux 2.6.22, this no longer happens. .TP .B EINVAL The operation in -.IR futex_op +.I futex_op is one of those that employs a timeout, but the supplied .I timeout argument was invalid .RI ( tv_sec was less than zero, or -.IR tv_nsec +.I tv_nsec was not less than 1,000,000,000). .TP .B EINVAL The operation specified in -.IR futex_op +.I futex_op employs one or both of the pointers .I uaddr and@@ -1545,17 +1544,17 @@ the address is not four-byte-aligned. .RB ( FUTEX_WAIT_BITSET , .BR FUTEX_WAKE_BITSET ) The bit mask supplied in -.IR val3 +.I val3 is zero. .TP .B EINVAL .RB ( FUTEX_CMP_REQUEUE_PI ) .I uaddr equals -.IR uaddr2 +.I uaddr2 (i.e., an attempt was made to requeue to the same futex). .TP -.BR EINVAL +.B EINVAL .RB ( FUTEX_FD ) The signal number supplied in .I val@@ -1570,9 +1569,9 @@ is invalid. The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state\(emthat is, it detected a waiter which waits in -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 on .IR uaddr . .TP@@ -1588,7 +1587,7 @@ This indicates either state corruption or that the kernel found a waiter on .I uaddr which is waiting via -.BR FUTEX_WAIT +.B FUTEX_WAIT or .BR FUTEX_WAIT_BITSET . .TP@@ -1601,9 +1600,9 @@ and the kernel state; .\" The kernel sees: I have non PI state for a futex you tried to .\" tell me was PI that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr2 . .TP@@ -1613,9 +1612,9 @@ The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state; that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr . .TP@@ -1627,9 +1626,9 @@ and the kernel state; that is, the kernel detected a waiter which waits on .I uaddr via -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 (instead of .BR FUTEX_WAIT_REQUEUE_PI ). .TP@@ -1656,7 +1655,7 @@ Invalid argument. .RB ( FUTEX_FD ) The system-wide limit on the total number of open files has been reached. .TP -.BR ENOMEM +.B ENOMEM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1669,7 +1668,7 @@ Invalid operation specified in .TP .B ENOSYS The -.BR FUTEX_CLOCK_REALTIME +.B FUTEX_CLOCK_REALTIME option was specified in .IR futex_op , but the accompanying operation was neither@@ -1679,7 +1678,7 @@ but the accompanying operation was neither nor .BR FUTEX_LOCK_PI2 . .TP -.BR ENOSYS +.B ENOSYS .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1690,7 +1689,7 @@ A run-time check determined that the operation is not available. The PI-futex operations are not implemented on all architectures and are not supported on some CPU variants. .TP -.BR EPERM +.B EPERM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1703,11 +1702,11 @@ the futex at .IR uaddr2 ). (This may be caused by a state corruption in user space.) .TP -.BR EPERM +.B EPERM .RB ( FUTEX_UNLOCK_PI ) The caller does not own the lock represented by the futex word. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1716,7 +1715,7 @@ The thread ID in the futex word at .I uaddr does not exist. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_CMP_REQUEUE_PI ) The thread ID in the futex word at .I uaddr2@@ -1724,7 +1723,7 @@ does not exist. .TP .B ETIMEDOUT The operation in -.IR futex_op +.I futex_op employed the timeout specified in .IR timeout , and the timeout expired before the operation completed.
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 11/32] futex.2: Minor tweaks to Kurt's patch
Quoted 4 lines · Alejandro Colomar (man-pages)
Quoted 1 line · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>Drop this one too.
Dropped.
Thanks,
Michael
Quoted 263 lines
Quoted 261 lines
--- man2/futex.2 | 69 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 35 deletions(-)man2/futex.2 +34
-35@@ -222,9 +222,9 @@ This allows the kernel to make some additional performance optimizations. .\" taking reference counts on file backing store, and so on. .IP As a convenience, -.IR <linux/futex.h> +.I <linux/futex.h> defines a set of constants with the suffix -.BR _PRIVATE +.B _PRIVATE that are equivalents of all of the operations listed below, .\" except the obsolete FUTEX_FD, for which the "private" flag was .\" meaningless@@ -247,19 +247,19 @@ This option bit can be employed only with the and (since Linux v5.14.0) .\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 operations. .IP If this option is set, the kernel measures the .I timeout against the -.BR CLOCK_REALTIME +.B CLOCK_REALTIME clock. .IP If this option is not set, the kernel measures the .I timeout against the -.BR CLOCK_MONOTONIC +.B CLOCK_MONOTONIC clock. .PP The operation specified in@@ -968,9 +968,8 @@ PI futexes are operated on by specifying one of the values listed below in Note that the PI futex operations must be used as paired operations and are subject to some additional requirements: .IP * 3 -.B FUTEX_LOCK_PI -, -.B FUTEX_LOCK_PI2 +.BR FUTEX_LOCK_PI , +.BR FUTEX_LOCK_PI2 , and .B FUTEX_TRYLOCK_PI pair with@@ -1123,7 +1122,7 @@ The .IR uaddr2 , .IR val , and -.IR val3 +.I val3 arguments are ignored. .\" .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""@@ -1135,7 +1134,7 @@ This operation works similar like .BR FUTEX_LOCK_PI . The only difference is the timeout argument. -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 has support for selectable clocks. .IP If@@ -1466,7 +1465,7 @@ The value pointed to by is not equal to the expected value .IR val3 . .TP -.BR EAGAIN +.B EAGAIN .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1480,7 +1479,7 @@ is about to exit, but has not yet handled the internal state cleanup. Try again. .TP -.BR EDEADLK +.B EDEADLK .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1522,18 +1521,18 @@ a spurious wakeup; since Linux 2.6.22, this no longer happens. .TP .B EINVAL The operation in -.IR futex_op +.I futex_op is one of those that employs a timeout, but the supplied .I timeout argument was invalid .RI ( tv_sec was less than zero, or -.IR tv_nsec +.I tv_nsec was not less than 1,000,000,000). .TP .B EINVAL The operation specified in -.IR futex_op +.I futex_op employs one or both of the pointers .I uaddr and@@ -1545,17 +1544,17 @@ the address is not four-byte-aligned. .RB ( FUTEX_WAIT_BITSET , .BR FUTEX_WAKE_BITSET ) The bit mask supplied in -.IR val3 +.I val3 is zero. .TP .B EINVAL .RB ( FUTEX_CMP_REQUEUE_PI ) .I uaddr equals -.IR uaddr2 +.I uaddr2 (i.e., an attempt was made to requeue to the same futex). .TP -.BR EINVAL +.B EINVAL .RB ( FUTEX_FD ) The signal number supplied in .I val@@ -1570,9 +1569,9 @@ is invalid. The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state\(emthat is, it detected a waiter which waits in -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 on .IR uaddr . .TP@@ -1588,7 +1587,7 @@ This indicates either state corruption or that the kernel found a waiter on .I uaddr which is waiting via -.BR FUTEX_WAIT +.B FUTEX_WAIT or .BR FUTEX_WAIT_BITSET . .TP@@ -1601,9 +1600,9 @@ and the kernel state; .\" The kernel sees: I have non PI state for a futex you tried to .\" tell me was PI that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr2 . .TP@@ -1613,9 +1612,9 @@ The kernel detected an inconsistency between the user-space state at .I uaddr and the kernel state; that is, the kernel detected a waiter which waits via -.BR FUTEX_WAIT +.B FUTEX_WAIT or -.BR FUTEX_WAIT_BITSET +.B FUTEX_WAIT_BITSET on .IR uaddr . .TP@@ -1627,9 +1626,9 @@ and the kernel state; that is, the kernel detected a waiter which waits on .I uaddr via -.BR FUTEX_LOCK_PI +.B FUTEX_LOCK_PI or -.BR FUTEX_LOCK_PI2 +.B FUTEX_LOCK_PI2 (instead of .BR FUTEX_WAIT_REQUEUE_PI ). .TP@@ -1656,7 +1655,7 @@ Invalid argument. .RB ( FUTEX_FD ) The system-wide limit on the total number of open files has been reached. .TP -.BR ENOMEM +.B ENOMEM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1669,7 +1668,7 @@ Invalid operation specified in .TP .B ENOSYS The -.BR FUTEX_CLOCK_REALTIME +.B FUTEX_CLOCK_REALTIME option was specified in .IR futex_op , but the accompanying operation was neither@@ -1679,7 +1678,7 @@ but the accompanying operation was neither nor .BR FUTEX_LOCK_PI2 . .TP -.BR ENOSYS +.B ENOSYS .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1690,7 +1689,7 @@ A run-time check determined that the operation is not available. The PI-futex operations are not implemented on all architectures and are not supported on some CPU variants. .TP -.BR EPERM +.B EPERM .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1703,11 +1702,11 @@ the futex at .IR uaddr2 ). (This may be caused by a state corruption in user space.) .TP -.BR EPERM +.B EPERM .RB ( FUTEX_UNLOCK_PI ) The caller does not own the lock represented by the futex word. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_LOCK_PI , .BR FUTEX_LOCK_PI2 , .BR FUTEX_TRYLOCK_PI ,@@ -1716,7 +1715,7 @@ The thread ID in the futex word at .I uaddr does not exist. .TP -.BR ESRCH +.B ESRCH .RB ( FUTEX_CMP_REQUEUE_PI ) The thread ID in the futex word at .I uaddr2@@ -1724,7 +1723,7 @@ does not exist. .TP .B ETIMEDOUT The operation in -.IR futex_op +.I futex_op employed the timeout specified in .IR timeout , and the timeout expired before the operation completed.
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 12/32 capabilities.7: tfix
In reply to Alejandro ColomarFrom: Kir Kolyshkin <[email protected]>
Add a missing comma.
--- man7/capabilities.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man7/capabilities.7 +1 -1
@@ -215,7 +215,7 @@ Lock memory .BR shmctl (2)); .IP * Allocate memory using huge pages -.RB ( memfd_create (2) +.RB ( memfd_create (2), .BR mmap (2), .BR shmctl (2)). .PD 0
Signature · 1 line
2.32.0
Michael Kerrisk (man-pages)
AppliedRe: [PATCH 12/32] capabilities.7: tfix
Hello Alex, Kir,
Quoted 7 lines · Alejandro Colomar
From: Kir Kolyshkin <[email protected]>
Add a missing comma.
Fixes 3dcdef9437fafbSigned-off-by Kir Kolyshkin <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Applied. Thanks!
Cheers,
Michael
Quoted 18 lines
--- man7/capabilities.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man7/capabilities.7 +1
-1@@ -215,7 +215,7 @@ Lock memory .BR shmctl (2)); .IP * Allocate memory using huge pages -.RB ( memfd_create (2) +.RB ( memfd_create (2), .BR mmap (2), .BR shmctl (2)). .PD 0
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 13/32 user_namespaces.7: fix a ref
In reply to Alejandro ColomarFrom: Kir Kolyshkin <[email protected]>
The file being referred to no longer exists, as it was moved to *.rst first (commit 20a78ae9ed297f2) and then to under admin-guide (commit bf6b7a742e3f82b). Both those commits are from 2019 (Linux 5.3).
--- man7/user_namespaces.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man7/user_namespaces.7 +1 -1
@@ -1383,4 +1383,4 @@ main(int argc, char *argv[]) .BR pid_namespaces (7) .PP The kernel source file -.IR Documentation/namespaces/resource\-control.txt . +.IR Documentation/admin\-guide/namespaces/resource\-control.rst .
Signature · 1 line
2.32.0
Michael Kerrisk (man-pages)
AppliedRe: [PATCH 13/32] user_namespaces.7: fix a ref
Hello Kir, Alex,
Quoted 9 lines · Alejandro Colomar
From: Kir Kolyshkin <[email protected]>
The file being referred to no longer exists, as it was moved to *.rst first (commit
20a78ae9ed297f2) and then to under admin-guide (commitbf6b7a742e3f82b). Both those commits are from 2019 (Linux 5.3).Signed-off-by Kir Kolyshkin <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Applied.
Thanks,
Michael
Quoted 15 lines
--- man7/user_namespaces.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man7/user_namespaces.7 +1
-1@@ -1383,4 +1383,4 @@ main(int argc, char *argv[]) .BR pid_namespaces (7) .PP The kernel source file -.IR Documentation/namespaces/resource\-control.txt . +.IR Documentation/admin\-guide/namespaces/resource\-control.rst .
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 14/32 capabilities.7, user_namespaces.7: describe CAP_SETFCAP
In reply to Alejandro ColomarFrom: Kir Kolyshkin <[email protected]>
--- man7/capabilities.7 | 6 ++++++ man7/user_namespaces.7 | 6 ++++++ 2 files changed, 12 insertions(+)
man7/capabilities.7 +6 -0
@@ -349,6 +349,12 @@ write a group ID mapping in a user namespace (see .TP .BR CAP_SETFCAP " (since Linux 2.6.24)" Set arbitrary capabilities on a file. +.IP +.\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 +Since Linux 5.12, this capability is +also needed to map uid 0 (as in +.BR unshare\ -Ur , +.RB see unshare (1). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):
man7/user_namespaces.7 +6 -0
@@ -577,6 +577,12 @@ or be in the parent user namespace of the process The mapped user IDs (group IDs) must in turn have a mapping in the parent user namespace. .IP 4. +.\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 +If a writing process is root (i.e. UID 0) trying to map host user ID 0, +it must have +.B CAP_SETFCAP +capability (since Linux 5.12). +.IP 5. One of the following two cases applies: .RS .IP * 3
Signature · 1 line
2.32.0
Re: [PATCH 14/32] capabilities.7, user_namespaces.7: describe CAP_SETFCAP
Hello Kir, Alex,
Quoted 14 lines · Alejandro Colomar
From: Kir Kolyshkin <[email protected]>
Signed-off-by Kir Kolyshkin <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man7/capabilities.7 | 6 ++++++ man7/user_namespaces.7 | 6 ++++++ 2 files changed, 12 insertions(+)man7/capabilities.7 +0
-0
man7/capabilities.7 write a group ID mapping in a user namespace (see · line 353
Quoted 5 lines
man7/capabilities.7 +2
-0@@ -349,6 +349,12 @@ write a group ID mapping in a user namespace (see .TP .BR CAP_SETFCAP " (since Linux 2.6.24)" Set arbitrary capabilities on a file. +.IP +.\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18
Thank you for including the commit; that's always really helpful!
Quoted 14 lines
man7/capabilities.7 +4
-0+Since Linux 5.12, this capability is +also needed to map uid 0 (as in +.BR unshare\ -Ur , +.RB see unshare (1). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):man7/user_namespaces.7 +0
-0@@ -577,6 +577,12 @@ or be in the parent user namespace of the process The mapped user IDs (group IDs) must in turn have a mapping in the parent user namespace.
man7/user_namespaces.7 or be in the parent user namespace of the process · line 588
Quoted 10 lines
man7/user_namespaces.7 +6
-0.IP 4. +.\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 +If a writing process is root (i.e. UID 0) trying to map host user ID 0, +it must have +.B CAP_SETFCAP +capability (since Linux 5.12). +.IP 5. One of the following two cases applies: .RS .IP * 3
Thanks for the patch. I've applied.
Cheers,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 14/32] capabilities.7, user_namespaces.7: describe CAP_SETFCAP
In reply to Alejandro ColomarHello Kir,
Quoted 5 lines
man7/user_namespaces.7 +0
-0@@ -577,6 +577,12 @@ or be in the parent user namespace of the process The mapped user IDs (group IDs) must in turn have a mapping in the parent user namespace.
man7/user_namespaces.7 or be in the parent user namespace of the process · line 588
Quoted 10 lines
man7/user_namespaces.7 +6
-0.IP 4. +.\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 +If a writing process is root (i.e. UID 0) trying to map host user ID 0, +it must have +.B CAP_SETFCAP +capability (since Linux 5.12). +.IP 5. One of the following two cases applies: .RS .IP * 3
So, reflecting on this, I think much more should be said. See my mail "Documenting the requirement of CAP_SETFCAP to map UID 0" in a moment. Perhaps you may also have some review comments there.
Cheers,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 15/32 capabilities.7: Minor tweaks to Kir's patch
In reply to Alejandro Colomar--- man7/capabilities.7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
man7/capabilities.7 +3 -2
@@ -353,8 +353,9 @@ Set arbitrary capabilities on a file. .\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 Since Linux 5.12, this capability is also needed to map uid 0 (as in -.BR unshare\ -Ur , -.RB see unshare (1). +.IR "unshare -Ur" , +see +.BR unshare (1). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):
Signature · 1 line
2.32.0
Re: [PATCH 15/32] capabilities.7: Minor tweaks to Kir's patch
Quoted 1 line · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>
I forgot to CC Kir here.
Quoted 21 lines
--- man7/capabilities.7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)man7/capabilities.7 +3
-2@@ -353,8 +353,9 @@ Set arbitrary capabilities on a file. .\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 Since Linux 5.12, this capability is also needed to map uid 0 (as in -.BR unshare\ -Ur , -.RB see unshare (1). +.IR "unshare -Ur" , +see +.BR unshare (1). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 15/32] capabilities.7: Minor tweaks to Kir's patch
In reply to Alejandro Colomar[CC += Kir]
Hi Alex,
Quoted 11 lines · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>--- man7/capabilities.7 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)man7/capabilities.7 +0
-0@@ -353,8 +353,9 @@ Set arbitrary capabilities on a file. .\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18
man7/capabilities.7 Set arbitrary capabilities on a file. · line 361
Quoted 10 lines
man7/capabilities.7 +3
-2Since Linux 5.12, this capability is also needed to map uid 0 (as in -.BR unshare\ -Ur , -.RB see unshare (1). +.IR "unshare -Ur" , +see +.BR unshare (1). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):
Good. But still a few other things to fix. See my patch below.
Thanks,
Michael
man7/capabilities.7 +3 -3
@@ -352,10 +352,10 @@ Set arbitrary capabilities on a file. .IP .\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 Since Linux 5.12, this capability is -also needed to map uid 0 (as in -.IR "unshare -Ur" , +also needed to map UID 0 (as in +.IR "unshare \-Ur" ; see -.BR unshare (1). +.BR unshare (1)). .TP .B CAP_SETPCAP If file capabilities are supported (i.e., since Linux 2.6.24):
man7/user_namespaces.7 +2 -2
@@ -578,8 +578,8 @@ The mapped user IDs (group IDs) must in turn have a mapping in the parent user namespace. .IP 4. .\" commit db2e718a47984b9d71ed890eb2ea36ecf150de18 -If a writing process is root (i.e. UID 0) trying to map host user ID 0, -it must have +If a writing process is root (i.e., UID 0) trying to map host user ID 0, +it must have the .B CAP_SETFCAP capability (since Linux 5.12). .IP 5.
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 16/32 seccomp_unotify.2: Add doc for SECCOMP_ADDFD_FLAG_SEND
In reply to Alejandro ColomarFrom: Rodrigo Campos <[email protected]>
This flag was recently added to Linux 5.14 by a patch I wrote:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ae71c7720e3ae3aabd2e8a072d27f7bd173d25c
This patch adds documentation for the flag, the error code that the flag added and explains in the caveat when it is useful.
--- man2/seccomp_unotify.2 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
man2/seccomp_unotify.2 +26 -0
@@ -739,6 +739,17 @@ When allocating the file descriptor in the target, use the file descriptor number specified in the .I newfd field. +.TP +.BR SECCOMP_ADDFD_FLAG_SEND +Available since Linux 5.14, combines the +.B SECCOMP_IOCTL_NOTIF_ADDFD +ioctl with +.B SECCOMP_IOCTL_NOTIF_SEND +into an atomic operation. On successful invocation, the target process's +errno will be 0 and the return value will be the file descriptor number that was +installed in the target. If allocating the file descriptor in the tatget fails, +the target's syscall continues to be blocked until a successful response is +sent. .RE .TP .I srcfd
@@ -801,6 +812,13 @@ Allocating the file descriptor in the target would cause the target's limit to be exceeded (see .BR getrlimit (2)). .TP +.B EBUSY +If the flag +.B SECCOMP_IOCTL_NOTIF_SEND +is used, this means the operation can't proceed until other +.B SECCOMP_IOCTL_NOTIF_ADDFD +requests are processed. +.TP .B EINPROGRESS The user-space notification specified in the .I id
@@ -1131,6 +1149,14 @@ that would normally be restarted by the .BR SA_RESTART flag. +.PP +Furthermore, if the supervisor response is a file descriptor +added with +.B SECCOMP_IOCTL_NOTIF_ADDFD, +then the flag +.B SECCOMP_ADDFD_FLAG_SEND +can be used to atomically add the file descriptor and return that value, +making sure no file descriptors are inadvertently leaked into the target. .\" FIXME .\" About the above, Kees Cook commented: .\"
Signature · 1 line
2.32.0
Re: [PATCH 16/32] seccomp_unotify.2: Add doc for SECCOMP_ADDFD_FLAG_SEND
Hello Rodrigo, Alex,
Quoted 7 lines · Alejandro Colomar
From: Rodrigo Campos <[email protected]>
This flag was recently added to Linux 5.14 by a patch I wrote:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ae71c7720e3ae3aabd2e8a072d27f7bd173d25cThis patch adds documentation for the flag, the error code that the flag added and explains in the caveat when it is useful.
Thanks for taking the time to write this patch!
Patch applied.
Cheers,
Michael
Quoted 57 lines
--- man2/seccomp_unotify.2 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)man2/seccomp_unotify.2 +26
-0@@ -739,6 +739,17 @@ When allocating the file descriptor in the target, use the file descriptor number specified in the .I newfd field. +.TP +.BR SECCOMP_ADDFD_FLAG_SEND +Available since Linux 5.14, combines the +.B SECCOMP_IOCTL_NOTIF_ADDFD +ioctl with +.B SECCOMP_IOCTL_NOTIF_SEND +into an atomic operation. On successful invocation, the target process's +errno will be 0 and the return value will be the file descriptor number that was +installed in the target. If allocating the file descriptor in the tatget fails, +the target's syscall continues to be blocked until a successful response is +sent. .RE .TP .I srcfd@@ -801,6 +812,13 @@ Allocating the file descriptor in the target would cause the target's limit to be exceeded (see .BR getrlimit (2)). .TP +.B EBUSY +If the flag +.B SECCOMP_IOCTL_NOTIF_SEND +is used, this means the operation can't proceed until other +.B SECCOMP_IOCTL_NOTIF_ADDFD +requests are processed. +.TP .B EINPROGRESS The user-space notification specified in the .I id@@ -1131,6 +1149,14 @@ that would normally be restarted by the .BR SA_RESTART flag. +.PP +Furthermore, if the supervisor response is a file descriptor +added with +.B SECCOMP_IOCTL_NOTIF_ADDFD, +then the flag +.B SECCOMP_ADDFD_FLAG_SEND +can be used to atomically add the file descriptor and return that value, +making sure no file descriptors are inadvertently leaked into the target. .\" FIXME .\" About the above, Kees Cook commented: .\"
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 16/32] seccomp_unotify.2: Add doc for SECCOMP_ADDFD_FLAG_SEND
Quoted 9 lines · Michael Kerrisk (man-pages)
Hello Rodrigo, Alex,
Quoted 5 lines · Alejandro Colomar
From: Rodrigo Campos <[email protected]>
This flag was recently added to Linux 5.14 by a patch I wrote:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ae71c7720e3ae3aabd2e8a072d27f7bd173d25c
Quoted 6 lines
Quoted 2 lines
This patch adds documentation for the flag, the error code that the flag added and explains in the caveat when it is useful.
Thanks for taking the time to write this patch!
Patch applied.
Thanks! It is great to verify that the explanation is indeed clear to others too! :)
PATCH 17/32 seccomp_unotify.2: Minor tweaks to Rodrigo's patch
In reply to Alejandro Colomar--- man2/seccomp_unotify.2 | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
man2/seccomp_unotify.2 +17 -15
@@ -740,16 +740,18 @@ use the file descriptor number specified in the .I newfd field. .TP -.BR SECCOMP_ADDFD_FLAG_SEND -Available since Linux 5.14, combines the +.BR SECCOMP_ADDFD_FLAG_SEND " (since Linux 5.14)" +Combines the .B SECCOMP_IOCTL_NOTIF_ADDFD ioctl with .B SECCOMP_IOCTL_NOTIF_SEND -into an atomic operation. On successful invocation, the target process's -errno will be 0 and the return value will be the file descriptor number that was -installed in the target. If allocating the file descriptor in the tatget fails, -the target's syscall continues to be blocked until a successful response is -sent. +into an atomic operation. +On successful invocation, the target process's errno will be 0 +and the return value will be the file descriptor number +that was installed in the target. +If allocating the file descriptor in the tatget fails, +the target's syscall continues to be blocked +until a successful response is sent. .RE .TP .I srcfd
@@ -1149,14 +1151,6 @@ that would normally be restarted by the .BR SA_RESTART flag. -.PP -Furthermore, if the supervisor response is a file descriptor -added with -.B SECCOMP_IOCTL_NOTIF_ADDFD, -then the flag -.B SECCOMP_ADDFD_FLAG_SEND -can be used to atomically add the file descriptor and return that value, -making sure no file descriptors are inadvertently leaked into the target. .\" FIXME .\" About the above, Kees Cook commented: .\"
@@ -1176,6 +1170,14 @@ making sure no file descriptors are inadvertently leaked into the target. .\" calls because it's impossible for the kernel to restart the call .\" with the right timeout value. I wonder what happens when those .\" system calls are restarted in the scenario we're discussing.) +.PP +Furthermore, if the supervisor response is a file descriptor +added with +.B SECCOMP_IOCTL_NOTIF_ADDFD, +then the flag +.B SECCOMP_ADDFD_FLAG_SEND +can be used to atomically add the file descriptor and return that value, +making sure no file descriptors are inadvertently leaked into the target. .SH BUGS If a .BR SECCOMP_IOCTL_NOTIF_RECV
Signature · 1 line
2.32.0
Re: [PATCH 17/32] seccomp_unotify.2: Minor tweaks to Rodrigo's patch
Quoted 1 line · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>
I forgot to CC Rodrigo here.
Quoted 65 lines
--- man2/seccomp_unotify.2 | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)man2/seccomp_unotify.2 +17
-15@@ -740,16 +740,18 @@ use the file descriptor number specified in the .I newfd field. .TP -.BR SECCOMP_ADDFD_FLAG_SEND -Available since Linux 5.14, combines the +.BR SECCOMP_ADDFD_FLAG_SEND " (since Linux 5.14)" +Combines the .B SECCOMP_IOCTL_NOTIF_ADDFD ioctl with .B SECCOMP_IOCTL_NOTIF_SEND -into an atomic operation. On successful invocation, the target process's -errno will be 0 and the return value will be the file descriptor number that was -installed in the target. If allocating the file descriptor in the tatget fails, -the target's syscall continues to be blocked until a successful response is -sent. +into an atomic operation. +On successful invocation, the target process's errno will be 0 +and the return value will be the file descriptor number +that was installed in the target. +If allocating the file descriptor in the tatget fails, +the target's syscall continues to be blocked +until a successful response is sent. .RE .TP .I srcfd@@ -1149,14 +1151,6 @@ that would normally be restarted by the .BR SA_RESTART flag. -.PP -Furthermore, if the supervisor response is a file descriptor -added with -.B SECCOMP_IOCTL_NOTIF_ADDFD, -then the flag -.B SECCOMP_ADDFD_FLAG_SEND -can be used to atomically add the file descriptor and return that value, -making sure no file descriptors are inadvertently leaked into the target. .\" FIXME .\" About the above, Kees Cook commented: .\"@@ -1176,6 +1170,14 @@ making sure no file descriptors are inadvertently leaked into the target. .\" calls because it's impossible for the kernel to restart the call .\" with the right timeout value. I wonder what happens when those .\" system calls are restarted in the scenario we're discussing.) +.PP +Furthermore, if the supervisor response is a file descriptor +added with +.B SECCOMP_IOCTL_NOTIF_ADDFD, +then the flag +.B SECCOMP_ADDFD_FLAG_SEND +can be used to atomically add the file descriptor and return that value, +making sure no file descriptors are inadvertently leaked into the target. .SH BUGS If a .BR SECCOMP_IOCTL_NOTIF_RECV
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 17/32] seccomp_unotify.2: Minor tweaks to Rodrigo's patch
In reply to Alejandro Colomar[CC += Rodrigo]
Hi Alex,
Quoted 55 lines · Alejandro Colomar
Signed-off-by Alejandro Colomar <[email protected]>--- man2/seccomp_unotify.2 | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)man2/seccomp_unotify.2 +10
-15@@ -740,16 +740,18 @@ use the file descriptor number specified in the .I newfd field. .TP -.BR SECCOMP_ADDFD_FLAG_SEND -Available since Linux 5.14, combines the +.BR SECCOMP_ADDFD_FLAG_SEND " (since Linux 5.14)" +Combines the .B SECCOMP_IOCTL_NOTIF_ADDFD ioctl with .B SECCOMP_IOCTL_NOTIF_SEND -into an atomic operation. On successful invocation, the target process's -errno will be 0 and the return value will be the file descriptor number that was -installed in the target. If allocating the file descriptor in the tatget fails, -the target's syscall continues to be blocked until a successful response is -sent. +into an atomic operation. +On successful invocation, the target process's errno will be 0 +and the return value will be the file descriptor number +that was installed in the target. +If allocating the file descriptor in the tatget fails, +the target's syscall continues to be blocked +until a successful response is sent. .RE .TP .I srcfd@@ -1149,14 +1151,6 @@ that would normally be restarted by the .BR SA_RESTART flag. -.PP -Furthermore, if the supervisor response is a file descriptor -added with -.B SECCOMP_IOCTL_NOTIF_ADDFD, -then the flag -.B SECCOMP_ADDFD_FLAG_SEND -can be used to atomically add the file descriptor and return that value, -making sure no file descriptors are inadvertently leaked into the target. .\" FIXME .\" About the above, Kees Cook commented: .\"@@ -1176,6 +1170,14 @@ making sure no file descriptors are inadvertently leaked into the target. .\" calls because it's impossible for the kernel to restart the call .\" with the right timeout value. I wonder what happens when those .\" system calls are restarted in the scenario we're discussing.) +.PP
man2/seccomp_unotify.2 making sure no file descriptors are inadvertently leaked into the target. · line 1183
Quoted 10 lines
man2/seccomp_unotify.2 +7
-0+Furthermore, if the supervisor response is a file descriptor +added with +.B SECCOMP_IOCTL_NOTIF_ADDFD, +then the flag +.B SECCOMP_ADDFD_FLAG_SEND +can be used to atomically add the file descriptor and return that value, +making sure no file descriptors are inadvertently leaked into the target. .SH BUGS If a .BR SECCOMP_IOCTL_NOTIF_RECV
Good clean-ups, but still I added some fixes, as below. (The first change is just some slightly smoother wording, IMO.)
Thanks,
Michael
man2/seccomp_unotify.2 +11 -8
@@ -741,16 +741,19 @@ use the file descriptor number specified in the field. .TP .BR SECCOMP_ADDFD_FLAG_SEND " (since Linux 5.14)" -Combines the +.\" commit 0ae71c7720e3ae3aabd2e8a072d27f7bd173d25c +Perform the equivalent of .B SECCOMP_IOCTL_NOTIF_ADDFD -ioctl with +plus .B SECCOMP_IOCTL_NOTIF_SEND -into an atomic operation. -On successful invocation, the target process's errno will be 0 +as an atomic operation. +On successful invocation, the target process's +.I errno +will be 0 and the return value will be the file descriptor number -that was installed in the target. -If allocating the file descriptor in the tatget fails, -the target's syscall continues to be blocked +that was allocated in the target. +If allocating the file descriptor in the target fails, +the target's system call continues to be blocked until a successful response is sent. .RE .TP
@@ -1173,7 +1176,7 @@ flag. .PP Furthermore, if the supervisor response is a file descriptor added with -.B SECCOMP_IOCTL_NOTIF_ADDFD, +.BR SECCOMP_IOCTL_NOTIF_ADDFD , then the flag .B SECCOMP_ADDFD_FLAG_SEND can be used to atomically add the file descriptor and return that value,
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 17/32] seccomp_unotify.2: Minor tweaks to Rodrigo's patch
Hi Alex,
Quoted 4 lines · Michael Kerrisk (man-pages)
Good clean-ups, but still I added some fixes, as below. (The first change is just some slightly smoother wording, IMO.)
Yes, it reads better! Thanks!
Alex
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
PATCH 18/32 recv.2: tfix
In reply to Alejandro ColomarFrom: kXuan <[email protected]>
The recv.2 misspelled SO_EE_OFFENDER to SOCK_EE_OFFENDER.
This patch fix this typo.
--- man2/recv.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/recv.2 +1 -1
@@ -196,7 +196,7 @@ number of the queued error. is the origin code of where the error originated. The other fields are protocol-specific. The macro -.B SOCK_EE_OFFENDER +.B SO_EE_OFFENDER returns a pointer to the address of the network object where the error originated from given a pointer to the ancillary message. If this address is not known, the
Signature · 1 line
2.32.0
Re: [PATCH 18/32] recv.2: tfix
Hello Alex, kXuan,
Quoted 8 lines · Alejandro Colomar
From: kXuan <[email protected]>
The recv.2 misspelled
SO_EE_OFFENDERtoSOCK_EE_OFFENDER.This patch fix this typo.
Signed-off-by kXuan <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man2/recv.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/recv.2 +1
-1@@ -196,7 +196,7 @@ number of the queued error. is the origin code of where the error originated. The other fields are protocol-specific. The macro -.B SOCK_EE_OFFENDER +.B SO_EE_OFFENDER returns a pointer to the address of the network object where the error originated from given a pointer to the ancillary message. If this address is not known, the
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 19/32 ascii.7: add vertical rule to separate the two columns
In reply to Alejandro ColomarFrom: наб <[email protected]>
I regularly get mildly lost in this table (and, indeed, didn't realise it had two columns the first few times I used it to look at something from the left column) ‒ separating the two columns improves clarity, and makes which soup of numbers belongs to which character much more obvious
Other encodings don't need this as they don't use double-columnated tables
--- man7/ascii.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man7/ascii.7 +1 -1
@@ -48,7 +48,7 @@ C program \f(CW\(aq\eX\(aq\fP escapes are noted. .ft CW \} .TS -l l l l l l l l. +l l l l | l l l l. Oct Dec Hex Char Oct Dec Hex Char _ 000 0 00 NUL \(aq\e0\(aq (null character) 100 64 40 @
Signature · 1 line
2.32.0
Re: [PATCH 19/32] ascii.7: add vertical rule to separate the two columns
Hello наб and Alex,
Quoted 8 lines · Alejandro Colomar
From: наб <[email protected]>
I regularly get mildly lost in this table (and, indeed, didn't realise it had two columns the first few times I used it to look at something from the left column) ‒ separating the two columns improves clarity, and makes which soup of numbers belongs to which character much more obvious
Quoted 5 lines
Other encodings don't need this as they don't use double-columnated tables
Signed-off-by Ahelenia Ziemiańska <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man7/ascii.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man7/ascii.7 +1
-1@@ -48,7 +48,7 @@ C program \f(CW\(aq\eX\(aq\fP escapes are noted. .ft CW \} .TS -l l l l l l l l. +l l l l | l l l l. Oct Dec Hex Char Oct Dec Hex Char _ 000 0 00 NUL \(aq\e0\(aq (null character) 100 64 40 @
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 20/32 wait.2: Add ESRCH for when pid == INT_MIN
In reply to Alejandro ColomarFrom: Richard Palethorpe <[email protected]>
Please see upstream commit:
commit dd83c161fbcc5d8be637ab159c0de015cbff5ba4
Author: zhongjiang <[email protected]>
Date: Mon Jul 10 15:53:01 2017 -0700
kernel/exit.c: avoid undefined behaviour when calling wait4()
It avoids negating INT_MIN by returning early with ESRCH.
--- man2/wait.2 | 9 +++++++++ 1 file changed, 9 insertions(+)
man2/wait.2 +9 -0
@@ -455,6 +455,15 @@ was caught; see The .I options argument was invalid. +.TP +.B ESRCH +(for +.BR wait () +or +.BR waitpid ()) +.I pid +is equal to +.I INT_MIN .SH CONFORMING TO SVr4, 4.3BSD, POSIX.1-2001. .SH NOTES
Signature · 1 line
2.32.0
Re: [PATCH 20/32] wait.2: Add ESRCH for when pid == INT_MIN
Hello Richard and Alex,
Quoted 27 lines · Alejandro Colomar
From: Richard Palethorpe <[email protected]>
Please see upstream commit:
commit
dd83c161fbcc5d8be637ab159c0de015cbff5ba4
Author: zhongjiang <[email protected]>
Date: Mon Jul 10 15:53:01 2017 -0700
kernel/exit.c: avoid undefined behaviour when callingwait4()It avoids negating
INT_MINby returning early with ESRCH.Signed-off-by Richard Palethorpe <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>> ---man2/wait.2 | 9 +++++++++ 1 file changed, 9 insertions(+)man2/wait.2 +2
-0@@ -455,6 +455,15 @@ was caught; see The .I options argument was invalid. +.TP +.B ESRCH
man2/wait.2 was caught; see · line 469
Quoted 10 lines
man2/wait.2 +7
-0+(for +.BR wait () +or +.BR waitpid ()) +.I pid +is equal to +.I INT_MIN .SH CONFORMING TO SVr4, 4.3BSD, POSIX.1-2001. .SH NOTES
Thanks. Patch applied, and added the follow-up patch below.
Thanks,
Michael
man2/wait.2 +1 -1
@@ -463,7 +463,7 @@ or .BR waitpid ()) .I pid is equal to -.I INT_MIN +.BR INT_MIN . .SH CONFORMING TO SVr4, 4.3BSD, POSIX.1-2001. .SH NOTES
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 21/32 seccomp_unotify.2: tfix
In reply to Alejandro ColomarFrom: Jakub Wilk <[email protected]>
Remove duplicated word.
--- man2/seccomp_unotify.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/seccomp_unotify.2 +1 -1
@@ -1105,7 +1105,7 @@ Alternatively, in the example, the supervisor might use .BR poll (2) to monitor both the notification file descriptor -(so as as to discover when the target's +(so as to discover when the target's .BR accept (2) call has been interrupted) and the listening file descriptor (so as to know when a connection is available).
Signature · 1 line
2.32.0
Re: [PATCH 21/32] seccomp_unotify.2: tfix
Hi Jakub, Alex,
Quoted 6 lines · Alejandro Colomar
From: Jakub Wilk <[email protected]>
Remove duplicated word.
Signed-off-by Jakub Wilk <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man2/seccomp_unotify.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/seccomp_unotify.2 +1
-1@@ -1105,7 +1105,7 @@ Alternatively, in the example, the supervisor might use .BR poll (2) to monitor both the notification file descriptor -(so as as to discover when the target's +(so as to discover when the target's .BR accept (2) call has been interrupted) and the listening file descriptor (so as to know when a connection is available).
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 22/32 proc.5: tfix
In reply to Alejandro ColomarFrom: Jakub Wilk <[email protected]>
--- man5/proc.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man5/proc.5 +1 -1
@@ -5606,7 +5606,7 @@ first. .IR /proc/sys/vm/sysctl_hugetlb_shm_group " (since Linux 2.6.7)" This writable file contains a group ID that is allowed to allocate memory using huge pages. -If a process has a filesystem group ID or any supplememtary group ID that +If a process has a filesystem group ID or any supplementary group ID that matches this group ID, then it can make huge-page allocations without holding the .BR CAP_IPC_LOCK
Signature · 1 line
2.32.0
Re: [PATCH 22/32] proc.5: tfix
Hello Jakub and Alex,
Quoted 4 lines · Alejandro Colomar
From: Jakub Wilk <[email protected]>
Signed-off-by Jakub Wilk <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man5/proc.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man5/proc.5 +1
-1@@ -5606,7 +5606,7 @@ first. .IR /proc/sys/vm/sysctl_hugetlb_shm_group " (since Linux 2.6.7)" This writable file contains a group ID that is allowed to allocate memory using huge pages. -If a process has a filesystem group ID or any supplememtary group ID that +If a process has a filesystem group ID or any supplementary group ID that matches this group ID, then it can make huge-page allocations without holding the .BR CAP_IPC_LOCK
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 23/32 scripts/bash_aliases: tfix
In reply to Alejandro ColomarFrom: Jakub Wilk <[email protected]>
--- scripts/bash_aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/bash_aliases +1 -1
@@ -24,7 +24,7 @@ EX_USAGE=64; # C # sed_rm_ccomments() removes C comments. -# It can't handle multiple comments in a sinlge line correctly, +# It can't handle multiple comments in a single line correctly, # nor mixed or embedded //... and /*...*/ comments. # Use as a filter (see man_lsfunc() in this file).
Signature · 1 line
2.32.0
Re: [PATCH 23/32] scripts/bash_aliases: tfix
Hi Laex, Jakub,
Quoted 4 lines · Alejandro Colomar
From: Jakub Wilk <[email protected]>
Signed-off-by Jakub Wilk <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- scripts/bash_aliases | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/bash_aliases +1
-1@@ -24,7 +24,7 @@ EX_USAGE=64; # C # sed_rm_ccomments() removes C comments. -# It can't handle multiple comments in a sinlge line correctly, +# It can't handle multiple comments in a single line correctly, # nor mixed or embedded //... and /*...*/ comments. # Use as a filter (see man_lsfunc() in this file).
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 24/32 namespaces.7: fix confusion caused by text reorganization
In reply to Alejandro ColomarFrom: Štěpán Němec <[email protected]>
Since commit ee81d7e41852, the flags list has been (only) above, not below, these references.
(The flags table was added even before that, in commit 0b497138b908 ("namespaces.7: Add table of namespaces to top of page"))
--- man7/namespaces.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
man7/namespaces.7 +2 -2
@@ -97,7 +97,7 @@ If the .I flags argument of the call specifies one or more of the .B CLONE_NEW* -flags listed below, then new namespaces are created for each flag, +flags listed above, then new namespaces are created for each flag, and the child process is made a member of those namespaces. (This system call also implements a number of features unrelated to namespaces.)
@@ -119,7 +119,7 @@ If the .I flags argument of the call specifies one or more of the .B CLONE_NEW* -flags listed below, then new namespaces are created for each flag, +flags listed above, then new namespaces are created for each flag, and the calling process is made a member of those namespaces. (This system call also implements a number of features unrelated to namespaces.)
Signature · 1 line
2.32.0
Re: [PATCH 24/32] namespaces.7: fix confusion caused by text reorganization
Hello Štěpán, Alex,
@Štěpán Thanks for spotting this!
Quoted 11 lines · Alejandro Colomar
From: Štěpán Němec <[email protected]>
Since commit
ee81d7e41852, the flags list has been (only) above, not below, these references.(The flags table was added even before that, in commit
0b497138b908("namespaces.7: Add table of namespaces to top of page"))Fixes ee81d7e41852 ("namespaces.7: Include manual page references in the summary table of namespace types")Signed-off-by Štěpán Němec <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Patch applied.
Cheers,
Michael
Quoted 27 lines
--- man7/namespaces.7 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)man7/namespaces.7 +2
-2@@ -97,7 +97,7 @@ If the .I flags argument of the call specifies one or more of the .B CLONE_NEW* -flags listed below, then new namespaces are created for each flag, +flags listed above, then new namespaces are created for each flag, and the child process is made a member of those namespaces. (This system call also implements a number of features unrelated to namespaces.)@@ -119,7 +119,7 @@ If the .I flags argument of the call specifies one or more of the .B CLONE_NEW* -flags listed below, then new namespaces are created for each flag, +flags listed above, then new namespaces are created for each flag, and the calling process is made a member of those namespaces. (This system call also implements a number of features unrelated to namespaces.)
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 25/32 pipe.7: also mention writev(2) in atomicity sexion
In reply to Alejandro ColomarFrom: наб <[email protected]>
writev(2) notes that buffers don't interleave with other process' (a reasonable question to ask), but points to pipe(7) for an exception. pipe(7) did /not/ mention "writev", "iov", "scat", or "gath", which are, in order, reasonable search terms: this was confusing at best and alarming at worst
By mentioning writev(2) in the heading, we clearly note that this sort of interleaving behaviour matches write(2)'s and isn't a concern
--- man7/pipe.7 | 2 ++ 1 file changed, 2 insertions(+)
man7/pipe.7 +2 -0
@@ -246,6 +246,8 @@ limits; see BUGS. .SS PIPE_BUF POSIX.1 says that .BR write (2)s +and +.BR writev (2)s of less than .B PIPE_BUF bytes must be atomic: the output data is written to the pipe as a
Signature · 1 line
2.32.0
Re: [PATCH 25/32] pipe.7: also mention writev(2) in atomicity sexion
Hello наб and Alex,
Quoted 22 lines · Alejandro Colomar
From: наб <[email protected]>
writev(2) notes that buffers don't interleave with other process' (a reasonable question to ask), but points to pipe(7) for an exception. pipe(7) did /not/ mention "writev", "iov", "scat", or "gath", which are, in order, reasonable search terms: this was confusing at best and alarming at worst
By mentioning writev(2) in the heading, we clearly note that this sort of interleaving behaviour matches write(2)'s and isn't a concern
Signed-off-by Ahelenia Ziemiańska <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man7/pipe.7 | 2 ++ 1 file changed, 2 insertions(+)man7/pipe.7 +0
-0
man7/pipe.7 limits; see BUGS. · line 253
Quoted 8 lines
man7/pipe.7 +2
-0@@ -246,6 +246,8 @@ limits; see BUGS. .SS PIPE_BUF POSIX.1 says that .BR write (2)s +and +.BR writev (2)s of less than .B PIPE_BUF bytes must be atomic: the output data is written to the pipe as a
I think a different fix is required. On reflection, I don't think the reference to pipe(7) is needed in writev(2) (mea culpa; I added that text), and I think the text in pipe(7) could be written to be closer to the POSIX spec, which doesn't talk about "write() calls", but simply about "writes". See below.
Cheers,
Michael
commit 0602a20452d7abde429bc46215b203160ab70ec0 (HEAD -> master)
Author: Michael Kerrisk <[email protected]> Date: Sun Aug 8 11:24:16 2021 +0200
readv.2, pipe.7: Make text on pipe writes more general to avoid a confusion in writev(2)
After a patch proposal from наб triggered by concerns that, when talking about PIPE_BUF, pipe(7) explicitly mentions write(2) but not writev(2), I've concluded that the reference in writev(2) to pipe(7) is not needed (mea culpa; I added that text), and I think the text in pipe(7) could be written to be closer to the POSIX spec, which doesn't talk about "write() calls", but simply about "writes".
man2/readv.2 +1 -3
@@ -141,9 +141,7 @@ are atomic: the data written by .\" Regarding atomicity, see https://bugzilla.kernel.org/show_bug.cgi?id=10596 .BR writev () is written as a single block that is not intermingled with output -from writes in other processes (but see -.BR pipe (7) -for an exception); +from writes in other processes; analogously, .BR readv () is guaranteed to read a contiguous block of data from the file,
man7/pipe.7 +1 -3
@@ -244,9 +244,7 @@ and limits; see BUGS. .\" .SS PIPE_BUF -POSIX.1 says that -.BR write (2)s -of less than +POSIX.1 says that writes of less than .B PIPE_BUF bytes must be atomic: the output data is written to the pipe as a contiguous sequence.
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 26/32 tkill.2: tfix
In reply to Alejandro ColomarFrom: Sagar Patel <[email protected]>
Correct function signature by adding missing parenthesis.
--- man2/tkill.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/tkill.2 +1 -1
@@ -39,7 +39,7 @@ tkill, tgkill \- send a signal to a thread .PP .B #include <signal.h> .PP -.BI "int tgkill, pid_t " tgid ", pid_t " tid ", int " sig ); +.BI "int tgkill(pid_t " tgid ", pid_t " tid ", int " sig ); .fi .PP .IR Note :
Signature · 1 line
2.32.0
Re: [PATCH 26/32] tkill.2: tfix
Hello Sagar and Alex,
Quoted 5 lines · Alejandro Colomar
From: Sagar Patel <[email protected]>
Correct function signature by adding missing parenthesis.
Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 18 lines
--- man2/tkill.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/tkill.2 +1
-1@@ -39,7 +39,7 @@ tkill, tgkill \- send a signal to a thread .PP .B #include <signal.h> .PP -.BI "int tgkill, pid_t " tgid ", pid_t " tid ", int " sig ); +.BI "int tgkill(pid_t " tgid ", pid_t " tid ", int " sig ); .fi .PP .IR Note :
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 27/32 strstr.3: Add special case for empty needle
In reply to Alejandro Colomar--- man3/strstr.3 | 8 ++++++++ 1 file changed, 8 insertions(+)
man3/strstr.3 +8 -0
@@ -61,6 +61,14 @@ but ignores the case of both arguments. .SH RETURN VALUE These functions return a pointer to the beginning of the located substring, or NULL if the substring is not found. +.PP +Note the special case: +If +.I needle +is the empty string, +the return value is always +.I haystack +itself. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7).
Signature · 1 line
2.32.0
Re: [PATCH 27/32] strstr.3: Add special case for empty needle
Hello Stefan and Alex,
Quoted 2 lines · Alejandro Colomar
Reported-by Stefan Kanthak <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>
Thanks. Patch applied.
Cheers,
Michael
Quoted 24 lines
--- man3/strstr.3 | 8 ++++++++ 1 file changed, 8 insertions(+)man3/strstr.3 +8
-0@@ -61,6 +61,14 @@ but ignores the case of both arguments. .SH RETURN VALUE These functions return a pointer to the beginning of the located substring, or NULL if the substring is not found. +.PP +Note the special case: +If +.I needle +is the empty string, +the return value is always +.I haystack +itself. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7).
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 28/32 sigaction.2: Document SA_EXPOSE_TAGBITS and the flag support detection protocol
In reply to Alejandro ColomarFrom: Peter Collingbourne <[email protected]>
--- man2/sigaction.2 | 123 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)
man2/sigaction.2 +123 -0
@@ -261,6 +261,44 @@ This flag is meaningful only when establishing a signal handler. .\" .I sa_sigaction .\" field was added in Linux 2.1.86.) .\" +.TP +.B SA_UNSUPPORTED +Used to dynamically probe for flag bit support. +.IP +If an attempt to register a handler succeeds with this flag set in +.I act->sa_flags +alongside other flags that are potentially unsupported by the kernel, +and an immediately subsequent +.BR sigaction () +call specifying the same signal number n and with non-NULL +.I oldact +yields +.B SA_UNSUPPORTED +.I clear +in +.IR oldact->sa_flags , +then +.I oldact->sa_flags +may be used as a bitmask +describing which of the potentially unsupported flags are, +in fact, supported. +See the section "Dynamically probing for flag bit support" +below for more details. +.TP +.BR SA_EXPOSE_TAGBITS " (since Linux 5.11)" +Normally, when delivering a signal, +an architecture-specific set of tag bits are cleared from the +.I si_addr +field of +.IR siginfo_t . +If this flag is set, +an architecture-specific subset of the tag bits will be preserved in +.IR si_addr . +.IP +Programs that need to be compatible with Linux versions older than 5.11 +must use +.B SA_UNSUPPORTED +to probe for support. .SS The siginfo_t argument to a SA_SIGINFO handler When the .B SA_SIGINFO
@@ -846,6 +884,91 @@ Triggered by a .BR seccomp (2) filter rule. .RE +.SS Dynamically probing for flag bit support +The +.BR sigaction () +call on Linux accepts unknown bits set in +.I act->sa_flags +without error. +The behavior of the kernel starting with Linux 5.11 is that a second +.BR sigaction () +will clear unknown bits from +.IR oldact->sa_flags . +However, historically, a second +.BR sigaction () +call would typically leave those bits set in +.IR oldact->sa_flags . +.PP +This means that support for new flags cannot be detected +simply by testing for a flag in +.IR sa_flags , +and a program must test that +.B SA_UNSUPPORTED +has been cleared before relying on the contents of +.IR sa_flags . +.PP +Since the behavior of the signal handler cannot be guaranteed +unless the check passes, +it is wise to either block the affected signal +while registering the handler and performing the check in this case, +or where this is not possible, +for example if the signal is synchronous, to issue the second +.BR sigaction () +in the signal handler itself. +.PP +In kernels that do not support a specific flag, +the kernel's behavior is as if the flag was not set, +even if the flag was set in +.IR act->sa_flags . +.PP +The flags +.BR SA_NOCLDSTOP , +.BR SA_NOCLDWAIT , +.BR SA_SIGINFO , +.BR SA_ONSTACK , +.BR SA_RESTART , +.BR SA_NODEFER , +.BR SA_RESETHAND , +and, if defined by the architecture, +.B SA_RESTORER +may not be reliably probed for using this mechanism, +because they were introduced before Linux 5.11. +However, in general, programs may assume that these flags are supported, +since they have all been supported since Linux 2.6, +which was released in the year 2003. +.PP +The following example program exits with status 0 if +.B SA_EXPOSE_TAGBITS +is determined to be supported, and 1 otherwise. +.PP +.EX +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + +void handler(int signo, siginfo_t *info, void *context) { + struct sigaction oldact; + if (sigaction(SIGSEGV, 0, &oldact) == 0 && + !(oldact.sa_flags & SA_UNSUPPORTED) && + (oldact.sa_flags & SA_EXPOSE_TAGBITS)) { + _exit(0); + } else { + _exit(1); + } +} + +int main(void) { + struct sigaction act = {0}; + act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; + act.sa_sigaction = handler; + if (sigaction(SIGSEGV, &act, 0) != 0) { + perror("sigaction"); + return 1; + } + + raise(SIGSEGV); +} +.EE .SH RETURN VALUE .BR sigaction () returns 0 on success; on error, \-1 is returned, and
Signature · 1 line
2.32.0
Re: [PATCH 28/32] sigaction.2: Document SA_EXPOSE_TAGBITS and the flag support detection protocol
Dropped, because reposted in a later series from Alex.
Quoted 150 lines · Alejandro Colomar
From: Peter Collingbourne <[email protected]>
Signed-off-by Peter Collingbourne <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man2/sigaction.2 | 123 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+)man2/sigaction.2 +123
-0@@ -261,6 +261,44 @@ This flag is meaningful only when establishing a signal handler. .\" .I sa_sigaction .\" field was added in Linux 2.1.86.) .\" +.TP +.B SA_UNSUPPORTED +Used to dynamically probe for flag bit support. +.IP +If an attempt to register a handler succeeds with this flag set in +.I act->sa_flags +alongside other flags that are potentially unsupported by the kernel, +and an immediately subsequent +.BR sigaction () +call specifying the same signal number n and with non-NULL +.I oldact +yields +.B SA_UNSUPPORTED +.I clear +in +.IR oldact->sa_flags , +then +.I oldact->sa_flags +may be used as a bitmask +describing which of the potentially unsupported flags are, +in fact, supported. +See the section "Dynamically probing for flag bit support" +below for more details. +.TP +.BR SA_EXPOSE_TAGBITS " (since Linux 5.11)" +Normally, when delivering a signal, +an architecture-specific set of tag bits are cleared from the +.I si_addr +field of +.IR siginfo_t . +If this flag is set, +an architecture-specific subset of the tag bits will be preserved in +.IR si_addr . +.IP +Programs that need to be compatible with Linux versions older than 5.11 +must use +.B SA_UNSUPPORTED +to probe for support. .SS The siginfo_t argument to a SA_SIGINFO handler When the .B SA_SIGINFO@@ -846,6 +884,91 @@ Triggered by a .BR seccomp (2) filter rule. .RE +.SS Dynamically probing for flag bit support +The +.BR sigaction () +call on Linux accepts unknown bits set in +.I act->sa_flags +without error. +The behavior of the kernel starting with Linux 5.11 is that a second +.BR sigaction () +will clear unknown bits from +.IR oldact->sa_flags . +However, historically, a second +.BR sigaction () +call would typically leave those bits set in +.IR oldact->sa_flags . +.PP +This means that support for new flags cannot be detected +simply by testing for a flag in +.IR sa_flags , +and a program must test that +.B SA_UNSUPPORTED +has been cleared before relying on the contents of +.IR sa_flags . +.PP +Since the behavior of the signal handler cannot be guaranteed +unless the check passes, +it is wise to either block the affected signal +while registering the handler and performing the check in this case, +or where this is not possible, +for example if the signal is synchronous, to issue the second +.BR sigaction () +in the signal handler itself. +.PP +In kernels that do not support a specific flag, +the kernel's behavior is as if the flag was not set, +even if the flag was set in +.IR act->sa_flags . +.PP +The flags +.BR SA_NOCLDSTOP , +.BR SA_NOCLDWAIT , +.BR SA_SIGINFO , +.BR SA_ONSTACK , +.BR SA_RESTART , +.BR SA_NODEFER , +.BR SA_RESETHAND , +and, if defined by the architecture, +.B SA_RESTORER +may not be reliably probed for using this mechanism, +because they were introduced before Linux 5.11. +However, in general, programs may assume that these flags are supported, +since they have all been supported since Linux 2.6, +which was released in the year 2003. +.PP +The following example program exits with status 0 if +.B SA_EXPOSE_TAGBITS +is determined to be supported, and 1 otherwise. +.PP +.EX +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + +void handler(int signo, siginfo_t *info, void *context) { + struct sigaction oldact; + if (sigaction(SIGSEGV, 0, &oldact) == 0 && + !(oldact.sa_flags & SA_UNSUPPORTED) && + (oldact.sa_flags & SA_EXPOSE_TAGBITS)) { + _exit(0); + } else { + _exit(1); + } +} + +int main(void) { + struct sigaction act = {0}; + act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; + act.sa_sigaction = handler; + if (sigaction(SIGSEGV, &act, 0) != 0) { + perror("sigaction"); + return 1; + } + + raise(SIGSEGV); +} +.EE .SH RETURN VALUE .BR sigaction () returns 0 on success; on error, \-1 is returned, and
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 29/32 sigaction.2: Apply minor tweaks to Peter's patch
In reply to Alejandro Colomar- Move example program to a new EXAMPLES section
- Invert logic in the handler to have the failure in the conditional path, and the success in out of any conditionals.
- Use NULL, EXIT_SUCCESS, and EXIT_FAILURE instead of magic numbers
- Separate declarations from code
- Put function return type on its own line
- Put function opening brace on its line
--- man2/sigaction.2 | 76 +++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 33 deletions(-)
man2/sigaction.2 +43 -33
@@ -936,39 +936,6 @@ because they were introduced before Linux 5.11. However, in general, programs may assume that these flags are supported, since they have all been supported since Linux 2.6, which was released in the year 2003. -.PP -The following example program exits with status 0 if -.B SA_EXPOSE_TAGBITS -is determined to be supported, and 1 otherwise. -.PP -.EX -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -void handler(int signo, siginfo_t *info, void *context) { - struct sigaction oldact; - if (sigaction(SIGSEGV, 0, &oldact) == 0 && - !(oldact.sa_flags & SA_UNSUPPORTED) && - (oldact.sa_flags & SA_EXPOSE_TAGBITS)) { - _exit(0); - } else { - _exit(1); - } -} - -int main(void) { - struct sigaction act = {0}; - act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; - act.sa_sigaction = handler; - if (sigaction(SIGSEGV, &act, 0) != 0) { - perror("sigaction"); - return 1; - } - - raise(SIGSEGV); -} -.EE .SH RETURN VALUE .BR sigaction () returns 0 on success; on error, \-1 is returned, and
@@ -1174,6 +1141,49 @@ This bug was fixed in kernel 2.6.14. .SH EXAMPLES See .BR mprotect (2). +.PP +The following example program exits with status +.B EXIT_SUCCESS +if +.B SA_EXPOSE_TAGBITS +is determined to be supported, and +.B EXIT_FAILURE +otherwise. +.PP +.EX +#include <signal.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> + +void +handler(int signo, siginfo_t *info, void *context) +{ + struct sigaction oldact; + + if (sigaction(SIGSEGV, NULL, &oldact) != 0 || + (oldact.sa_flags & SA_UNSUPPORTED) || + !(oldact.sa_flags & SA_EXPOSE_TAGBITS)) { + _exit(EXIT_FAILURE); + } + _exit(EXIT_SUCCESS); +} + +int +main(void) +{ + struct sigaction act = {0}; + + act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; + act.sa_sigaction = &handler; + if (sigaction(SIGSEGV, &act, NULL) != 0) { + perror("sigaction"); + exit(EXIT_FAILURE); + } + + raise(SIGSEGV); +} +.EE .SH SEE ALSO .BR kill (1), .BR kill (2),
Signature · 1 line
2.32.0
Re: [PATCH 29/32] sigaction.2: Apply minor tweaks to Peter's patch
Quoted 9 lines · Alejandro Colomar
- Move example program to a new EXAMPLES section
- Invert logic in the handler to have the failure in the conditional path, and the success in out of any conditionals.
- Use NULL,EXIT_SUCCESS, andEXIT_FAILUREinstead of magic numbers
- Separate declarations from code
- Put function return type on its own line
- Put function opening brace on its lineSigned-off-by Alejandro Colomar <[email protected]>
I forgot to CC Peter here.
Quoted 99 lines
--- man2/sigaction.2 | 76 +++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 33 deletions(-)man2/sigaction.2 +43
-33@@ -936,39 +936,6 @@ because they were introduced before Linux 5.11. However, in general, programs may assume that these flags are supported, since they have all been supported since Linux 2.6, which was released in the year 2003. -.PP -The following example program exits with status 0 if -.B SA_EXPOSE_TAGBITS -is determined to be supported, and 1 otherwise. -.PP -.EX -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -void handler(int signo, siginfo_t *info, void *context) { - struct sigaction oldact; - if (sigaction(SIGSEGV, 0, &oldact) == 0 && - !(oldact.sa_flags & SA_UNSUPPORTED) && - (oldact.sa_flags & SA_EXPOSE_TAGBITS)) { - _exit(0); - } else { - _exit(1); - } -} - -int main(void) { - struct sigaction act = {0}; - act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; - act.sa_sigaction = handler; - if (sigaction(SIGSEGV, &act, 0) != 0) { - perror("sigaction"); - return 1; - } - - raise(SIGSEGV); -} -.EE .SH RETURN VALUE .BR sigaction () returns 0 on success; on error, \-1 is returned, and@@ -1174,6 +1141,49 @@ This bug was fixed in kernel 2.6.14. .SH EXAMPLES See .BR mprotect (2). +.PP +The following example program exits with status +.B EXIT_SUCCESS +if +.B SA_EXPOSE_TAGBITS +is determined to be supported, and +.B EXIT_FAILURE +otherwise. +.PP +.EX +#include <signal.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> + +void +handler(int signo, siginfo_t *info, void *context) +{ + struct sigaction oldact; + + if (sigaction(SIGSEGV, NULL, &oldact) != 0 || + (oldact.sa_flags & SA_UNSUPPORTED) || + !(oldact.sa_flags & SA_EXPOSE_TAGBITS)) { + _exit(EXIT_FAILURE); + } + _exit(EXIT_SUCCESS); +} + +int +main(void) +{ + struct sigaction act = {0}; + + act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; + act.sa_sigaction = &handler; + if (sigaction(SIGSEGV, &act, NULL) != 0) { + perror("sigaction"); + exit(EXIT_FAILURE); + } + + raise(SIGSEGV); +} +.EE .SH SEE ALSO .BR kill (1), .BR kill (2),
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 29/32] sigaction.2: Apply minor tweaks to Peter's patch
In reply to Alejandro ColomarDropped, because reposted in a later series from Alex.
Quoted 108 lines · Alejandro Colomar
- Move example program to a new EXAMPLES section
- Invert logic in the handler to have the failure in the conditional path, and the success in out of any conditionals.
- Use NULL,EXIT_SUCCESS, andEXIT_FAILUREinstead of magic numbers
- Separate declarations from code
- Put function return type on its own line
- Put function opening brace on its lineSigned-off-by Alejandro Colomar <[email protected]>--- man2/sigaction.2 | 76 +++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 33 deletions(-)man2/sigaction.2 +43
-33@@ -936,39 +936,6 @@ because they were introduced before Linux 5.11. However, in general, programs may assume that these flags are supported, since they have all been supported since Linux 2.6, which was released in the year 2003. -.PP -The following example program exits with status 0 if -.B SA_EXPOSE_TAGBITS -is determined to be supported, and 1 otherwise. -.PP -.EX -#include <signal.h> -#include <stdio.h> -#include <unistd.h> - -void handler(int signo, siginfo_t *info, void *context) { - struct sigaction oldact; - if (sigaction(SIGSEGV, 0, &oldact) == 0 && - !(oldact.sa_flags & SA_UNSUPPORTED) && - (oldact.sa_flags & SA_EXPOSE_TAGBITS)) { - _exit(0); - } else { - _exit(1); - } -} - -int main(void) { - struct sigaction act = {0}; - act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; - act.sa_sigaction = handler; - if (sigaction(SIGSEGV, &act, 0) != 0) { - perror("sigaction"); - return 1; - } - - raise(SIGSEGV); -} -.EE .SH RETURN VALUE .BR sigaction () returns 0 on success; on error, \-1 is returned, and@@ -1174,6 +1141,49 @@ This bug was fixed in kernel 2.6.14. .SH EXAMPLES See .BR mprotect (2). +.PP +The following example program exits with status +.B EXIT_SUCCESS +if +.B SA_EXPOSE_TAGBITS +is determined to be supported, and +.B EXIT_FAILURE +otherwise. +.PP +.EX +#include <signal.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> + +void +handler(int signo, siginfo_t *info, void *context) +{ + struct sigaction oldact; + + if (sigaction(SIGSEGV, NULL, &oldact) != 0 || + (oldact.sa_flags & SA_UNSUPPORTED) || + !(oldact.sa_flags & SA_EXPOSE_TAGBITS)) { + _exit(EXIT_FAILURE); + } + _exit(EXIT_SUCCESS); +} + +int +main(void) +{ + struct sigaction act = {0}; + + act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS; + act.sa_sigaction = &handler; + if (sigaction(SIGSEGV, &act, NULL) != 0) { + perror("sigaction"); + exit(EXIT_FAILURE); + } + + raise(SIGSEGV); +} +.EE .SH SEE ALSO .BR kill (1), .BR kill (2),
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 30/32 strlen.3, wcslen.3: Add recommendations for safer variants
In reply to Alejandro Colomar--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
man3/strlen.3 +6 -0
@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTES +.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array. .SH SEE ALSO .BR string (3), .BR strnlen (3),
man3/wcslen.3 +8 -1
@@ -58,5 +58,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C99. +.SH NOTES +.SS wcsnlen(3) +If the input buffer size is known, +it is probably better to use +.BR wcsnlen (3), +which can prevent reading past the end of the array. .SH SEE ALSO -.BR strlen (3) +.BR strlen (3), +.BR wcsnlen (3)
Signature · 1 line
2.32.0
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
Hello Alex,
I see there was a rather long mail thread that led to this patch. The patch definitely deserves a commit message.
See also below.
Quoted 12 lines · Alejandro Colomar
Reported-by Jonny Grant <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)man3/strlen.3 +0
-0
man3/strlen.3 T} Thread safety MT-Safe · line 74
Quoted 9 lines
man3/strlen.3 +6
-0@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTES +.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array.
I hesitate slightly about this. strlen() is in the C standard, but strnlen() is not. What do you think; do we need to care?
Thanks,
Michael
Quoted 22 lines
man3/strlen.3 +0
-0.SH SEE ALSO .BR string (3), .BR strnlen (3),man3/wcslen.3 +8
-1@@ -58,5 +58,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C99. +.SH NOTES +.SS wcsnlen(3) +If the input buffer size is known, +it is probably better to use +.BR wcsnlen (3), +which can prevent reading past the end of the array. .SH SEE ALSO -.BR strlen (3) +.BR strlen (3), +.BR wcsnlen (3)
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
Hi, Michael!
Quoted 5 lines · Michael Kerrisk (man-pages)
Hello Alex,
I see there was a rather long mail thread that led to this patch. The patch definitely deserves a commit message.
Maybe this:
[strlen() is normally used as a first step
in a series involving usage of strings.
However, if the input string can possibly not include a terminating null byte '\0', it's safer to use strnlen().
Since there's not much overhead,
and the compiler might already optimize some cases where it knows it can use strlen(),
it's probably wise to recommend strnlen() over strlen(), and be on the safe side, to avoid bugs.
Code coud even be safe in the present,
but in the future start using non-terminated strings and then introduce a bug, if strlen() is used. ]
Quoted 19 lines
See also below.
Quoted 16 lines · Alejandro Colomar
Reported-by Jonny Grant <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)man3/strlen.3 +1
-0@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTES
Quoted 8 lines
man3/strlen.3 T} Thread safety MT-Safe · line 74
Quoted 5 lines
man3/strlen.3 +5
-0+.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array.I hesitate slightly about this.
strlen()is in the C standard, butstrnlen()is not. What do you think; do we need to care?
I think POSIX.1-2008 is enough of a standard. Don't you?
Cheers,
Alex
Quoted 25 lines
Quoted 23 lines
man3/strlen.3 +0
-0.SH SEE ALSO .BR string (3), .BR strnlen (3),man3/wcslen.3 +8
-1@@ -58,5 +58,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C99. +.SH NOTES +.SS wcsnlen(3) +If the input buffer size is known, +it is probably better to use +.BR wcsnlen (3), +which can prevent reading past the end of the array. .SH SEE ALSO -.BR strlen (3) +.BR strlen (3), +.BR wcsnlen (3)
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
In reply to Michael Kerrisk (man-pages)Hi, Michael!
Quoted 24 lines · Michael Kerrisk (man-pages)
Hello Alex,
I see there was a rather long mail thread that led to this patch. The patch definitely deserves a commit message.
See also below.
Quoted 16 lines · Alejandro Colomar
Reported-by Jonny Grant <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)man3/strlen.3 +1
-0@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTES
Quoted 8 lines
man3/strlen.3 T} Thread safety MT-Safe · line 74
Quoted 5 lines
man3/strlen.3 +5
-0+.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array.I hesitate slightly about this.
strlen()is in the C standard, butstrnlen()is not. What do you think; do we need to care?
I have some doubts about this patch, but in a completely different sense:
I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation.
What do you think about this?
Thanks,
Alex
Related: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm
(about the deprecation of Annex K from the C Standard)
Quoted 30 lines
Thanks,
Michael
Quoted 22 lines
man3/strlen.3 +0
-0.SH SEE ALSO .BR string (3), .BR strnlen (3),man3/wcslen.3 +8
-1@@ -58,5 +58,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C99. +.SH NOTES +.SS wcsnlen(3) +If the input buffer size is known, +it is probably better to use +.BR wcsnlen (3), +which can prevent reading past the end of the array. .SH SEE ALSO -.BR strlen (3) +.BR strlen (3), +.BR wcsnlen (3)
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
Hi Alex,
Quoted 38 lines · Alejandro Colomar (man-pages)
Hi, Michael!
Quoted 24 lines · Michael Kerrisk (man-pages)
Hello Alex,
I see there was a rather long mail thread that led to this patch. The patch definitely deserves a commit message.
See also below.
Quoted 16 lines · Alejandro Colomar
Reported-by Jonny Grant <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)man3/strlen.3 +1
-0@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTESQuoted 8 lines
man3/strlen.3 T} Thread safety MT-Safe · line 74
Quoted 5 lines
man3/strlen.3 +5
-0+.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array.I hesitate slightly about this.
strlen()is in the C standard, butstrnlen()is not. What do you think; do we need to care?I have some doubts about this patch, but in a completely different sense:
Quoted 8 lines
I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation.
What do you think about this?
How about a sentence something like:
[[
In cases where the input buffer may not contain a terminating null byte, .BR strnlen (3)
should be used instead.
]]
What do you think?
Thanks,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
Hi Michael,
Quoted 13 lines · Michael Kerrisk (man-pages)
Quoted 10 lines
I have some doubts about this patch, but in a completely different sense:
I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation.
What do you think about this?
How about a sentence something like:
Quoted 7 lines
[[
In cases where the input buffer may not contain a terminating null byte, .BR strnlen (3)
should be used instead.
]]What do you think?
Yes, that's much better. Thanks!
Alex
Quoted 5 lines
Thanks,
Michael
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
Hi Alex,
Quoted 22 lines · Alejandro Colomar (man-pages)
Hi Michael,
Quoted 19 lines · Michael Kerrisk (man-pages)
Quoted 10 lines
I have some doubts about this patch, but in a completely different sense:
I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation.
What do you think about this?
How about a sentence something like:
[[
In cases where the input buffer may not contain a terminating null byte, .BR strnlen (3)
should be used instead.
]]
Quoted 3 lines
Quoted 1 line
What do you think?
Yes, that's much better. Thanks!
Okay. I applied the patch below.
Thanks,
Michael
man3/strlen.3 +5 -0
@@ -64,6 +64,11 @@ T} Thread safety MT-Safe .hy .ad .sp 1 +.SH NOTES +In cases where the input buffer may not contain +a terminating null byte, +.BR strnlen (3) +should be used instead. .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. .SH SEE ALSO
man3/wcslen.3 +5 -0
@@ -56,6 +56,11 @@ T} Thread safety MT-Safe .hy .ad .sp 1 +.SH NOTES +In cases where the input buffer may not contain +a terminating null wide character, +.BR wcsnlen (3) +should be used instead. .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C99. .SH SEE ALSO
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Re: [PATCH 30/32] strlen.3, wcslen.3: Add recommendations for safer variants
In reply to Alejandro Colomar (man-pages)Quoted 36 lines · Alejandro Colomar (man-pages)
Hi, Michael!
Quoted 24 lines · Michael Kerrisk (man-pages)
Hello Alex,
I see there was a rather long mail thread that led to this patch. The patch definitely deserves a commit message.
See also below.
Quoted 16 lines · Alejandro Colomar
Reported-by Jonny Grant <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man3/strlen.3 | 6 ++++++ man3/wcslen.3 | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)man3/strlen.3 +1
-0@@ -66,6 +66,12 @@ T} Thread safety MT-Safe .sp 1 .SH CONFORMING TO POSIX.1-2001, POSIX.1-2008, C89, C99, C11, SVr4, 4.3BSD. +.SH NOTESQuoted 8 lines
man3/strlen.3 T} Thread safety MT-Safe · line 74
Quoted 5 lines
man3/strlen.3 +5
-0+.SS strnlen(3) +If the input buffer size is known, +it is probably better to use +.BR strnlen (3), +which can prevent reading past the end of the array.I hesitate slightly about this.
strlen()is in the C standard, butstrnlen()is not. What do you think; do we need to care?
Quoted 8 lines
I have some doubts about this patch, but in a completely different sense:
I don't know if I'm being a bit paranoid in treating user input. I've always been taught that I should program deffensively, but as time passes by, I realize myself that I was programming too much deffensively, and even introducing bugs in the error handling code. And in many cases, strings will always be NUL-terminated, so maybe I'm just passing around a wrong recommendation.
Seems very important to check.. there are lots of standards that require checking such things. eg ISO 26262 Functional Safety Standard
I know we all know already that many bugs are caused by overruns. A NULL ptr dereference would crash the software. That's a kind of DoS.
Just imagine someone connects a USB device (or any other different) which has a badly formed string, that is not NUL terminated. Or even gets a pointer from HW that is NULL. Unless we check the pointer, the string, we won't know. Typically it will be fine, until it isn't. Users don't want a core dump, they don't want to file a bug report. It's easy enough just to check it is what we expect. We also check numbers are not zero when dividing by a number to avoid SIGFPE when that number came from an external place outside our module.
Cheers, Jonny
PATCH 31/32 time.2: wfix regarding year-2038
In reply to Alejandro ColomarFrom: Viet Than <[email protected]>
--- man2/time.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man2/time.2 +1 -1
@@ -93,7 +93,7 @@ specified as NULL cannot fail with the error .BR EOVERFLOW , even on ABIs where .I time_t -is a signed 32-bit integer and the clock ticks past the time 2**31 +is a signed 32-bit integer and the clock reaches at or beyond the time 2**31 (2038-01-19 03:14:08 UTC, ignoring leap seconds). (POSIX.1 permits, but does not require, the .B EOVERFLOW
Signature · 1 line
2.32.0
Re: [PATCH 31/32] time.2: wfix regarding year-2038
Hi Than,
Quoted 14 lines · Alejandro Colomar
From: Viet Than <[email protected]>
Cc Jakub Wilk <[email protected]>Signed-off-by Viet Than <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man2/time.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)man2/time.2 +0
-0
man2/time.2 specified as NULL cannot fail with the error · line 96
Quoted 5 lines
man2/time.2 +1
-1@@ -93,7 +93,7 @@ specified as NULL cannot fail with the error .BR EOVERFLOW , even on ABIs where .I time_t -is a signed 32-bit integer and the clock ticks past the time 2**31 +is a signed 32-bit integer and the clock reaches at or beyond the time 2**31
"[R]eaches at" is not standard English. More idiomatic would be "reaches or exceeds".
Regards,
Branden
Re: [PATCH 31/32] time.2: wfix regarding year-2038
Quoted 2 lines
"[R]eaches at" is not standard English. More idiomatic would be "reaches or exceeds".
Thanks Branden. Searching around on Google, you're right. Usage of "reaches at or beyond" is way less (1,240 results on Google) than "reaches or exceeds" (376,000 results). I've modified the patch accordingly.
---
man2/time.2 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
man2/time.2 +0 -0
@@ -93,7 +93,7 @@ specified as NULL cannot fail with the error
.BR EOVERFLOW ,
even on ABIs where
.I time_t
-is a signed 32-bit integer and the clock ticks past the time 2**31 +is a signed 32-bit integer and the clock reaches or exceeds 2**31 seconds (2038-01-19 03:14:08 UTC, ignoring leap seconds).
(POSIX.1 permits, but does not require, the
.B EOVERFLOW
Signature · 1 line
2.32.0
Re: [PATCH 31/32] time.2: wfix regarding year-2038
Quoted 9 lines · Viet Than
Quoted 2 lines
"[R]eaches at" is not standard English. More idiomatic would be "reaches or exceeds".
Thanks Branden. Searching around on Google, you're right. Usage of "reaches at or beyond" is way less (1,240 results on Google) than "reaches or exceeds" (376,000 results). I've modified the patch accordingly.
Signed-off-by Viet Than <[email protected]>
Thanks, Viet Than. Patch Applied.
Cheers,
Michael
Quoted 19 lines
---
man2/time.2 | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)man2/time.2 +0
-0@@ -93,7 +93,7 @@ specified as NULL cannot fail with the error .BR EOVERFLOW ,even on ABIs where
.Itime_tman2/time.2 +1
-1-is a signed 32-bit integer and the clock ticks past the time 2**31 +is a signed 32-bit integer and the clock reaches or exceeds 2**31 seconds(2038-01-19 03:14:08 UTC, ignoring leap seconds).
(POSIX.1 permits, but does not require, the
.B EOVERFLOW
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
PATCH 32/32 execve.2: Fix absolute/relative pathname
In reply to Alejandro ColomarFrom: Shawn Landden <[email protected]>
The absolute pathname is available in the Linux-specific auxiliary-vector feature.
--- man2/execve.2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
man2/execve.2 +8 -1
@@ -346,7 +346,9 @@ will be invoked with the following arguments: .PP where .I pathname -is the absolute pathname of the file specified as the first argument of +is the absolute pathname of the file specified (may be relative to +.BR getcwd (3) +of the caller) as the first argument of .BR execve (), and .I arg...
@@ -356,6 +358,11 @@ argument of .BR execve (), starting at .IR argv[1] . +The absolute pathname of the script is also available +in the same auxiliary vector the environment and argument variables are in, as +.BR AT_EXECFN . +See +.BR getauxval (3). Note that there is no way to get the .IR argv[0] that was passed to the
Signature · 1 line
2.32.0
Re: [PATCH 32/32] execve.2: Fix absolute/relative pathname
Hello Alex, Shawn, and Nora,
@Nora, thanks for the bug report.
Quoted 4 lines · Alejandro Colomar
From: Shawn Landden <[email protected]>
The absolute pathname is available in the Linux-specific auxiliary-vector feature.
@Shawn
But this isn't true, as far as I can see. See the following:
[[
$ cat auxv.c #include <link.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h>
extern char **environ;
intmain(int argc, char *argv[])
{
char **p;
/* Walk through the array of pointers in environ */
for (p = environ; *p != NULL; p++)
continue;
/* The auxiliary vector sits just above environ */
p++; /* Step past NULL pointer at end of 'environ' */
printf("auxvec %12p\n", (void *) p);
ElfW(auxv_t) *auxv = (ElfW(auxv_t) *) p;
while (auxv->a_type != 0) {
switch (auxv->a_type) {
case AT_PLATFORM:
/* String identifying hardware platform */
printf("AT_PLATFORM: 0x%llx (string: %s)\n",
(long long) auxv->a_un.a_val, (char *) auxv->a_un.a_val);
break;
case AT_SECURE: /* Was secure-execution mode triggered for dynamic
linker? See ld.so(8). */
printf("AT_SECURE: %lld\n", (long long) auxv->a_un.a_val);
break;
case AT_EXECFN: /* Pathname used to execute program */
printf("AT_EXECFN: 0x%llx (string: %s)\n",
(long long) auxv->a_un.a_val, (char *) auxv->a_un.a_val);
break;
default:
/* We ignore other types of entries in auxiliary vector */
break;
}
auxv++;
}
exit(EXIT_SUCCESS);
}
$ ./auxv
auxvec 0x7ffd5c6eb708
AT_SECURE: 0
AT_EXECFN: 0x7ffd5c6ecff1 (string: ./auxv)
AT_PLATFORM: 0x7ffd5c6eb859 (string: x86_64)
]]Quoted 14 lines
Reported-by Nora Platiel <[email protected]>Signed-off-by Shawn Landden <[email protected]>Reviewed-by Nora Platiel <[email protected]>Signed-off-by Alejandro Colomar <[email protected]>--- man2/execve.2 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)man2/execve.2 +0
-0
man2/execve.2 will be invoked with the following arguments: · line 352
Quoted 8 lines
man2/execve.2 +3
-1@@ -346,7 +346,9 @@ will be invoked with the following arguments: .PP where .I pathname -is the absolute pathname of the file specified as the first argument of +is the absolute pathname of the file specified (may be relative to +.BR getcwd (3) +of the caller) as the first argument of .BR execve (),
I find the "(may be relative...)" piece confusing.
It's simpler just to s/absolute pathname/pathname/, and that's the change I made.
Quoted 4 lines
man2/execve.2 +0
-0and .I arg...@@ -356,6 +358,11 @@ argument of .BR execve (),
man2/execve.2 argument of · line 368
Quoted 10 lines
man2/execve.2 +5
-0starting at .IR argv[1] . +The absolute pathname of the script is also available +in the same auxiliary vector the environment and argument variables are in, as +.BR AT_EXECFN . +See +.BR getauxval (3). Note that there is no way to get the .IR argv[0] that was passed to the
I applied the patch below.
Cheers,
Michael
man2/execve.2 +1 -1
@@ -346,7 +346,7 @@ will be invoked with the following arguments: .PP where .I pathname -is the absolute pathname of the file specified as the first argument of +is the pathname of the file specified as the first argument of .BR execve (), and .I arg...
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Quoted 7 lines · Alejandro Colomar
Hi Michael,
Here is a patch set including patches from others, patches of mine fixing bug reports of others, tweaks to others' patches, and small patches of mine.
I resent in this patch set all the patches that I sent a few weeks ago, so you can ignore any older threads of mine.
Hi Alex,
I think I've now dealt with all of tese, except for two that you reposted in a following series.
Thanks for taking care of all of these patches!
Cheers,
Michael
Quoted 105 lines
--
Alejandro Colomar (11):
readv.2: Minor tweaks to Will's patch
vdso.7: Remove outdated limitation for powerpc vdso.7: Add y2038 compliant gettime for ppc/32 posixoptions.7: Fix legacy functions list (s/getcwd/getwd/) printf.3: wfix
futex.2: Minor tweaks to Kurt's patch capabilities.7: Minor tweaks to Kir's patch seccomp_unotify.2: Minor tweaks to Rodrigo's patch strstr.3: Add special case for empty needle sigaction.2: Apply minor tweaks to Peter's patch strlen.3, wcslen.3: Add recommendations for safer variantsDan Robertson (1):
man2/fallocate.2: tfix documentation of shared blocksJakub Wilk (3):
seccomp_unotify.2: tfix
proc.5: tfix
scripts/bash_aliases: tfixKir Kolyshkin (3):
capabilities.7: tfix
user_namespaces.7: fix a ref
capabilities.7, user_namespaces.7: describeCAP_SETFCAPKurt Kanzenbach (1):
futex.2: DocumentFUTEX_LOCK_PI2Peter Collingbourne (1):
sigaction.2: DocumentSA_EXPOSE_TAGBITSand the flag support detection
protocolRichard Palethorpe (1):
wait.2: Add ESRCH for when pid ==INT_MINRodrigo Campos (1):
seccomp_unotify.2: Add doc forSECCOMP_ADDFD_FLAG_SENDSagar Patel (1):
tkill.2: tfixShawn Landden (1):
execve.2: Fix absolute/relative pathnameThomas Voss (1):
Various pages: Consistently use '*argv[]'Viet Than (1):
time.2: wfix regarding year-2038Will Manley (1):
readv2: Notepreadv2(..., RWF_NOWAIT)bug in BUGS sectionkXuan (1):
recv.2: tfixŠtěpán Němec (2):
path_resolution.7: tfix
namespaces.7: fix confusion caused by text reorganizationнаб (2):
ascii.7: add vertical rule to separate the two columns pipe.7: also mention writev(2) in atomicity sexionman2/bpf.2 | 2 +- man2/copy_file_range.2 | 2 +- man2/execve.2 | 9 ++- man2/fallocate.2 | 2 +- man2/futex.2 | 110 +++++++++++++++++++++---------- man2/membarrier.2 | 4 +- man2/perf_event_open.2 | 2 +- man2/readv.2 | 11 +++- man2/recv.2 | 2 +- man2/seccomp.2 | 2 +- man2/seccomp_unotify.2 | 30 ++++++++- man2/sigaction.2 | 133 ++++++++++++++++++++++++++++++++++++++ man2/time.2 | 2 +- man2/tkill.2 | 2 +- man2/wait.2 | 9 +++ man3/bsearch.3 | 2 +- man3/getopt.3 | 2 +- man3/getsubopt.3 | 2 +- man3/printf.3 | 2 +- man3/pthread_setname_np.3 | 2 +- man3/strlen.3 | 6 ++ man3/strstr.3 | 8 +++ man3/wcslen.3 | 9 ++- man3/wordexp.3 | 2 +- man5/proc.5 | 2 +- man7/ascii.7 | 2 +- man7/capabilities.7 | 9 ++- man7/fanotify.7 | 2 +- man7/namespaces.7 | 4 +- man7/path_resolution.7 | 2 +- man7/pipe.7 | 2 + man7/posixoptions.7 | 2 +- man7/user_namespaces.7 | 8 ++- man7/vdso.7 | 27 +------- scripts/bash_aliases | 2 +- 35 files changed, 330 insertions(+), 89 deletions(-)
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/