sigaltstack.2: Tighten the BUGS wording a little

From a conversation with Walter Harms:

    > i am confused, i understand that:
    >            ss.ss_sp = malloc(SIGSTKSZ);
    >
    >            ss.ss_size = SIGSTKSZ;
    >            ss.ss_flags = 0;
    >            if (sigaltstack(&ss, NULL) == -1)
    >
    > is equivalent to:
    >            ss.ss_sp = malloc(SIGSTKSZ);
    >
    >            ss.ss_size = SIGSTKSZ;
    >            ss.ss_flags = SS_ONSTACK ;
    >            if (sigaltstack(&ss, NULL) == -1)
    >
    > but also to
    >            ss.ss_sp = malloc(SIGSTKSZ);
    >
    >            ss.ss_size = SIGSTKSZ;
    >            ss.ss_flags = SS_ONSTACK | SOMETHING_FLAG ;
    >            if (sigaltstack(&ss, NULL) == -1)
    >
    > so the use of SS_ONSTACK would result in ss.ss_flags = 0 no matter what.
    > OR
    > SS_ONSTACK is a no-op in Linux

    I see what you mean. The point is back then that SS_ONSTACK was
    the only flag that could (on Linux) be specified in ss.ss_flags,
    so that "SS_ONSTACK | SOMETHING_FLAG" was a nonexistent case.
    These days, it's possible to specify the new SS_AUTODISARM
    flag in ss.ss_flags, which I think is why you are doubtful
    about the new page text.

Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-10-30 11:48:53 +01:00
parent 006ac5f09d
commit a86cae6189
1 changed files with 13 additions and 8 deletions

View File

@ -323,6 +323,11 @@ if (sigaction(SIGSEGV, &sa, NULL) == -1) {
.EE
.in
.SH BUGS
In Linux 2.2 and earlier, the only flag that could be specified
in
.I ss.sa_flags
was
.BR SS_DISABLE .
In the lead up to the release of the Linux 2.4 kernel,
.\" Linux 2.3.40
.\" After quite a bit of web and mail archive searching,
@ -331,13 +336,11 @@ In the lead up to the release of the Linux 2.4 kernel,
.\" explained -- mtk
a change was made to allow
.BR sigaltstack ()
to accept
.B SS_ONSTACK
in
.IR ss.ss_flags ,
which results in behavior that is the same as when
.I ss_flags
is 0 (i.e., the inclusion of
to allow
.I ss.ss_flags==SS_ONSTACK
with the same meaning as
.IR "ss.ss_flags==0"
(i.e., the inclusion of
.B SS_ONSTACK
in
.I ss.ss_flags
@ -346,7 +349,9 @@ On other implementations, and according to POSIX.1,
.B SS_ONSTACK
appears only as a reported flag in
.IR old_ss.ss_flags .
On Linux, there is no need ever to specify this flag in
On Linux, there is no need ever to specify
.B SS_ONSTACK
in
.IR ss.ss_flags ,
and indeed doing so should be avoided on portability grounds:
various other systems