Bug 79407 - Shutting off altstacks -> segfault in existing signal handlers
Summary: Shutting off altstacks -> segfault in existing signal handlers
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel
Version: 2.1
Hardware: ia64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Larry Woodman
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-11 12:46 UTC by Johan Walles
Modified: 2007-11-30 22:06 UTC (History)
1 user (show)

Fixed In Version: AS2.1/IPF
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-28 16:30:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Altstack problem demonstration. Works on IA32 but not on IA64. (1.36 KB, text/plain)
2002-12-11 12:48 UTC, Johan Walles
no flags Details
Fix for the 2.5 series, may need backporting (1.20 KB, patch)
2002-12-12 08:55 UTC, Johan Walles
no flags Details | Diff
A similar test case that also needs fixing (1.54 KB, text/plain)
2002-12-16 15:49 UTC, Johan Walles
no flags Details
Backported Mosberger's patch for tpc.016 (1.15 KB, patch)
2002-12-16 22:48 UTC, Tony Luck
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2002:315 0 normal SHIPPED_LIVE New kernel adds optimizations and support for the Intel E8870 chipset 2002-09-23 04:00:00 UTC
Red Hat Product Errata RHEA-2002:317 0 normal SHIPPED_LIVE New kernel adds optimizations and support for the Intel E8870 chipset 2003-09-05 04:00:00 UTC

Description Johan Walles 2002-12-11 12:46:43 UTC
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):


How reproducible:
Always

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
signal stack.


Additional info:

Comment 1 Johan Walles 2002-12-11 12:48:34 UTC
Created attachment 88365 [details]
Altstack problem demonstration.  Works on IA32 but not on IA64.

Comment 2 Johan Walles 2002-12-12 08:55:15 UTC
Created attachment 88528 [details]
Fix for the 2.5 series, may need backporting

Comment 3 Johan Walles 2002-12-12 08:57:06 UTC
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.

Comment 4 Johan Walles 2002-12-16 15:49:28 UTC
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
IA32.

Comment 5 Tony Luck 2002-12-16 22:48:03 UTC
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.

Comment 6 Johan Walles 2003-01-09 09:35:50 UTC
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?

Comment 7 Johan Walles 2003-01-09 09:40:55 UTC
Oops, seems Tony didn't get my last comment.  Tony, would it be possible for you
to verify the second test case as well?

Comment 8 Tony Luck 2003-01-09 16:42:55 UTC
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:
$ ./sigaltstack5
main(): Hello
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.

Comment 9 Jason Baron 2003-01-16 23:07:06 UTC
This patch has been incorporated into the pending errata.

Comment 10 Tony Luck 2003-01-17 23:33:12 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.