This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix leak of bp_jit_event breakpoints


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]