Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp214843imw; Mon, 4 Jul 2022 07:58:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uOvzvsFwPb52swdMMAh0guCnftnhT2dvMxjUmB8qOeGS8mU+7xnHfXWQhRfTB+9loPqZ06 X-Received: by 2002:a05:6402:c47:b0:437:ce2d:c30d with SMTP id cs7-20020a0564020c4700b00437ce2dc30dmr39657311edb.395.1656946734181; Mon, 04 Jul 2022 07:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656946734; cv=none; d=google.com; s=arc-20160816; b=QYsuh1X9WFgG2H4r9HfftapClk4BNEt37Qz61wOYDuIGkLTAz0JZPvd/oITIgrnkoO ZbepzGQVzwlhLIycDA7dOelqHCB80dPbYKSCdotfCjPLipFbdsdPlfe71TyazYPnlNr4 mI3Qd2um/eBSvnQBXOLXnH4nUMYace8mZehDb+AscXlezrwEKafbq/py83NrdRw2F2z9 60AbY6jlkCX9xU3oNSmbotPneldtjshLwAgENTLWymP/Hfx086cNrFR+l2a7NzgFqNyy z7/VneOmq9tqyjIanF1wLJ3ZWppA291dEamtuSKRyqB+IIfbq1JrVsqqx1VA34z05p7a Lmfg== 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=9vHHO0KUaGCUo/5+MKrpQmy4Xr96Wr5HMdkZCGr9nbY=; b=nZYp4jS2+8sRXu1mET5PHkZVFpKPOG3umZkgrNXKlyr+P23RXzqdMNCzzLuiPtEZNX JmCsZJ3wU9sgzNvEOmkKBh6bXXeYYLwqSFwxQmmupPZegzmWu0FhwsGEEe0BlHPN97Ut 1f+hJLYn45UUXqBPaP5LYVtJbWLgq7NoloTOpNw8UYxOGBFHC3SYGw8WuRNhRkJ0x8Nl 1laRYoYVJOGlQUtZrERlRGp8omKl6Y2iA69METjeBbIfSpKkwZhCVTLlXTJj3fiZjhlR UAqEpPbeZgop6DWYR4x/iVEWkPQ4i4jfp9V7mKAY6ehISHhCFn+sdfXMG+gVhu4HNZ1z Dd4g== 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 mp37-20020a1709071b2500b0072a4a97a5casi17748358ejc.172.2022.07.04.07.58.29; Mon, 04 Jul 2022 07:58:54 -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 S234752AbiGDO4m (ORCPT + 99 others); Mon, 4 Jul 2022 10:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234780AbiGDO4V (ORCPT ); Mon, 4 Jul 2022 10:56:21 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD73411176; Mon, 4 Jul 2022 07:56:10 -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 EAAFB150C; Mon, 4 Jul 2022 07:56:10 -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 9972A3F792; Mon, 4 Jul 2022 07:56:07 -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 6/8] perf libunwind: arm64 pointer authentication Date: Mon, 4 Jul 2022 15:53:30 +0100 Message-Id: <20220704145333.22557-7-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 Make use of new changes in libunwind to decode a pointer which has a pointer authentication code (PAC) in it. Before this patch, perf is not able to produce stack traces where the instruction addresses had PACs in them. This commit has a dependency on a libunwind pull request: https://github.com/libunwind/libunwind/pull/360 Signed-off-by: Andrew Kilroy --- tools/perf/util/unwind-libunwind-local.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index 6e5b8cce47bf..6983a3e76a71 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c @@ -652,6 +652,15 @@ static void display_error(int err) } } +#ifndef NO_LIBUNWIND_ARM64_PTRAUTH +static unw_word_t get_insn_mask(unw_addr_space_t addr_space __maybe_unused, void *unwind_info_ptr) +{ + struct unwind_info *ui = unwind_info_ptr; + unw_word_t mask = ui->sample->ptrauth.insn_mask; + return mask; +} +#endif + static unw_accessors_t accessors = { .find_proc_info = find_proc_info, .put_unwind_info = put_unwind_info, @@ -661,6 +670,9 @@ static unw_accessors_t accessors = { .access_fpreg = access_fpreg, .resume = resume, .get_proc_name = get_proc_name, +#ifndef NO_LIBUNWIND_ARM64_PTRAUTH + .ptrauth_insn_mask = get_insn_mask, +#endif }; static int _unwind__prepare_access(struct maps *maps) -- 2.17.1