[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patches] [patch] Fix for debug/tst-backtrace{5, 6} failure of 32-bit libc on 64-bit host



Greetings,

As far as I can tell, debug/tst-backtrace{5,6} are eglibc-local, so I am
sending the patch here.

When running "make check" in eglibc (SVN trunk) built for i686 with gcc-4.7
on a x86_64 Linux host, I see two failures:

debug/tst-backtrace5:

Obtained backtrace with 7 functions
Function 0: /build32/debug/tst-backtrace5(handle_signal+0x1a) [0x80490ba]
Function 1: linux-gate.so.1(__kernel_sigreturn+0) [0x55579400]
Function 2: linux-gate.so.1(__kernel_vsyscall+0x10) [0x55579430]
Function 3: /build32/libc.so.6(__read+0x23) [0x55657c13]
Function 4: /build32/debug/tst-backtrace5(fn+0xae) [0x804948e]
Function 5: /build32/debug/tst-backtrace5(fn+0x1e) [0x80493fe]
Function 6: /build32/debug/tst-backtrace5(fn+0x1e) [0x80493fe]
Failure on line 87

I believe above failure is due to the test not accounting for VDSO.


debug/tst-backtrace6:

Obtained backtrace with 7 functions
Function 0: /build32/debug/tst-backtrace6(handle_signal+0x1a) [0x804910a]
Function 1: linux-gate.so.1(__kernel_sigreturn+0) [0x55579400]
Function 2: /build32/debug/tst-backtrace6(noreturn_func+0) [0x80493e0]
Function 3: /build32/debug/tst-backtrace6() [0x80494d2]
Function 4: /build32/debug/tst-backtrace6(fn+0x2a) [0x804941a]
Function 5: /build32/debug/tst-backtrace6(fn+0x2a) [0x804941a]
Function 6: /build32/debug/tst-backtrace6() [0x80494ef]
Failure on line 96

This failure is due to GCC laying out fn code like so:


(gdb) x/3i 0x080494c8
   0x80494c8 <fn+216>:  call   0x8048dcc <_exit@plt>
   0x80494cd <fn+221>:  call   0x80493e0 <noreturn_func>
   0x80494d2:   lea    0x0(%esi,%eiz,1),%esi                <<< no name "padding"


This failure also shows up in 64-bit mode:

(gdb) x/3i 0x401c91
   0x401c91 <fn+161>:   callq  0x401288 <_exit@plt>
   0x401c96 <fn+166>:   callq  0x401be0 <noreturn_func>
   0x401c9b:    nop                                        <<< PC points here.


Attached patch fixes both failures.

Thanks,
--
Paul Pluzhnikov


2012-02-20  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>

	* debug/tst-backtrace5.c (handle_signal): Adjust for VDSO.
	* debug/tst-backtrace6.c (handle_signal): Adjust for GCC-4.7
	noreturn optimization.



Index: debug/tst-backtrace5.c
===================================================================
--- debug/tst-backtrace5.c	(revision 17223)
+++ debug/tst-backtrace5.c	(working copy)
@@ -82,12 +82,17 @@
       return;
     }
   /* Do not check name for signal trampoline.  */
-  if (strstr (symbols[2], "read") == NULL)
+  i = 2;
+  if (strstr (symbols[i++], "read") == NULL)
     {
-      FAIL ();
-      return;
+      /* Perhaps symbols[2] is __kernel_vsyscall?  */
+      if (strstr (symbols[i++], "read") == NULL)
+	{
+	  FAIL ();
+	  return;
+	}
     }
-  for (i = 3; i < n - 1; i++)
+  for (; i < n - 1; i++)
     if (strstr (symbols[i], "fn") == NULL)
       {
 	FAIL ();
Index: debug/tst-backtrace6.c
===================================================================
--- debug/tst-backtrace6.c	(revision 17223)
+++ debug/tst-backtrace6.c	(working copy)
@@ -90,7 +90,9 @@
       FAIL ();
       longjmp (b, 1);
     }
-  for (i = 3; i < n - 1; i++)
+  /* Ignore level 3: it may or may not have a name due to GCC's
+     noreturn optimization.  */
+  for (i = 4; i < n - 1; i++)
     if (strstr (symbols[i], "fn") == NULL)
       {
 	FAIL ();
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches