Patch "perf probe: Fix libdw memory leak" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf probe: Fix libdw memory leak

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-probe-fix-libdw-memory-leak.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit eeaf89dea6be85cf0b002fe4d2ab7efe50768100
Author: Ian Rogers <irogers@xxxxxxxxxx>
Date:   Wed Oct 16 16:56:22 2024 -0700

    perf probe: Fix libdw memory leak
    
    [ Upstream commit 4585038b8e186252141ef86e9f0d8e97f11dce8d ]
    
    Add missing dwarf_cfi_end to free memory associated with probe_finder
    cfi_eh which is allocated and owned via a call to
    dwarf_getcfi_elf. Confusingly cfi_dbg shouldn't be freed as its memory
    is owned by the passed in debuginfo struct. Add comments to highlight
    this.
    
    This addresses leak sanitizer issues seen in:
    tools/perf/tests/shell/test_uprobe_from_different_cu.sh
    
    Fixes: 270bde1e76f4 ("perf probe: Search both .eh_frame and .debug_frame sections for probe location")
    Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: David S. Miller <davem@xxxxxxxxxxxxx>
    Cc: Steinar H. Gunderson <sesse@xxxxxxxxxx>
    Cc: Alexander Lobakin <aleksander.lobakin@xxxxxxxxx>
    Cc: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
    Cc: Kajol Jain <kjain@xxxxxxxxxxxxx>
    Cc: Athira Rajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
    Cc: Hemant Kumar <hemant@xxxxxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241016235622.52166-3-irogers@xxxxxxxxxx
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 50d861a80f572..2f86103761ab2 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1490,6 +1490,10 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
 	if (ret >= 0 && tf.pf.skip_empty_arg)
 		ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
 
+#if _ELFUTILS_PREREQ(0, 142)
+	dwarf_cfi_end(tf.pf.cfi_eh);
+#endif
+
 	if (ret < 0 || tf.ntevs == 0) {
 		for (i = 0; i < tf.ntevs; i++)
 			clear_probe_trace_event(&tf.tevs[i]);
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 8bc1c80d3c1c0..1f4650b955094 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -81,9 +81,9 @@ struct probe_finder {
 
 	/* For variable searching */
 #if _ELFUTILS_PREREQ(0, 142)
-	/* Call Frame Information from .eh_frame */
+	/* Call Frame Information from .eh_frame. Owned by this struct. */
 	Dwarf_CFI		*cfi_eh;
-	/* Call Frame Information from .debug_frame */
+	/* Call Frame Information from .debug_frame. Not owned. */
 	Dwarf_CFI		*cfi_dbg;
 #endif
 	Dwarf_Op		*fb_ops;	/* Frame base attribute */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux