* [patch] Fix crash in svr4_clear_so
@ 2013-05-21 22:23 Paul Pluzhnikov
2013-05-21 23:14 ` Doug Evans
2013-05-22 10:32 ` Gary Benson
0 siblings, 2 replies; 3+ messages in thread
From: Paul Pluzhnikov @ 2013-05-21 22:23 UTC (permalink / raw)
To: gdb-patches; +Cc: ppluzhnikov
Greetings,
Using current trunk, I've got a GDB core dump when I tried to analyze
mis-matched binary and core:
gdb a.out core
GNU gdb (GDB) 7.6.50.20130521-cvs
...
warning: core file may not match specified executable file.
[New LWP 29265]
...
[New LWP 27085]
[New LWP 27052]
warning: Error reading shared library list entry at 0x3b48104f8b480000
Segmentation fault
The actual crash is happening here:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000481376 in svr4_clear_so (so=0xc833490) at ../../src/gdb/solib-svr4.c:974
974 so->lm_info->l_addr_p = 0;
#0 0x0000000000481376 in svr4_clear_so (so=0xc833490) at ../../src/gdb/solib-svr4.c:974
#1 0x0000000000708bc4 in clear_so (so=0xc833490) at ../../src/gdb/solib.c:537
#2 0x0000000000708bef in free_so (so=0xc833490) at ../../src/gdb/solib.c:556
#3 0x00000000006ee328 in do_free_so (arg=0xc833490) at ../../src/gdb/utils.c:492
#4 0x0000000000573474 in do_my_cleanups (pmy_chain=0xc5c1f0 <cleanup_chain>, old_chain=0x35232410) at ../../src/gdb/cleanups.c:155
#5 0x00000000005734e1 in do_cleanups (old_chain=0x35232410) at ../../src/gdb/cleanups.c:177
#6 0x00000000004817e0 in svr4_read_so_list (lm=4271682180386127872, link_ptr_ptr=0x7fff7fc37c58, ignore_first=1) at ../../src/gdb/solib-svr4.c:1195
#7 0x0000000000481b01 in svr4_current_sos () at ../../src/gdb/solib-svr4.c:1311
#8 0x0000000000708eea in update_solib_list (from_tty=0, target=0xc724c0 <core_ops>) at ../../src/gdb/solib.c:674
...
Attached patch fixes the GDB crash.
Ok for trunk?
Thanks,
--
2013-05-21 Paul Pluzhnikov <ppluzhnikov@google.com>
* solib-svr4.c (svr4_free_so): Protect against NULL dereference.
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.177
diff -p -u -r1.177 solib-svr4.c
--- solib-svr4.c 6 May 2013 22:18:38 -0000 1.177
+++ solib-svr4.c 21 May 2013 22:19:09 -0000
@@ -971,7 +971,8 @@ svr4_free_so (struct so_list *so)
static void
svr4_clear_so (struct so_list *so)
{
- so->lm_info->l_addr_p = 0;
+ if (so->lm_info != NULL)
+ so->lm_info->l_addr_p = 0;
}
/* Free so_list built so far (called via cleanup). */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix crash in svr4_clear_so
2013-05-21 22:23 [patch] Fix crash in svr4_clear_so Paul Pluzhnikov
@ 2013-05-21 23:14 ` Doug Evans
2013-05-22 10:32 ` Gary Benson
1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2013-05-21 23:14 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: gdb-patches
On Tue, May 21, 2013 at 3:23 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> Greetings,
>
> Using current trunk, I've got a GDB core dump when I tried to analyze
> mis-matched binary and core:
>
> gdb a.out core
> GNU gdb (GDB) 7.6.50.20130521-cvs
> ...
> warning: core file may not match specified executable file.
> [New LWP 29265]
> ...
> [New LWP 27085]
> [New LWP 27052]
> warning: Error reading shared library list entry at 0x3b48104f8b480000
> Segmentation fault
>
> The actual crash is happening here:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000481376 in svr4_clear_so (so=0xc833490) at ../../src/gdb/solib-svr4.c:974
> 974 so->lm_info->l_addr_p = 0;
>
> #0 0x0000000000481376 in svr4_clear_so (so=0xc833490) at ../../src/gdb/solib-svr4.c:974
> #1 0x0000000000708bc4 in clear_so (so=0xc833490) at ../../src/gdb/solib.c:537
> #2 0x0000000000708bef in free_so (so=0xc833490) at ../../src/gdb/solib.c:556
> #3 0x00000000006ee328 in do_free_so (arg=0xc833490) at ../../src/gdb/utils.c:492
> #4 0x0000000000573474 in do_my_cleanups (pmy_chain=0xc5c1f0 <cleanup_chain>, old_chain=0x35232410) at ../../src/gdb/cleanups.c:155
> #5 0x00000000005734e1 in do_cleanups (old_chain=0x35232410) at ../../src/gdb/cleanups.c:177
> #6 0x00000000004817e0 in svr4_read_so_list (lm=4271682180386127872, link_ptr_ptr=0x7fff7fc37c58, ignore_first=1) at ../../src/gdb/solib-svr4.c:1195
> #7 0x0000000000481b01 in svr4_current_sos () at ../../src/gdb/solib-svr4.c:1311
> #8 0x0000000000708eea in update_solib_list (from_tty=0, target=0xc724c0 <core_ops>) at ../../src/gdb/solib.c:674
> ...
>
> Attached patch fixes the GDB crash.
>
> Ok for trunk?
>
> Thanks,
> --
>
> 2013-05-21 Paul Pluzhnikov <ppluzhnikov@google.com>
>
> * solib-svr4.c (svr4_free_so): Protect against NULL dereference.
Hi.
Ok by me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Fix crash in svr4_clear_so
2013-05-21 22:23 [patch] Fix crash in svr4_clear_so Paul Pluzhnikov
2013-05-21 23:14 ` Doug Evans
@ 2013-05-22 10:32 ` Gary Benson
1 sibling, 0 replies; 3+ messages in thread
From: Gary Benson @ 2013-05-22 10:32 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: gdb-patches
Paul Pluzhnikov wrote:
> Using current trunk, I've got a GDB core dump when I tried to analyze
> mis-matched binary and core:
...
> Index: solib-svr4.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/solib-svr4.c,v
> retrieving revision 1.177
> diff -p -u -r1.177 solib-svr4.c
> --- solib-svr4.c 6 May 2013 22:18:38 -0000 1.177
> +++ solib-svr4.c 21 May 2013 22:19:09 -0000
> @@ -971,7 +971,8 @@ svr4_free_so (struct so_list *so)
> static void
> svr4_clear_so (struct so_list *so)
> {
> - so->lm_info->l_addr_p = 0;
> + if (so->lm_info != NULL)
> + so->lm_info->l_addr_p = 0;
> }
>
> /* Free so_list built so far (called via cleanup). */
Looks good to me.
Thanks,
Gary
--
http://gbenson.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-22 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21 22:23 [patch] Fix crash in svr4_clear_so Paul Pluzhnikov
2013-05-21 23:14 ` Doug Evans
2013-05-22 10:32 ` Gary Benson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox