This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Patch] Fix memory corruption when using multiple hardware watchpoints.
- From: Daniel Jacobowitz <drow at false dot org>
- To: David Daney <ddaney at avtrex dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 16 Sep 2008 14:50:26 -0400
- Subject: Re: [Patch] Fix memory corruption when using multiple hardware watchpoints.
- References: <48CFFC03.1040802@avtrex.com> <48C82AAA.3050408@avtrex.com>
On Wed, Sep 10, 2008 at 01:14:34PM -0700, David Daney wrote:
> In bpstat_stop_status there is special code to clear the breakpoint_at
> element for a hardware watchpoint if it could be invalidated by a
> remove_breakpoints(), insert_breakpoints() pair. The comment explains
> that we do this to "Prevent further code from trying to use it."
>
> The problem with the current code is that it assumes that there is only
> a single hardware breakpoint and breaks out of the loop when it is
> found. If there are multiple hardware breakpoints, any but the first
> are left with breakpoint_at pointing at now freed memory leading to Bad
> Things if the memory happens to get clobbered.
>
> My fix is to continue through the entire list clearing breakpoint_at for
> *all* hardware watchpoints and then outside of the loop calling
> remove_breakpoints(), insert_breakpoints() if any were found.
>
> Testing on x86_64-pc-linux-gnu. OK to commit (if no regressions)?
>
> 2008-09-10 David Daney <ddaney@avtrex.com>
>
> * breakpoint.c (bpstat_stop_status): Clear breakpoint_at for
> all hardware bpstats.
OK.
On Tue, Sep 16, 2008 at 11:33:39AM -0700, David Daney wrote:
> This patch:
> http://sourceware.org/ml/gdb-patches/2008-09/msg00222.html
>
> Is awaiting review.
>
> It fixes 10 FAILs in the testsuite on x86_64-pc-linux:
All of these look like threading tests with no watchpoints; I suspect
this is just noise.
--
Daniel Jacobowitz
CodeSourcery