From: Casey Chen <cachen@purestorage.com>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: yzhong@purestorage.com, Casey Chen <cachen@purestorage.com>
Subject: [PATCH] perf probe: fix missing references to maps and map in thread__find_map
Date: Thu, 27 Jun 2024 15:36:18 -0600 [thread overview]
Message-ID: <20240627213619.718-2-cachen@purestorage.com> (raw)
In-Reply-To: <20240627213619.718-1-cachen@purestorage.com>
With 0dd5041c9a0e ("perf addr_location: Add init/exit/copy functions"),
thread__find_map() would return with al->maps being NULL when cpumode is 3
(macro PERF_RECORD_MISC_HYPERVISOR), later dereferencing on it would crash.
Fix is to add back the reference to maps and map.
---
tools/perf/util/event.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index f32f9abf6344..259cb137e5bb 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -638,6 +638,8 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
!perf_host)
al->filtered |= (1 << HIST_FILTER__HOST);
+ al->maps = maps__get(maps);
+ al->map = maps__find(maps, al->addr);
return NULL;
}
al->maps = maps__get(maps);
--
2.45.2
next prev parent reply other threads:[~2024-06-27 21:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 21:36 [PATCH 0/1] perf report: fix missing references to maps and map in thread__find_map Casey Chen
2024-06-27 21:36 ` Casey Chen [this message]
2024-07-02 22:50 ` [PATCH] perf probe: " Namhyung Kim
2024-06-27 21:36 ` [PATCH] debug patch for perf report segfault Casey Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240627213619.718-2-cachen@purestorage.com \
--to=cachen@purestorage.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=yzhong@purestorage.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).