Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1251705pxa; Thu, 20 Aug 2020 06:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXynloUZnIo4avS+SNaM9ypT1r/duHPJhHWe3HJgeEvpZyskrAuP4KxsK3tW6unHWj38G+ X-Received: by 2002:a17:906:98c1:: with SMTP id zd1mr3492925ejb.410.1597931325853; Thu, 20 Aug 2020 06:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931325; cv=none; d=google.com; s=arc-20160816; b=H9yDBZykcuuXCgWBrEd/uN7JcjVnSJcf08z+UT3fV+myD6GZ6k3og3qAjlkb1Iio3u UEujX0kYIWJQMV4HFLd6YfT92obYwJYJ2dZnqCiXb5KphhtHyTIVPFODIP+biV4NVP8v wnlPO+IGX0bjeRgNWgJ0K0tQENirHGPvcGqfqUWGCmew/v1IsZNn4RjYkmZgpgSwEdaP M7hEKdN9thaAnFj2TbaZ4ezPp8S3ubjHkODTiiOYdleexFsGN07haYU10PBeg4st0zGp CIvhhMdTdc1dexfxqloCjuZcybYREsIgSKWyp2FomkVshm3QrZ52JzQlVVrRo8u9ZsnO qGpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GOQUA9nOjdHqa/zfEb57kin32lHL5sx3Rh3okFsJuZU=; b=Vv9TWYcBPYFsXZulYoafWsq+k+s9cWiUkT72ckGcyO+htY0hV9Nyrxt46ApX3tDNYt LDkemt1x5XSz3o2XkzfjhCNSjeWMxhvOh2rEmJBh2AwrJX/kZ/9avC0f5Bu0AiL88t+u ztrLTRyHv6OTJsjdU2cTPAPcXHy4Woh1zhKSK6JwljFpR1+RKsPaWSMZBGCB4ttlZtQo Ao7Jp6PXkCbbQ6ThspEU9kLGYdxqfe8aUxs/NPNRSvFKTWu3/hTTl6oWo7SpeeVn+TG3 NNRAvIpYHI2Fo4ZD3nRwDjIYS8ZWByGfW/2u20CryuK6WueXCEFUuQ4obReJDlKTErDX A79A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HScMFZLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n28si1438896eda.478.2020.08.20.06.48.21; Thu, 20 Aug 2020 06:48:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HScMFZLu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730083AbgHTNpK (ORCPT + 99 others); Thu, 20 Aug 2020 09:45:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:33352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727943AbgHTJ2P (ORCPT ); Thu, 20 Aug 2020 05:28:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 732EC22D3E; Thu, 20 Aug 2020 09:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915692; bh=4PcJebeh/Ll0u6T2COoRTK6XyspIHlBi+EwMv6Zg/BA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HScMFZLuucr8SU/DyhCfHwhReS++DCj6EXuunKXVyjuKMKburRKl1wzjwxRFfHEdE un6lwtvEDvt16r+1KMtSHaAhHB88I9WUgOukOhext0781D1aYHuTR8PrbHFVE557uf CK+Dqj1c0kygeNJlCKw4qBNaXi1Sjzktst/JC6P8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Kleen , Masami Hiramatsu , Srikar Dronamraju , Andi Kleen , Oleg Nesterov , Arnaldo Carvalho de Melo Subject: [PATCH 5.8 102/232] perf probe: Fix wrong variable warning when the probe point is not found Date: Thu, 20 Aug 2020 11:19:13 +0200 Message-Id: <20200820091617.773551777@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu commit 11fd3eb874e73ee8069bcfd54e3c16fa7ce56fe6 upstream. Fix a wrong "variable not found" warning when the probe point is not found in the debuginfo. Since the debuginfo__find_probes() can return 0 even if it does not find given probe point in the debuginfo, fill_empty_trace_arg() can be called with tf.ntevs == 0 and it can emit a wrong warning. To fix this, reject ntevs == 0 in fill_empty_trace_arg(). E.g. without this patch; # perf probe -x /lib64/libc-2.30.so -a "memcpy arg1=%di" Failed to find the location of the '%di' variable at this address. Perhaps it has been optimized out. Use -V with the --range option to show '%di' location range. Added new events: probe_libc:memcpy (on memcpy in /usr/lib64/libc-2.30.so with arg1=%di) probe_libc:memcpy (on memcpy in /usr/lib64/libc-2.30.so with arg1=%di) You can now use it in all perf tools, such as: perf record -e probe_libc:memcpy -aR sleep 1 With this; # perf probe -x /lib64/libc-2.30.so -a "memcpy arg1=%di" Added new events: probe_libc:memcpy (on memcpy in /usr/lib64/libc-2.30.so with arg1=%di) probe_libc:memcpy (on memcpy in /usr/lib64/libc-2.30.so with arg1=%di) You can now use it in all perf tools, such as: perf record -e probe_libc:memcpy -aR sleep 1 Fixes: cb4027308570 ("perf probe: Trace a magic number if variable is not found") Reported-by: Andi Kleen Signed-off-by: Masami Hiramatsu Reviewed-by: Srikar Dronamraju Tested-by: Andi Kleen Cc: Oleg Nesterov Cc: stable@vger.kernel.org Link: http://lore.kernel.org/lkml/159438667364.62703.2200642186798763202.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/probe-finder.c | 3 +++ 1 file changed, 3 insertions(+) --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1408,6 +1408,9 @@ static int fill_empty_trace_arg(struct p char *type; int i, j, ret; + if (!ntevs) + return -ENOENT; + for (i = 0; i < pev->nargs; i++) { type = NULL; for (j = 0; j < ntevs; j++) {