Note: below I am not arguing to whether it isCould you please point and cite the spec that saysI take your point: the text of the spec could be more precise. It
exactly this?
does not provide a complete support for my assertion.
But, I do think the interpretation I suggest is the more natural one,
for many reasons:
1. The field is named '*flags', which commonly means a bit mask.Indeed, but the value suggests otherwise.
2. The example in that you mention that is in the spec is part ofWell, yes, those are the practical arguments that
the spec. It illustrates the understanding of the developers
of the spec about the interface they were specifying.
3. Various existing implementations treat the field as a bit mask
for which there is only one valid bit (SS_DISABLE), doing
tests of the form (ss.ss_flags & SS_DISABLE).
4. Some implementations (including *all* the ones that I looked at
the source code for, that is Illumos, FreeBSD, OpenBSD)
explicitly error if ss.ss_flags has bits other than SS_DISABLE set.
6. Before kernel 2.4 (Jan 2001), Linux also used to do 3 & 4!Is there a discussion about this change somewhere?
8. The standard explicitly mentions that SS_ONSTACK may be returnedBut this doesn't matter as they "seemingly" allow
in old_ss.ss_flags, but makes no mention of the use of SS_ONSTACK
in ss.ss_flags. That fact should, IMO, be taken as a strong hint
that the standard developers did not believe that SS_ONSTACK was
to be used with ss.ss_flags.
By "random points" I meant that sas swaps backI'm not sure what you mean by "currently" here. I'm pointingWhat do you mean?See my comment above. It's weird because it will disappear at exitAPI history is littered with stories where users found out thatIt will disappear at the exit from SIGA.
something unforeseen "worked", and so they used it. The question
is: what can go wrong if people do try using this "feature"?
To me this is "wrong enough" to not suggest doing so.
from SIGA, but not "wrong".
There was no any notion of the "sigaltstack scope",
so with the existing semantic it is wrong, because
currently sigaltstack has no scope and can't change
out that whereas before one could not change the signal stack
while executing a handler that is using a signal stack, now it
seems to be possible. But, it's not random: the programmer must
explicitly make this happen (and be lucky in the timing of signals).
This is entirely up to you. My point is just that it isat random moments. You can make it "not wrong"I don't think I'm inventing a new semantic. I think you already
by inventing a new semantic with some notion of
the "sigaltstack scope" though. Whether it worth the
troubles, is what we will see. :)
did that :-). The question is what we should say about it in the
man page. I don't think being silent on this detail is the way to
go. Perhaps noting a few details and warning the reader strongly
against relying on this "feature" in any way is appropriate?
Yes, but I don't see what the man page should saySee above. I'm not sure that we want to specify things to thisIf you are going to add the scoped/nested sigaltstacks,The kernel already has the sigaltstack test-case,I must admit I'm still trying to grasp some details of what's
so maybe you can add some checks to it from your
test-case.
possible. What tests do you think could be usefully added?
then perhaps you should add the test that nesting works
correctly (you have that already in your test-case), and
maybe also the direct manipulations to uc_stack, as this
is the only _reliable_ way to set the new sas inside the
sighandler, that I can think of.
level. But my point is that in the lack of any text in the man
page on the topic, some user-space programmers will discover the
feature and perhaps try to use it. The question is what the man
page should say to those programmers. Do you see what I mean?