Skip to contentSkip to conversation

signal(7) fixes

PATCH Superseded Dev Jain 3 participants 5 messages Jun 7, 2024 – Jun 9, 2024 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dev Jain

author
#0 lore raw

cover signal(7) fixes

This is a follow-up to the following:
https://lore.kernel.org/all/[email protected]/

This series brings distinction between the set of blocked signals represented in uc_sigmask, and the actual set of blocked signals. Also, fix a wrong mention of sigprocmask(), and replace it with sigaction().

Dev Jain (2):
signal.7: Clearly describe ucontext kernel dump to userspace signal.7: Fix wrong mention of sigprocmask

 man/man7/signal.7 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 signal.7: Clearly describe ucontext kernel dump to userspace

The set of blocked signals is updated from struct sigaction after the kernel dumps ucontext. Mention this to avoid misunderstanding.

---
 man/man7/signal.7 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
man/man7/signal.7 +9 -1
index 4ba5306c8..17e75c86d 100644
@@ -282,7 +282,15 @@ the thread's alternate signal stack settings.
 .B SA_SIGINFO
 flag, then the above information is accessible via the
 .I ucontext_t
-object that is pointed to by the third argument of the signal handler.)
+object that is pointed to by the third argument of the signal handler.
+We emphasize on the fact that this object contains context information
+of the thread, present before jumping into the handler; the set of
+blocked signals for the current thread would be updated from struct
+sigaction only after
+.I ucontext_t
+has been dumped to userspace. This semantically makes sense since the
+context for which the signals have been blocked, remains only during
+execution of the handler.)
 .IP (1.4)
 Any signals specified in
 .I act\->sa_mask
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] signal.7: Clearly describe ucontext kernel dump to userspace

man/man7/signal.7 the thread's alternate signal stack settings. · line 286

Quoted 4 lines · Dev Jain

.I ucontext_t

man/man7/signal.7 +2 -1
-object that is pointed to by the third argument of the signal handler.)
+object that is pointed to by the third argument of the signal handler.
+We emphasize on the fact that this object contains context information

s/We emphasize on the fact that/Note that/

feels more idiomatic.

man/man7/signal.7 the thread's alternate signal stack settings. · line 288

Quoted 2 lines
man/man7/signal.7 +2 -0
+of the thread, present before jumping into the handler; the set of
+blocked signals for the current thread would be updated from struct

s/would/will/

man/man7/signal.7 the thread's alternate signal stack settings. · line 293

Quoted 5 lines
man/man7/signal.7 +5 -0
+sigaction only after
+.I ucontext_t
+has been dumped to userspace. This semantically makes sense since the
+context for which the signals have been blocked, remains only during
+execution of the handler.)

I'd drop the "this semantically makes sense" and reword the last bit to be something like "The ucontext reflects the state at the time the signal is delivered rather than in the handler" for idiom reasons.

#3 lore raw

Re: [PATCH 1/2] signal.7: Clearly describe ucontext kernel dump to userspace

Hi Mark, Dev,

Quoted 10 lines · Mark Brown

man/man7/signal.7 the thread's alternate signal stack settings. · line 286

Quoted 4 lines · Dev Jain

.I ucontext_t

man/man7/signal.7 +2 -1
-object that is pointed to by the third argument of the signal handler.)
+object that is pointed to by the third argument of the signal handler.
+We emphasize on the fact that this object contains context information

s/We emphasize on the fact that/Note that/

feels more idiomatic.

Even more idiomatic is to jump straight to the point, without noting it. If it weren't notable, we wouldn't say it. :)

Quoted 9 lines

man/man7/signal.7 the thread's alternate signal stack settings. · line 288

Quoted 3 lines
man/man7/signal.7 +2 -0
+of the thread, present before jumping into the handler; the set of
+blocked signals for the current thread would be updated from struct

s/would/will/

man/man7/signal.7 the thread's alternate signal stack settings. · line 291

Quoted 3 lines
man/man7/signal.7 +3 -0
+sigaction only after
+.I ucontext_t
+has been dumped to userspace. This semantically makes sense since the

Please use semantic newlines. See man-pages:

$ MANWIDTH=72 man man-pages | sed -n '/Use semantic newlines/,/^$/p'
   Use semantic newlines
     In the source of a manual page, new sentences should be started on
     new lines, long sentences should be split  into  lines  at  clause
     breaks  (commas,  semicolons, colons, and so on), and long clauses
     should be split at phrase boundaries.  This convention,  sometimes
     known as "semantic newlines", makes it easier to see the effect of
     patches, which often operate at the level of individual sentences,
     clauses, or phrases.
Quoted 6 lines

man/man7/signal.7 the thread's alternate signal stack settings. · line 293

Quoted 2 lines
man/man7/signal.7 +2 -0
+context for which the signals have been blocked, remains only during
+execution of the handler.)

I'd drop the "this semantically makes sense" and reword the last bit to be something like "The ucontext reflects the state at the time the signal is delivered rather than in the handler" for idiom reasons.

Thank you both.

Have a lovely day!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>
author
#4 lore raw

PATCH 2/2 signal.7: Fix wrong mention of sigprocmask

In reply to Dev Jain

The handler is registered with sigaction(), not sigprocmask(). Even if the purpose of writing sigprocmask() here was to mention blocked signals, the statement currently concerns the "addition" of blocked signals; signals blocked through sigprocmask() would already be present in the thread context of blocked signals.

Fixes e7a5700 (getcontext.3, signal.7: tfix)
---
 man/man7/signal.7 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man/man7/signal.7 +1 -1
index 17e75c86d..09d30c678 100644
@@ -295,7 +295,7 @@ execution of the handler.)
 Any signals specified in
 .I act\->sa_mask
 when registering the handler with
-.BR sigprocmask (2)
+.BR sigaction (2)
 are added to the thread's signal mask.
 The signal being delivered is also
 added to the signal mask, unless
Signature · 1 line
2.34.1