* [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error
@ 2025-06-24 21:40 Kris Van Hees
2025-06-30 22:07 ` Eugene Loh
2025-07-15 14:14 ` Nick Alcock
0 siblings, 2 replies; 4+ messages in thread
From: Kris Van Hees @ 2025-06-24 21:40 UTC (permalink / raw)
To: dtrace, dtrace-devel
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
libcommon/usdt_parser_notes.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
index d3d744fb..c98c9fb0 100644
--- a/libcommon/usdt_parser_notes.c
+++ b/libcommon/usdt_parser_notes.c
@@ -829,15 +829,16 @@ usdt_parse_notes(int out, dof_helper_t *dhp, usdt_data_t *data)
goto out;
err:
- rc = -1;
-
-out:
/*
- * All tracepoint probes in prbmap should have been removed during
- * proessing.
+ * In case of an error, we don't know whether we can allocate iterators
+ * so we have few options to provide cleanup. Since cleanup is all we
+ * do now, we plug the probe cleanup function into the ops for prbmap,
+ * and let the hashtable destroy function take care of all cleanup.
*/
- assert(dt_htab_entries(prbmap) == 0);
+ prb_htab_ops.del = (htab_del_fn)prb_del_probe;
+ rc = -1;
+out:
dt_htab_destroy(prvmap);
dt_htab_destroy(prbmap);
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error
2025-06-24 21:40 [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error Kris Van Hees
@ 2025-06-30 22:07 ` Eugene Loh
2025-06-30 23:09 ` Kris Van Hees
2025-07-15 14:14 ` Nick Alcock
1 sibling, 1 reply; 4+ messages in thread
From: Eugene Loh @ 2025-06-30 22:07 UTC (permalink / raw)
To: Kris Van Hees, dtrace, dtrace-devel
Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
but it'd be great if Nick could take a look, given that he reviewed the
file earlier.
Out of curiosity, was there some case where the assertion failed? Could
that be a test case?
(Minor nit: I'd go for a sentence break after "allocate iterators.")
On 6/24/25 17:40, Kris Van Hees wrote:
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> libcommon/usdt_parser_notes.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> index d3d744fb..c98c9fb0 100644
> --- a/libcommon/usdt_parser_notes.c
> +++ b/libcommon/usdt_parser_notes.c
> @@ -829,15 +829,16 @@ usdt_parse_notes(int out, dof_helper_t *dhp, usdt_data_t *data)
> goto out;
>
> err:
> - rc = -1;
> -
> -out:
> /*
> - * All tracepoint probes in prbmap should have been removed during
> - * proessing.
> + * In case of an error, we don't know whether we can allocate iterators
> + * so we have few options to provide cleanup. Since cleanup is all we
> + * do now, we plug the probe cleanup function into the ops for prbmap,
> + * and let the hashtable destroy function take care of all cleanup.
> */
> - assert(dt_htab_entries(prbmap) == 0);
> + prb_htab_ops.del = (htab_del_fn)prb_del_probe;
> + rc = -1;
>
> +out:
> dt_htab_destroy(prvmap);
> dt_htab_destroy(prbmap);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error
2025-06-30 22:07 ` Eugene Loh
@ 2025-06-30 23:09 ` Kris Van Hees
0 siblings, 0 replies; 4+ messages in thread
From: Kris Van Hees @ 2025-06-30 23:09 UTC (permalink / raw)
To: Eugene Loh; +Cc: Kris Van Hees, dtrace, dtrace-devel
On Mon, Jun 30, 2025 at 06:07:39PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
> but it'd be great if Nick could take a look, given that he reviewed the file
> earlier.
> Out of curiosity, was there some case where the assertion failed? Could that
> be a test case?
There was an assertion failure but not one that we can have a test for since
it is in dtprobed and the testsuite cannot capture those at this point.
> (Minor nit: I'd go for a sentence break after "allocate iterators.")
>
> On 6/24/25 17:40, Kris Van Hees wrote:
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > ---
> > libcommon/usdt_parser_notes.c | 13 +++++++------
> > 1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> > index d3d744fb..c98c9fb0 100644
> > --- a/libcommon/usdt_parser_notes.c
> > +++ b/libcommon/usdt_parser_notes.c
> > @@ -829,15 +829,16 @@ usdt_parse_notes(int out, dof_helper_t *dhp, usdt_data_t *data)
> > goto out;
> > err:
> > - rc = -1;
> > -
> > -out:
> > /*
> > - * All tracepoint probes in prbmap should have been removed during
> > - * proessing.
> > + * In case of an error, we don't know whether we can allocate iterators
> > + * so we have few options to provide cleanup. Since cleanup is all we
> > + * do now, we plug the probe cleanup function into the ops for prbmap,
> > + * and let the hashtable destroy function take care of all cleanup.
> > */
> > - assert(dt_htab_entries(prbmap) == 0);
> > + prb_htab_ops.del = (htab_del_fn)prb_del_probe;
> > + rc = -1;
> > +out:
> > dt_htab_destroy(prvmap);
> > dt_htab_destroy(prbmap);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error
2025-06-24 21:40 [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error Kris Van Hees
2025-06-30 22:07 ` Eugene Loh
@ 2025-07-15 14:14 ` Nick Alcock
1 sibling, 0 replies; 4+ messages in thread
From: Nick Alcock @ 2025-07-15 14:14 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 24 Jun 2025, Kris Van Hees said:
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> libcommon/usdt_parser_notes.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> index d3d744fb..c98c9fb0 100644
> --- a/libcommon/usdt_parser_notes.c
> +++ b/libcommon/usdt_parser_notes.c
> @@ -829,15 +829,16 @@ usdt_parse_notes(int out, dof_helper_t *dhp, usdt_data_t *data)
> goto out;
>
> err:
> - rc = -1;
> -
> -out:
> /*
> - * All tracepoint probes in prbmap should have been removed during
> - * proessing.
> + * In case of an error, we don't know whether we can allocate iterators
> + * so we have few options to provide cleanup. Since cleanup is all we
> + * do now, we plug the probe cleanup function into the ops for prbmap,
> + * and let the hashtable destroy function take care of all cleanup.
> */
> - assert(dt_htab_entries(prbmap) == 0);
> + prb_htab_ops.del = (htab_del_fn)prb_del_probe;
> + rc = -1;
>
> +out:
> dt_htab_destroy(prvmap);
> dt_htab_destroy(prbmap);
That seems... better than we had before. I was seeing double-frees all
over the place with what you previously committed: I'll have to see if
this helps.
--
NULL && (void)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-15 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 21:40 [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error Kris Van Hees
2025-06-30 22:07 ` Eugene Loh
2025-06-30 23:09 ` Kris Van Hees
2025-07-15 14:14 ` Nick Alcock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox