This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix crash in svr4_clear_so
- From: Doug Evans <dje at google dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 21 May 2013 16:14:23 -0700
- Subject: Re: [patch] Fix crash in svr4_clear_so
- References: <ye6qa9no55vu dot fsf at elbrus2 dot mtv dot corp dot google dot com>
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.