diff mbox

[SPARC] Small tweak to Solaris unwinder

Message ID 201201091920.23445.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou Jan. 9, 2012, 6:20 p.m. UTC
On the recent Solaris 10 version I have access to (s10_72), the kernel/libc 
sometimes calls the call_user_handler routines with a null returned address.
This is responsible for the last ACATS failure (cb1010c).  But, in most cases, 
the address is the expected one, so it isn't clear if this is a bug or not.

Tested on Solaris 8, 9 and 10, applied on mainline, 4.6 and 4.5 branches.


2012-01-09  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sol2-unwind.h (sparc64_is_sighandler): Check that the
	purported sigacthandler address isn't null before dereferencing it.
	(sparc_is_sighandler): Likewise.

Comments

Rainer Orth Jan. 9, 2012, 7:35 p.m. UTC | #1
Eric Botcazou <ebotcazou@adacore.com> writes:

> On the recent Solaris 10 version I have access to (s10_72), the kernel/libc 

s10_72 is anything but recent: this is a Solaris 10 Express/Beta build
which even predates Solaris 10 FCS (s10_74L2a), so this is ancient
history by now.  I suggest not caring about anything pre-FCS by now.

	Rainer
diff mbox

Patch

Index: config/sparc/sol2-unwind.h
===================================================================
--- config/sparc/sol2-unwind.h	(revision 183005)
+++ config/sparc/sol2-unwind.h	(working copy)
@@ -124,10 +124,9 @@  sparc64_is_sighandler (unsigned int *pc,
 	  /* This matches the call_user_handler pattern for Solaris 10.
 	     There are 2 cases so we look for the return address of the
 	     caller's caller frame in order to do more pattern matching.  */
-	  unsigned int sah_pattern
-	    = *(unsigned int *)(*(unsigned long *)(cfa + 176 + 15*8) - 4);
+	  unsigned long sah_address = *(unsigned long *)(cfa + 176 + 15*8);
 
-          if (sah_pattern == 0x92100019)
+          if (sah_address && *(unsigned int *)(sah_address - 4) == 0x92100019)
 	    /* This is the same setup as for Solaris 9, see below.  */
 	    *nframes = 3;
 	  else
@@ -302,10 +301,9 @@  sparc_is_sighandler (unsigned int *pc, v
 	  /* This matches the call_user_handler pattern for Solaris 10.
 	     There are 2 cases so we look for the return address of the
 	     caller's caller frame in order to do more pattern matching.  */
-	  unsigned int sah_pattern
-	    = *(unsigned int *)(*(unsigned int *)(cfa + 96 + 15*4) - 4);
+	  unsigned int sah_address = *(unsigned int *)(cfa + 96 + 15*4);
 
-          if (sah_pattern == 0x92100019)
+          if (sah_address && *(unsigned int *)(sah_address - 4) == 0x92100019)
 	    /* This is the same setup as for Solaris 9, see below.  */
 	    *nframes = 3;
 	  else