This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] gdbserver: Fix overlapping memcpy (safe now)
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Tue, 6 Dec 2011 18:25:32 +0000
- Subject: Re: [patch] gdbserver: Fix overlapping memcpy (safe now)
- References: <20111202214428.GA17486@host2.jankratochvil.net>
On Friday 02 December 2011 21:44:28, Jan Kratochvil wrote:
> Hi,
>
> I thought it is causing a crash but that was a different cause. Anyway
> I already had the patch, it violates ISO C memcpy definition
> If copying takes place between objects that overlap, the behavior is
> undefined.
> and it also complains in valgrind:
> Source and destination overlap in memcpy(0x4c81da8, 0x4c81da8, 1)
> at: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:653)
> by: check_mem_write (mem-break.c:1102)
> by: write_inferior_memory (target.c:66)
> by: uninsert_raw_breakpoint (mem-break.c:751)
> by: uninsert_breakpoints_at (mem-break.c:784)
>
> I find too fragile to pass a pointer into internal buffer into a set of
> functions modifying that buffer.
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora16-linux-gnu gdbserver mode.
>
> I will check it in without comments, I find it safe.
Fine with me. Thanks.
--
Pedro Alves