public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/26385] New: [ppc] Minor regression with old watchpoint interface for PowerPC on Linux
@ 2020-08-13 19:52 pedromfc at linux dot ibm.com
  2020-08-14 18:42 ` [Bug breakpoints/26385] " cvs-commit at gcc dot gnu.org
  2020-08-14 18:49 ` pedromfc at linux dot ibm.com
  0 siblings, 2 replies; 3+ messages in thread
From: pedromfc at linux dot ibm.com @ 2020-08-13 19:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26385

            Bug ID: 26385
           Summary: [ppc] Minor regression with old watchpoint interface
                    for PowerPC on Linux
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: pedromfc at linux dot ibm.com
  Target Milestone: 10.1
              Host: powerpc on linux
            Target: powerpc on linux

The following commit introduced a possible regression when using the old
PTRACE_GET/SET_DEBUGREG interface on older kernels.

227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 [PowerPC] Fix debug register issues in
ppc-linux-nat

There were some older kernel versions for which overwriting a watchpoint with
PTRACE_SET_DEBUGREG would not re-activate the watchpoint if it was previouly
disabled following a hit. This happened when the kernel was configured with
CONFIG_HW_BREAKPOINT on and uses perf events to install watchpoints.

Previously, the ppc linux native target would immediately remove or insert
watchpoints following a request from the upper layers.  This was changed in
commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 to fix other issues, which
caused watchpoint requests to be applied to the inferior only in
low_prepare_to_resume, right before the inferior is resumed.

Usually, but maybe not always, after a hit, GDB will remove the watchpoint,
resume the inferior for a single-step, possibly report the watchpoint hit to
the user, and then re-insert the watchpoint before the inferior is next
resumed.  In this case there would be no problems, but since I can't guarantee
that there aren't other paths in GDB that allow the user to set a new
watchpoint after the first one hit, and after its deletion by GDB, but before
the inferior is resumed, there is a chance that PTRACE_SET_DEBUGREG could be
called directly without the watchpoint first having been cleared, which could
cause a false negative with the older kernel versions.

I've submitted a fix:

https://sourceware.org/pipermail/gdb-patches/2020-August/171277.html

I have set this with a target milestone for 10.1, considering that this will be
the first release with the commit that introduced the regression, following the
discussion in this thread:

https://sourceware.org/pipermail/gdb-patches/2020-August/171176.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/26385] [ppc] Minor regression with old watchpoint interface for PowerPC on Linux
  2020-08-13 19:52 [Bug breakpoints/26385] New: [ppc] Minor regression with old watchpoint interface for PowerPC on Linux pedromfc at linux dot ibm.com
@ 2020-08-14 18:42 ` cvs-commit at gcc dot gnu.org
  2020-08-14 18:49 ` pedromfc at linux dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-14 18:42 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26385

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Franco de Carvalho
<pedromfc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6ea815e78134babf819920845e537d2e2f2abbc1

commit 6ea815e78134babf819920845e537d2e2f2abbc1
Author: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
Date:   Fri Aug 14 15:41:14 2020 -0300

    [PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG

    This patches changes low_prepare_to_resume in the ppc linux native target
    to always clear the watchpoint when the old PTRACE_SET_DEBUGREG interface
    is used, even if another watchpoint GDB requested to the target is
    written right after using the same call.

    The reason for this is that there were some older kernel versions for
    which overwriting a watchpoint with PTRACE_SET_DEBUGREG would not
    re-activate the watchpoint if it was previouly disabled following a hit.
    This happened when the kernel was configured with CONFIG_HW_BREAKPOINT on
    and uses perf events to install watchpoints.

    Previously, the ppc linux native target would immediately remove or
    insert watchpoints following a request from the upper layers.  This was
    changed in commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 to fix other
    issues, which caused watchpoint requests to be applied to the inferior
    only in low_prepare_to_resume, right before the inferior is resumed.

    Usually, but maybe not always, after a hit, GDB will remove the
    watchpoint, resume the inferior for a single-step, possibly report the
    watchpoint hit to the user, and then re-insert the watchpoint before the
    inferior is next resumed.  In this case there would be no problems, but
    since I can't guarantee that there aren't other paths in GDB that allow
    the user to set a new watchpoint after the first one hit, and after its
    deletion by GDB, but before the inferior is resumed, there is a chance
    that PTRACE_SET_DEBUGREG could be called directly without the watchpoint
    first having been cleared, which could cause a false negative with the
    older kernel versions.

    This issue would affect kernel versions starting from this commit:

    5aae8a53708025d4e718f0d2e7c2f766779ddc71

    Up to the fix in this commit:

    a53fd61ac2f411745471c1c877d5e072fbbf0e5c

    gdb/ChangeLog:

            PR breakpoints/26385
            * ppc-linux-nat.c (ppc_linux_nat_target::low_prepare_to_resume):
            Always clear watchpoint with PTRACE_SET_DEBUGREG.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug breakpoints/26385] [ppc] Minor regression with old watchpoint interface for PowerPC on Linux
  2020-08-13 19:52 [Bug breakpoints/26385] New: [ppc] Minor regression with old watchpoint interface for PowerPC on Linux pedromfc at linux dot ibm.com
  2020-08-14 18:42 ` [Bug breakpoints/26385] " cvs-commit at gcc dot gnu.org
@ 2020-08-14 18:49 ` pedromfc at linux dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: pedromfc at linux dot ibm.com @ 2020-08-14 18:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26385

Pedro Franco de Carvalho <pedromfc at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Pedro Franco de Carvalho <pedromfc at linux dot ibm.com> ---
I committed the patch that fixes this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2020-08-14 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 19:52 [Bug breakpoints/26385] New: [ppc] Minor regression with old watchpoint interface for PowerPC on Linux pedromfc at linux dot ibm.com
2020-08-14 18:42 ` [Bug breakpoints/26385] " cvs-commit at gcc dot gnu.org
2020-08-14 18:49 ` pedromfc at linux dot ibm.com

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).