Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Yao Qi <yao@codesourcery.com>
Subject: Re: [patch] Fix leak of bp_jit_event breakpoints
Date: Thu, 20 Jan 2011 07:17:00 -0000	[thread overview]
Message-ID: <AANLkTimgf+Z0ygd4dCRWUwv5HN_G-thHomkQGejpE1NA@mail.gmail.com> (raw)
In-Reply-To: <201101191409.17445.pedro@codesourcery.com>

On Wed, Jan 19, 2011 at 1:09 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Wednesday 19 January 2011 13:43:15, Paul Pluzhnikov wrote:
>> @@ -10588,11 +10588,12 @@ breakpoint_re_set_one (void *bint)
>>        printf_filtered (_("Deleting unknown breakpoint type %d\n"),
>> b->type); /* fall through */
>>        /* Delete overlay event and longjmp master breakpoints; they will be
>> -        reset later by breakpoint_re_set.  */
>> +        reset later by breakpoint_re_set.  Likewise for jit_event.  */
>>      case bp_overlay_event:
>>      case bp_longjmp_master:
>>      case bp_std_terminate_master:
>>      case bp_exception_master:
>> +    case bp_jit_event:
>>        delete_breakpoint (b);
>>        break;
>>
>> @@ -10619,7 +10620,6 @@ breakpoint_re_set_one (void *bint)
>>      case bp_longjmp_resume:
>>      case bp_exception:
>>      case bp_exception_resume:
>> -    case bp_jit_event:
>>        break;
>>      }
>
> This part doesn't look quite right.  In non-stop (breakpoint always-inserted)
> mode, this looks it will create a race window where you delete the jit event
> breakpoint whenever a random thread loads/unloads a DSO, meaning
> you could miss a jit registration done by some other thread still running.

Good point.

We could go with Yao's solution of searching for a matching existing
bp_jit_event at the given address; but I don't like it for two
reasons:
- yet another linear loop
- if a binary is reloaded, and &__jit_debug_register_code changes,
we'll still leak a breakpoint on rerun

Would recording the current jit_event breakpoint in inferior (via
register_inferior_data_with_cleanup ()) be a good solution?

Thanks,
-- 
Paul Pluzhnikov


  reply	other threads:[~2011-01-20  5:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 20:49 Paul Pluzhnikov
2011-01-19 21:14 ` Pedro Alves
2011-01-20  7:17   ` Paul Pluzhnikov [this message]
2011-01-21  1:11     ` Paul Pluzhnikov
2011-01-26 19:48       ` Paul Pluzhnikov
2011-01-27 14:15       ` Pedro Alves
2011-01-27 22:59         ` Paul Pluzhnikov
2011-01-28  1:27           ` Pedro Alves
2011-01-28 18:02             ` Paul Pluzhnikov
2011-01-28 20:38               ` Pedro Alves
2011-01-31 22:00                 ` Paul Pluzhnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimgf+Z0ygd4dCRWUwv5HN_G-thHomkQGejpE1NA@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox