[DTrace-devel] [PATCH 2/3] cg: validate tstring alloc/free
Eugene Loh
eugene.loh at oracle.com
Wed Jul 16 04:45:13 UTC 2025
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
though apparently
undiscriminantly ->
indiscriminately
On 7/15/25 15:50, Kris Van Hees wrote:
> Rather than undiscriminantly resetting tstring allocations at the
> beginning of a compilation, actually verify that alloc/free of
> tstrings is done correctly, i.e. that none are left allocated after
> compilation is done.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> libdtrace/dt_cg.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index bd0763d6..6c7ad076 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -1432,11 +1432,12 @@ dt_cg_tstring_reset(dtrace_hdl_t *dtp)
> ts = dtp->dt_tstrings;
> for (i = 0; i < DT_TSTRING_SLOTS; i++, ts++)
> ts->offset = i * size;
> + } else {
> + /* Ensure that all allocated tstrings were freed correctly. */
> + ts = dtp->dt_tstrings;
> + for (i = 0; i < DT_TSTRING_SLOTS; i++, ts++)
> + assert(ts->in_use == 0);
> }
> -
> - ts = dtp->dt_tstrings;
> - for (i = 0; i < DT_TSTRING_SLOTS; i++, ts++)
> - ts->in_use = 0;
> }
>
> /*
More information about the DTrace-devel
mailing list