Red Hat Bugzilla – Bug 79407
Shutting off altstacks -> segfault in existing signal handlers
Last modified: 2007-11-30 17:06:52 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130
Description of problem:
Will attach a C program that works fine on IA32 but segfaults on IA64.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Write a program that sets up an alternative signal stack.
2. Register an altstack-using signal handler.
3. Disable the alternative signal stack and free() it.
4. Receive the signal.
Actual Results: Segfault.
Expected Results: The last signal should have been handled on the ordinary
Created attachment 88365 [details]
Altstack problem demonstration. Works on IA32 but not on IA64.
Created attachment 88528 [details]
Fix for the 2.5 series, may need backporting
Quoting David Mosberger's e-mail containing the patch:
Actually, just looking at the code, it's pretty obvious what's wrong.
Looks like the attached fix was overlooked by me when the
corresponding fix was made on the x86.
Caveat: the attached patch is is for 2.5 and untested.
Created attachment 88757 [details]
A similar test case that also needs fixing
This is a very similar testcase that also needs fixing. I have no idea whether
this test case is covered by the same patch as the other one, but this should
be working as well. It sets up an altstack, tears it down, registers an
altstack-using signal handler and raise()s the signal.
Just as with the other test case, this segfaults on IA64 but works fine on
Created attachment 88771 [details]
Backported Mosberger's patch for tpc.016
David's proposed patch doesn't apply cleanly to tpc.016, but the problem is a
trivial re-format of the comment covered by the scope of this patch in 2.5 to
make it conform to Linux coding style.
Here's a version of the patch backported for tpc.016. With this patch applied
the sigaltstack4.c program runs correctly on ia64.
FWIW Mosberger says this patch is good for both test cases. Tony, as you seem
to be up and running with a patched kernel, could you verify the second test
case as well?
Oops, seems Tony didn't get my last comment. Tony, would it be possible for you
to verify the second test case as well?
I just checked the second test case (sigaltstack5.c) on my kernel running with
the above patch applied. It runs perfectly, here's the output:
main(): Done setting up altstack
main(): Done tearing down altstack
main(): Done setting up the signal handler
Signal handler: Hello
main(): Back from signal handling
Since I was updating this bugzilla report anyway, I wanted to increase the
priority to "high". This bug is preventing a customer from beginning their
testing (as I explained to Larry Woodman last Thursday (Jan 2nd)). Bugzilla
won't let me as I'm not the owner.
This patch has been incorporated into the pending errata.
Just downloaded the QA cycle version of the e.14 errata kernel that Tim Burke
just announced. It builds & boots ok, and both of the sigaltstack4 and
sigaltstack5 test programs attached to this bug run correctly. Thanks.