Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp228562imw; Mon, 4 Jul 2022 08:10:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sRvA+NLZoGDWNkbPceG4YbRpZd7wXQjgiqOqtcHOJ3tZkF/D/Cjf46rOL43nlU+uEIbteA X-Received: by 2002:a05:6402:4414:b0:434:f58c:ee2e with SMTP id y20-20020a056402441400b00434f58cee2emr38897862eda.362.1656947445402; Mon, 04 Jul 2022 08:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656947445; cv=none; d=google.com; s=arc-20160816; b=aLphE0Nj2ewTWEespnFizGRJDvPseAFUFujBzy/dLXLSff0DYYGAd/va9qUqHlMEGW QsVthguMynypaT3LOPETsL3JY/nLOwtKrL7rpvy2rWEe4DrvLAR+MT88SDwp5pxmu6wV QQxjt4rz/qKGAMPnvnaVTDgqkOD4CX6MXAdd4i7DbSc/Ct/I7ClRdTRNoG6kh6KpWN1b ZYjFJ6Ru1K75w4zk9LbUOVPWyoewZf5CRLUgFh25daXPH1Tb/bwB7zJ9r8MG45kbkY04 1CdI0fDN+eVfOWRjzKzS2JIjNv5wN2NUpWa+1Edrqfa0Pr4aTvRpKyNcDnj3GLh8y9K/ anyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=4jkdUsZ8b6V0MtSN1Dx4Ac01gPEQpZcuxTw2eqatL6U=; b=U6iBK/PS/6H1KuRKbSYiQ813Wlp09O3bUCPRuQcxlADQpoEQ8Jat1VGtQuiIpuscfM RHpTg0PFrPd+klRMFqyvuVA0ELEOxuEghf4ACyfUeci2lBg4+wPbX35Wpb+zaqNMlN1O Byl2c43XUVYVELHXKVDSvT6LLEpaghI1Gofj1mluRzHD38o4k3Aq+1Rfz1iWhtmfpH/l Ca1+D3+iEBjioNK0+NlAtUthX6cyJDmq+VmmudcPXWzn2aOtiqRSvTjG6Pl6ScyGORug LvNLiZkv93SOcf9a1grrfyNzap1IkmeElqaEN9odErPQ7i9GvimVyu6EU6E4DpnawQN9 YthA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn22-20020a17090794d600b00718d0ab26f9si16651828ejc.715.2022.07.04.08.10.20; Mon, 04 Jul 2022 08:10:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234990AbiGDO5B (ORCPT + 99 others); Mon, 4 Jul 2022 10:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234514AbiGDO4j (ORCPT ); Mon, 4 Jul 2022 10:56:39 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 398EF11A2A; Mon, 4 Jul 2022 07:56:23 -0700 (PDT) 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) -- 2.17.1