From patchwork Mon Mar 1 16:10:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 389250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC14CC28E89 for ; Mon, 1 Mar 2021 20:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC02D64E84 for ; Mon, 1 Mar 2021 20:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242793AbhCAUD7 (ORCPT ); Mon, 1 Mar 2021 15:03:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:58562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242610AbhCATyN (ORCPT ); Mon, 1 Mar 2021 14:54:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 13A5C65362; Mon, 1 Mar 2021 17:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614621266; bh=rUQeNsu8YaEmLB4s9TB38k4eeDooQEa70yWxOXMQJcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQhlH7skTrad/VVTy3xTWqk/aXMAM7/U75DkwGiWymA99VsWuJVDNSDlwMY30umj8 bAJiEjshPhhK8bA6uAXqN6O8jAPi1ovMp+cSgqKy+YgrAc6hfQcDOobVi9VkOr28Uk jY2y/cZ5tKDNytCsKpJfaJsc9CiYowO7gRgZ1z8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Fraser , Adrian Hunter , Alexander Shishkin , "Frank Ch. Eigler" , Huw Davies , Ian Rogers , Jiri Olsa , Kim Phillips , Mark Rutland , Namhyung Kim , Peter Zijlstra , Remi Bernon , Song Liu , Tommi Rantala , Ulrich Czekalla , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.11 453/775] perf symbols: Fix return value when loading PE DSO Date: Mon, 1 Mar 2021 17:10:21 +0100 Message-Id: <20210301161223.933285884@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nicholas Fraser [ Upstream commit 77771a97011fa9146ccfaf2983a3a2885dc57b6f ] The first time dso__load() was called on a PE file it always returned -1 error. This caused the first call to map__find_symbol() to always fail on a PE file so the first sample from each PE file always had symbol . Subsequent samples succeed however because the DSO is already loaded. This fixes dso__load() to return 0 when successfully loading a DSO with libbfd. Fixes: eac9a4342e5447ca ("perf symbols: Try reading the symbol table with libbfd") Signed-off-by: Nicholas Fraser Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Frank Ch. Eigler Cc: Huw Davies Cc: Ian Rogers Cc: Jiri Olsa Cc: Kim Phillips Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Remi Bernon Cc: Song Liu Cc: Tommi Rantala Cc: Ulrich Czekalla Link: http://lore.kernel.org/lkml/1671b43b-09c3-1911-dbf8-7f030242fbf7@codeweavers.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/symbol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 1645fb4ec9ed4..7dcf3327c5f7d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1866,8 +1866,10 @@ int dso__load(struct dso *dso, struct map *map) if (nsexit) nsinfo__mountns_enter(dso->nsinfo, &nsc); - if (bfdrc == 0) + if (bfdrc == 0) { + ret = 0; break; + } if (!is_reg || sirc < 0) continue;