public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Also mark ELF solib trampoline minimal symbols special
@ 2014-09-17 23:03 Maciej W. Rozycki
  2014-09-26 22:12 ` [PING][PATCH] " Maciej W. Rozycki
  2014-10-03 11:51 ` [PATCH] " Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2014-09-17 23:03 UTC (permalink / raw)
  To: gdb-patches

Hi,

 In installing minimal symbols for ELF shared library trampolines we 
"forget" to make individual symbols special where required.  This leads to 
problems on the MIPS target using microMIPS SVR4 lazy stubs.  Lacking the 
special annotation these stubs are treated as standard MIPS code and this 
makes GDB insert the wrong software breakpoint instruction, breaking e.g. 
single-stepping through these stubs.  This is not a very frequent scenario 
as microMIPS SVR4 lazy stubs are typically only used in shared libraries 
with the main executable using PLT, handled elsewhere.  Still it triggers 
e.g. when a software watchpoint has been installed.  The symptom is SIGILL 
or the program going astray, depending on the endianness.  Disassembly of 
these stubs is also wrong.

 Regression-tested with the mips-linux-gnu target and the following 
multilibs:

-EB
-EB -msoft-float
-EB -mips16
-EB -mips16 -msoft-float
-EB -mmicromips
-EB -mmicromips -msoft-float
-EB -mabi=n32
-EB -mabi=n32 -msoft-float
-EB -mabi=64
-EB -mabi=64 -msoft-float

and the -EL variants of same with no regressions and the following 
big-endian failures removed:

(gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main
continue
Continuing.

Program received signal SIGILL, Illegal instruction.
0x2aad36ab in _dl_sym () at dl-sym.c:282
282	{
(gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to foo again
continue
Continuing.

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.
(gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again

and similarly for the little endianness:

(gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main
continue
Continuing.
FAIL: gdb.base/watchpoint-solib.exp: continue to foo again (timeout)
continue
FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again (timeout)

-- across the -mmicromips multilibs.

 OK to apply?

2014-09-17  Maciej W. Rozycki  <macro@codesourcery.com>

	gdb/
	* elfread.c (elf_symtab_read): Also mark solib trampoline minimal 
	symbols special.

  Maciej

gdb-msymbol-solib-trampoline-special.diff
Index: gdb-fsf-trunk-quilt/gdb/elfread.c
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/elfread.c	2014-08-23 01:11:20.000000000 +0100
+++ gdb-fsf-trunk-quilt/gdb/elfread.c	2014-09-16 22:56:52.318922758 +0100
@@ -328,7 +328,10 @@ elf_symtab_read (struct objfile *objfile
 	    (sym->name, strlen (sym->name), copy_names,
 	     symaddr, mst_solib_trampoline, sect, objfile);
 	  if (msym != NULL)
-	    msym->filename = filesymname;
+	    {
+	      msym->filename = filesymname;
+	      gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
+	    }
 	  continue;
 	}
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PING][PATCH] Also mark ELF solib trampoline minimal symbols special
  2014-09-17 23:03 [PATCH] Also mark ELF solib trampoline minimal symbols special Maciej W. Rozycki
@ 2014-09-26 22:12 ` Maciej W. Rozycki
  2014-10-03 11:39   ` [PING^2][PATCH] " Maciej W. Rozycki
  2014-10-03 11:51 ` [PATCH] " Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2014-09-26 22:12 UTC (permalink / raw)
  To: gdb-patches

On Thu, 18 Sep 2014, Maciej W. Rozycki wrote:

>  In installing minimal symbols for ELF shared library trampolines we 
> "forget" to make individual symbols special where required.  This leads to 
> problems on the MIPS target using microMIPS SVR4 lazy stubs.  Lacking the 
> special annotation these stubs are treated as standard MIPS code and this 
> makes GDB insert the wrong software breakpoint instruction, breaking e.g. 
> single-stepping through these stubs.  This is not a very frequent scenario 
> as microMIPS SVR4 lazy stubs are typically only used in shared libraries 
> with the main executable using PLT, handled elsewhere.  Still it triggers 
> e.g. when a software watchpoint has been installed.  The symptom is SIGILL 
> or the program going astray, depending on the endianness.  Disassembly of 
> these stubs is also wrong.
> 
>  Regression-tested with the mips-linux-gnu target and the following 
> multilibs:
> 
> -EB
> -EB -msoft-float
> -EB -mips16
> -EB -mips16 -msoft-float
> -EB -mmicromips
> -EB -mmicromips -msoft-float
> -EB -mabi=n32
> -EB -mabi=n32 -msoft-float
> -EB -mabi=64
> -EB -mabi=64 -msoft-float
> 
> and the -EL variants of same with no regressions and the following 
> big-endian failures removed:
> 
> (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main
> continue
> Continuing.
> 
> Program received signal SIGILL, Illegal instruction.
> 0x2aad36ab in _dl_sym () at dl-sym.c:282
> 282	{
> (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to foo again
> continue
> Continuing.
> 
> Program terminated with signal SIGILL, Illegal instruction.
> The program no longer exists.
> (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again
> 
> and similarly for the little endianness:
> 
> (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main
> continue
> Continuing.
> FAIL: gdb.base/watchpoint-solib.exp: continue to foo again (timeout)
> continue
> FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again (timeout)
> 
> -- across the -mmicromips multilibs.
> 
>  OK to apply?
> 
> 2014-09-17  Maciej W. Rozycki  <macro@codesourcery.com>
> 
> 	gdb/
> 	* elfread.c (elf_symtab_read): Also mark solib trampoline minimal 
> 	symbols special.

 Ping!

  Maciej

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PING^2][PATCH] Also mark ELF solib trampoline minimal symbols special
  2014-09-26 22:12 ` [PING][PATCH] " Maciej W. Rozycki
@ 2014-10-03 11:39   ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2014-10-03 11:39 UTC (permalink / raw)
  To: gdb-patches

Hi,

 This patch:

http://sourceware.org/ml/gdb-patches/2014-09/msg00602.html

is still waiting, please review.

 Thanks,

  Maciej

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Also mark ELF solib trampoline minimal symbols special
  2014-09-17 23:03 [PATCH] Also mark ELF solib trampoline minimal symbols special Maciej W. Rozycki
  2014-09-26 22:12 ` [PING][PATCH] " Maciej W. Rozycki
@ 2014-10-03 11:51 ` Pedro Alves
  2014-10-03 16:45   ` Maciej W. Rozycki
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2014-10-03 11:51 UTC (permalink / raw)
  To: Maciej W. Rozycki, gdb-patches

On 09/18/2014 12:03 AM, Maciej W. Rozycki wrote:

>  OK to apply?

OK.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Also mark ELF solib trampoline minimal symbols special
  2014-10-03 11:51 ` [PATCH] " Pedro Alves
@ 2014-10-03 16:45   ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2014-10-03 16:45 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Fri, 3 Oct 2014, Pedro Alves wrote:

> >  OK to apply?
> 
> OK.

 Applied, thanks.

  Maciej

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-03 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-17 23:03 [PATCH] Also mark ELF solib trampoline minimal symbols special Maciej W. Rozycki
2014-09-26 22:12 ` [PING][PATCH] " Maciej W. Rozycki
2014-10-03 11:39   ` [PING^2][PATCH] " Maciej W. Rozycki
2014-10-03 11:51 ` [PATCH] " Pedro Alves
2014-10-03 16:45   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).