Commit 1553419c authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim
Browse files

perf dso: Fix address sanitizer build



Various files had been missed from having accessor functions added for
the sake of dso reference count checking. Add the function calls and
missing dso accessor functions.

Fixes: ee756ef7 ("perf dso: Add reference count checking and accessor functions")
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Yunseong Kim <yskelg@gmail.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240704011745.1021288-1-irogers@google.com


Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 14b0fffa
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -159,9 +159,9 @@ static int check_return_addr(struct dso *dso, u64 map_start, Dwarf_Addr pc)
	Dwarf_Addr	start = pc;
	Dwarf_Addr	end = pc;
	bool		signalp;
	const char	*exec_file = dso->long_name;
	const char	*exec_file = dso__long_name(dso);

	dwfl = dso->dwfl;
	dwfl = RC_CHK_ACCESS(dso)->dwfl;

	if (!dwfl) {
		dwfl = dwfl_begin(&offline_callbacks);
@@ -183,7 +183,7 @@ static int check_return_addr(struct dso *dso, u64 map_start, Dwarf_Addr pc)
			dwfl_end(dwfl);
			goto out;
		}
		dso->dwfl = dwfl;
		RC_CHK_ACCESS(dso)->dwfl = dwfl;
	}

	mod = dwfl_addrmodule(dwfl, pc);
@@ -267,7 +267,7 @@ int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain)
	rc = check_return_addr(dso, map__start(al.map), ip);

	pr_debug("[DSO %s, sym %s, ip 0x%" PRIx64 "] rc %d\n",
				dso->long_name, al.sym->name, ip, rc);
		dso__long_name(dso), al.sym->name, ip, rc);

	if (rc == 0) {
		/*
+3 −2
Original line number Diff line number Diff line
@@ -180,13 +180,14 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
	GtkWidget *tab_label;
	int err;

	if (dso->annotate_warned)
	if (dso__annotate_warned(dso))
		return -1;

	err = symbol__annotate(ms, evsel, NULL);
	if (err) {
		char msg[BUFSIZ];
		dso->annotate_warned = true;

		dso__set_annotate_warned(dso);
		symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
		ui__error("Couldn't annotate %s: %s\n", sym->name, msg);
		return -1;
+5 −5
Original line number Diff line number Diff line
@@ -1013,7 +1013,7 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id,
	if (!dso)
		goto out;

	if (dso->data.status == DSO_DATA_STATUS_ERROR &&
	if (dso__data(dso)->status == DSO_DATA_STATUS_ERROR &&
	    dso__data_status_seen(dso, DSO_DATA_STATUS_SEEN_ITRACE))
		goto out;

@@ -1027,11 +1027,11 @@ static u32 cs_etm__mem_access(struct cs_etm_queue *etmq, u8 trace_chan_id,
	if (len <= 0) {
		ui__warning_once("CS ETM Trace: Missing DSO. Use 'perf archive' or debuginfod to export data from the traced system.\n"
				 "              Enable CONFIG_PROC_KCORE or use option '-k /path/to/vmlinux' for kernel symbols.\n");
		if (!dso->auxtrace_warned) {
		if (!dso__auxtrace_warned(dso)) {
			pr_err("CS ETM Trace: Debug data not found for address %#"PRIx64" in %s\n",
				address,
				    dso->long_name ? dso->long_name : "Unknown");
			dso->auxtrace_warned = true;
				dso__long_name(dso) ? dso__long_name(dso) : "Unknown");
			dso__set_auxtrace_warned(dso);
		}
		goto out;
	}
+5 −5
Original line number Diff line number Diff line
@@ -1199,7 +1199,7 @@ static int symbol__disassemble_bpf(struct symbol *sym,
	int ret;
	FILE *s;

	if (dso->binary_type != DSO_BINARY_TYPE__BPF_PROG_INFO)
	if (dso__binary_type(dso) != DSO_BINARY_TYPE__BPF_PROG_INFO)
		return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE;

	pr_debug("%s: handling sym %s addr %" PRIx64 " len %" PRIx64 "\n", __func__,
@@ -1226,14 +1226,14 @@ static int symbol__disassemble_bpf(struct symbol *sym,
	info.arch = bfd_get_arch(bfdf);
	info.mach = bfd_get_mach(bfdf);

	info_node = perf_env__find_bpf_prog_info(dso->bpf_prog.env,
						 dso->bpf_prog.id);
	info_node = perf_env__find_bpf_prog_info(dso__bpf_prog(dso)->env,
						 dso__bpf_prog(dso)->id);
	if (!info_node) {
		ret = SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF;
		goto out;
	}
	info_linear = info_node->info_linear;
	sub_id = dso->bpf_prog.sub_id;
	sub_id = dso__bpf_prog(dso)->sub_id;

	info.buffer = (void *)(uintptr_t)(info_linear->info.jited_prog_insns);
	info.buffer_length = info_linear->info.jited_prog_len;
@@ -1244,7 +1244,7 @@ static int symbol__disassemble_bpf(struct symbol *sym,
	if (info_linear->info.btf_id) {
		struct btf_node *node;

		node = perf_env__find_btf(dso->bpf_prog.env,
		node = perf_env__find_btf(dso__bpf_prog(dso)->env,
					  info_linear->info.btf_id);
		if (node)
			btf = btf__new((__u8 *)(node->data),
+10 −0
Original line number Diff line number Diff line
@@ -280,6 +280,16 @@ static inline void dso__set_annotate_warned(struct dso *dso)
	RC_CHK_ACCESS(dso)->annotate_warned = 1;
}

static inline bool dso__auxtrace_warned(const struct dso *dso)
{
	return RC_CHK_ACCESS(dso)->auxtrace_warned;
}

static inline void dso__set_auxtrace_warned(struct dso *dso)
{
	RC_CHK_ACCESS(dso)->auxtrace_warned = 1;
}

static inline struct auxtrace_cache *dso__auxtrace_cache(struct dso *dso)
{
	return RC_CHK_ACCESS(dso)->auxtrace_cache;
Loading