From patchwork Mon Jul 4 14:53:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Kilroy X-Patchwork-Id: 12905464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A3B6C433EF for ; Mon, 4 Jul 2022 14:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v3oDzIL1Xj8gjPsmofCOf6aKOffmCUtuEiy092vD6ew=; b=ZJPxDz6kDP8/U6 Vu9J/IN0CD6P7UWUrbGbQGK2nHviARfUBYtJRHSnjcviGSzk8DRASFcSb56pee5WCtbWKxOhuKlQg rI+9WY864yWdkxnr2GCRFQKPU9Bq5cBO19f1RjYKGXAwEX53NgJlVWNgsLvYNeKBFgKk8iu2Lsmwr bhhRcy8qm/s89jz8HAk5DDa86KuLvp2h1zPIOvEuqWvDNVgjMecBOYTOY6G2dy+q/BIjGTehQxNID hmem4hQXWAn4/5G4BoOblWFt52FV57zLLMX65A7PzmpHM5a/BHsEyZbw7L4NLnJDZSOehHpzh6Ju+ XptGlRIz4m5ieum/Wr2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8NV8-009Y4z-00; Mon, 04 Jul 2022 14:56:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8NUu-009Xwi-1y for linux-arm-kernel@lists.infradead.org; Mon, 04 Jul 2022 14:56:25 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4CD2E150C; Mon, 4 Jul 2022 07:56:23 -0700 (PDT) Received: from e124483.cambridge.arm.com (e124483.cambridge.arm.com [10.1.29.145]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E23E03F792; Mon, 4 Jul 2022 07:56:18 -0700 (PDT) From: Andrew Kilroy To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, acme@kernel.org Cc: Andrew Kilroy , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Tom Rix , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 7/8] perf tools: Print ptrauth struct in perf report Date: Mon, 4 Jul 2022 15:53:31 +0100 Message-Id: <20220704145333.22557-8-andrew.kilroy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220704145333.22557-1-andrew.kilroy@arm.com> References: <20220704145333.22557-1-andrew.kilroy@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220704_075624_199258_7C020610 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch prints a perf sample's ptrauth struct so that the PAC masks can be seen. To aid debugging. Signed-off-by: Andrew Kilroy --- tools/perf/util/session.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 37f833c3c81b..6b56e638d4dd 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1329,6 +1329,13 @@ char *get_page_size_name(u64 size, char *str) return str; } +static void ptrauth__printf(struct ptrauth_info *ptrauth) +{ + printf(" . ptrauth enabled keys: 0x%016"PRIx64"\n", ptrauth->enabled_keys); + printf(" . ptrauth instruction mask: 0x%016"PRIx64"\n", ptrauth->insn_mask); + printf(" . ptrauth data mask: 0x%016"PRIx64"\n", ptrauth->data_mask); +} + static void dump_sample(struct evsel *evsel, union perf_event *event, struct perf_sample *sample, const char *arch) { @@ -1385,6 +1392,14 @@ static void dump_sample(struct evsel *evsel, union perf_event *event, if (sample_type & PERF_SAMPLE_READ) sample_read__printf(sample, evsel->core.attr.read_format); + + if (sample_type & PERF_SAMPLE_ARCH_1) { + const char *normlzd_arch = perf_env__arch(evsel->evlist->env); + + if (normlzd_arch && strcmp(normlzd_arch, "arm64") == 0) + ptrauth__printf(&sample->ptrauth); + } + } static void dump_read(struct evsel *evsel, union perf_event *event)