[DTrace-devel] [PATCH] Fix size of string data in the trace output buffer

Eugene Loh eugene.loh at oracle.com
Tue Sep 7 22:05:44 PDT 2021


On 9/8/21 12:49 AM, Eugene Loh wrote:

> On 9/7/21 8:37 PM, Kris Van Hees wrote:
>> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
>> @@ -939,39 +939,48 @@ dt_cg_store_val(dt_pcb_t *pcb, dt_node_t *dnp, 
>> dtrace_actkind_t kind,
>>           dt_regset_xalloc(drp, BPF_REG_0);
>>           emit(dlp,  BPF_CALL_HELPER(BPF_FUNC_probe_read));
>>           dt_regset_free_args(drp);
>> -        dt_regset_free(drp, BPF_REG_0);
>
> I sure do not understand the register management here.  Earlier, you 
> use %r0 for writing the length prefix, but never xalloc'ing the 
> register.  Here, you xalloc(r0) but you removed the free(r0). Isn't 
> that wrong?  But I tried iterating on this and it appears someone else 
> is freeing the register?  Who?  I'm confused.

Actually, I'm bothered by this.  There is an xalloc(r0), but the 
free(r0) has been removed.  So, there should be a reg leak here, but 
DTrace does not complain.  So, I put a dt_regset_dump() before and after 
the xalloc(r0) call.  The first time through, the pair show r0 being 
allocated.  All subsequent times, they show r0 already allocated, and no 
complaint trying to allocated it again.  I guess a regset problem?  I 
can look at this tomorrow.



More information about the DTrace-devel mailing list