Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2213454imm; Mon, 28 May 2018 04:04:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrcY2lM4D/enp7fyUUjq0k+G+nF2l4QCd6T6871UHfxAdpW+RH9gwGyHrTDN/adGt8q2Eck X-Received: by 2002:aa7:8254:: with SMTP id e20-v6mr11893165pfn.140.1527505492294; Mon, 28 May 2018 04:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527505492; cv=none; d=google.com; s=arc-20160816; b=Krudwf0XLjLSWqiGP9voOTMX4vj4WshLW7zoe0wsrOrlpFezQkMFMz31mu+zCJmZJI 5ANlKa7FCsd2Z5ZyAiR/4esFmQKeUa3hc8LTY42HVEuVQIs0X15SQKB66jA5sErekHmS rPPLwiUs3guWUnGK80dSrcZLWHpUJAjPgXnfbRRiDhD1MVNlQLZ9F30QMpNwUo8JJ0/t 77ThlWmC0JKib7bTHAy2EWqZ8wRhWn0o8Lp0UePZzqHFrp0i7sMDW3939uYfdIX5GCEB RKCmjKBJHIpHyB9ApCnzyigiN8KvdGdwJtW/qM0v65TnZfbOv3Cy6XzfKEkAuyO0NhFD VsgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=IjChledsXw84qWSSC6XIkWoDiH9stz6N4xkBKBQuAlM=; b=mDOV8tdrgzyAcyGuVw5qSJcON6mZ+cm8aqNuL1mOsF9m1MJhTXSc2X3RUEL/+vyJB/ AxeMZEQC4AGlXG1/fn+lkOcKcdqVUfaUtId1GWKdIngOfzK9yUafgLzsNm/y2ECuriHZ FGVxx62H1YM8w7X0qdZTSGvdrHLOuxEoOhE2ywKaALjMyQ6KXtHCdyDX4URwAVxkCxnH kPUgHzgr73jPFylgpDuhOUXN39QAL52v78NBruJYI4BZW5RLTquyEYBC4q5CM7h4bG6h m5k19g5Uqw5lY0kof/JwLwUZw1TOhIzL2XWp2mXdzCUnYgYcOw202M6c2OBz/rQWfrWu nGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hacabXKa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18-v6si23609261pgt.63.2018.05.28.04.04.36; Mon, 28 May 2018 04:04:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hacabXKa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164944AbeE1LDS (ORCPT + 99 others); Mon, 28 May 2018 07:03:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:50422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422907AbeE1LDJ (ORCPT ); Mon, 28 May 2018 07:03:09 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 136EB2087E; Mon, 28 May 2018 11:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527505388; bh=OiiWC82ydPFbR+3qsaTy9cyacOnvVM//lCZgtzZ7bEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hacabXKaFPH4Maqobfr+1JPMtdX4pmBSLGgp+4VRwp2JOPA7e5+YisTzejE1VMWrX 1WhL/nYpdGMiYW+dq4lYvXkvHXsw+1TD6lnQzs/lL+YzkNAW2juQlENYxNpEhlixs4 fe9PvACc2zgFWc8y+ZR5KjFPAh7zCz8A5jkiiDMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Olsa , "Naveen N. Rao" , Alexander Shishkin , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 480/496] perf tests: Use arch__compare_symbol_names to compare symbols Date: Mon, 28 May 2018 12:04:25 +0200 Message-Id: <20180528100340.120974924@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Olsa [ Upstream commit ab6e9a99345131cd8e54268d1d0dc04a33f7ed11 ] The symbol search called by machine__find_kernel_symbol_by_name is using internally arch__compare_symbol_names function to compare 2 symbol names, because different archs have different ways of comparing symbols. Mostly for skipping '.' prefixes and similar. In test 1 when we try to find matching symbols in kallsyms and vmlinux, by address and by symbol name. When either is found we compare the pair symbol names by simple strcmp, which is not good enough for reasons explained in previous paragraph. On powerpc this can cause lockup, because even thought we found the pair, the compared names are different and don't match simple strcmp. Following code path is executed, that leads to lockup: - we find the pair in kallsyms by sym->start next_pair: - we compare the names and it fails - we find the pair by sym->name - the pair addresses match so we call goto next_pair because we assume the names match in this case Signed-off-by: Jiri Olsa Tested-by: Naveen N. Rao Acked-by: Naveen N. Rao Cc: Alexander Shishkin Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: 031b84c407c3 ("perf probe ppc: Enable matching against dot symbols automatically") Link: http://lkml.kernel.org/r/20180215122635.24029-10-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/tests/vmlinux-kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/tests/vmlinux-kallsyms.c +++ b/tools/perf/tests/vmlinux-kallsyms.c @@ -125,7 +125,7 @@ int test__vmlinux_matches_kallsyms(struc if (pair && UM(pair->start) == mem_start) { next_pair: - if (strcmp(sym->name, pair->name) == 0) { + if (arch__compare_symbol_names(sym->name, pair->name) == 0) { /* * kallsyms don't have the symbol end, so we * set that by using the next symbol start - 1,