[DTrace-devel] [PATCH] test: Have manyprobes clean up uprobes

Nick Alcock nick.alcock at oracle.com
Tue May 30 22:43:56 UTC 2023


On 30 May 2023, eugene loh spake thusly:

> From: Eugene Loh <eugene.loh at oracle.com>
>
> Once dtprobed cleans uprobes up automatically, this hack will no longer
> be needed.  Meanwhile, we have to clean up lest a few runs of this test
> lead to denial of service.
>
> Note that the test did try to clean up uprobes but it referred to
> uprobe_events with an incorrect pathname (leading to ineffectual cleanup
> and, on some systems, test failures) and it cleaned up all uprobes, even
> ones not created by this test.
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

I was going to say "you can't figure out which probes we are interested
in", but of course since each of these test runs by definition creates
a *new* probe, the mapping name pid component must be the same as the
pid we just printed out.

> -# Temporary, until autocleanup is implemented
> -echo - > /sys/kernel/tracing/uprobe_events 2>/dev/null
> +# D.output has the pid we need for the clean-up hack.  Display the output minus
> +# that pid information for checking with the .r results file.  Once uprobe cleanup
> +# has been automated, the pid info and D.output will not be needed.
> +grep -v "pid is " D.output
> +
> +# Here is the clean-up hack for uprobe_events until dtprobed does clean up.
> +# Find the events for the specified pid and eliminate them.
> +pid=`awk '/pid is / {print $3}' D.output`
> +uprobes=/sys/kernel/debug/tracing/uprobe_events
> +for x in `awk '/^p:dt_pid\/.* \/proc\/'$pid'\/map_files\// { sub("^p:", "-:"); print $1 }' $uprobes`; do
> +	echo $x >> $uprobes
> +done

So, on the understanding that this has actually been tested because God
knows I can't find syntax errors by eye at this time of night,

Reviewed-by: Nick Alcock <nick.alcock at oracle.com>

(and with the understanding that this whole horrible mess can go away
when dtprobed does it right)

-- 
NULL && (void)



More information about the DTrace-devel mailing list