lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 15 Oct 2021 20:34:57 +0800
From:   Jiangfeng Xiao <xiaojiangfeng@...wei.com>
To:     <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
        <mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
        <jolsa@...hat.com>, <rickyman7@...il.com>, <namhyung@...nel.org>,
        <kan.liang@...ux.intel.com>, <yao.jin@...ux.intel.com>,
        <song@...nel.org>, <amurray@...goodpenguin.co.uk>,
        <xiaojiangfeng@...wei.com>
CC:     <andrew.murray@....com>, <linux-perf-users@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <shaolexi@...wei.com>,
        <nixiaoming@...wei.com>, <qiuxi1@...wei.com>
Subject: [PATCH] perf evsel: fix armv7_a9 failed to resolve symbols with JIT

The PMU of armv7_a9 machine does not have the capability to exclude
counting events that occur in specific contexts such as guest, so
sys_perf_event_open() syscall returned with -EINVAL.

See following code:

static int perf_try_init_event(struct pmu *pmu, struct perf_event *event)
{
	...
	if (pmu->capabilities & PERF_PMU_CAP_NO_EXCLUDE &&
	    event_has_any_exclude_flag(event))
		ret = -EINVAL;
	...
}

Then evsel__open_cpu will use perf_missing_features.mmap2 to fallback to
not using .mmap2 and fail to re-execute sys_perf_event_open. Next,
evsel__open_cpu use perf_missing_features.exclude_guest to fallback to
not using .exclude_guest and finally success to re-execute
sys_perf_event_open.

When .mmap2 is not used, the input parameter flag of map__new is 0,
perf will not find the perf-%d.map to resolve.

Therefore, in this submission, the disabling order of .mmap2 and
exclude_guest is reversed to fix the failure to resolve symbols with JIT.

Fixes: cc6795aeffe ("perf/core: Add PERF_PMU_CAP_NO_EXCLUDE for exclusion incapable PMUs")

Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@...wei.com>
---
 tools/perf/util/evsel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index dbfeceb..d6bf15b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1896,15 +1896,15 @@ bool evsel__detect_missing_features(struct evsel *evsel)
 		perf_missing_features.cloexec = true;
 		pr_debug2_peo("switching off cloexec flag\n");
 		return true;
-	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
-		perf_missing_features.mmap2 = true;
-		pr_debug2_peo("switching off mmap2\n");
-		return true;
 	} else if (!perf_missing_features.exclude_guest &&
 		   (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
 		perf_missing_features.exclude_guest = true;
 		pr_debug2_peo("switching off exclude_guest, exclude_host\n");
 		return true;
+	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
+		perf_missing_features.mmap2 = true;
+		pr_debug2_peo("switching off mmap2\n");
+		return true;
 	} else if (!perf_missing_features.sample_id_all) {
 		perf_missing_features.sample_id_all = true;
 		pr_debug2_peo("switching off sample_id_all\n");
-- 
1.8.5.6

Powered by blists - more mailing lists