Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1319107lqd; Thu, 25 Apr 2024 11:44:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXbOwXbBzi2DaCzcF7iPlLVdpm+1YauQKxAs4cLmrztYSZXOHnnJj6RxhCvr0Wbc9GCGqhZ0hnElH9+Fj7qsv9UZpJA0LScg5k2gA66oQ== X-Google-Smtp-Source: AGHT+IEC8Y6hWCp6Xx6r09YGZQW1llPa2xqUthifM6/fTPl9v4bEfRdxgG63FYx+83VL2QCO7SrD X-Received: by 2002:a05:6122:9a9:b0:4d8:7789:dd0d with SMTP id g41-20020a05612209a900b004d87789dd0dmr276092vkd.15.1714070657922; Thu, 25 Apr 2024 11:44:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714070657; cv=pass; d=google.com; s=arc-20160816; b=e8uynD7RtMfwGZSqIjEz3tY74QkeRDzmPv9SQFTplcdpgWHPcrz+UY1VE7+d/peXo2 eiJnGcma6itCzyijiB5h9/9OEbbXJoVug0H+oEM9hGeFsYK5NLIeUUSNfO9Un9qEiJRy Ywmlu3TCiczzNWOuwynlMuA5bO3puH3ECAOGfHKr7AgpDAwBnkPRdx7jWLzBtXflEUcQ heKnGxKIISREmfvJl/ylmkohoK+Qpd3U2kF1zn/26MnDYa1FEvGlF0bf2xxHai0t91GM Iou/8pcetFTKM+OprElscA/J/zzz5XJUTfV56k+hWyDy2HaAFuBiLNftjmlik5eXIkmM Oz9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=acSDrPQlTmMY5axUe8gLBlgZoCFpjmWQuhb05bY8lPM=; fh=wGkpNuzoAQz7Dj/ZEG9z3s+QzOdrD0rUmlsd77RTR9U=; b=i7IcjjDhW8Omw3mukevtykrFOZ+yfHC8WVy0MY61GOphX+uNh8AT4EJ1A2sJql/lj4 0QEB1/X1uwetbn9pZwXYM4bseSsq/ET4gw/rjHhL59MgIxeQJlgc1METkqC6fBA5gUKF 5aNKax7PwIFhD6vVLV2UgyHsISh+17Juz2Gpv1bAMBESlnLtkZuNPWaAkpAK93hTNYut RjieIspmORiPOj7MmWJG/5aWzQRVpT1h2TwL4XGqIJN+//C6DFI9QnBVe8q5Rswdp1F0 t/LIsKB0KE0nyIfbpryo7rRtP/EEgX7fVHxR4YhumCcJbvueoptk7NLEn7Q9GsU7vCJj 2x3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vAMNXiVI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dz23-20020a05620a2b9700b00790676db7c7si14217990qkb.352.2024.04.25.11.44.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:44:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vAMNXiVI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4734D1C2105E for ; Thu, 25 Apr 2024 18:44:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF45B14EC5D; Thu, 25 Apr 2024 18:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vAMNXiVI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4FCF12C559; Thu, 25 Apr 2024 18:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714070645; cv=none; b=GPiw8HWgaIIJQmmdDJyfd/ou1wveEOkQZdNdc3Kg8YLNnXXNlkLfjaVQn9fhah1ay/PRUImTKxVbhERy5gY1t/vFjcDtnjxslXFDOXAZh6KIqVKIeor2JWwvzj+S42ku4hKpYICbKWWhGLaUwR0d4EhWGxFMwOu2AcMtBDDgugY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714070645; c=relaxed/simple; bh=UMnP0mnL7grQXshDwkjNarPO6eRVbHtAkUexGt6fxx4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G6wVuAOBTTguX3Sl0n5g1nYCRUH0AuNSy6NVuv4bHg5UXvwejPshFJpykGsmcCmmGRsxuiLDRhxeXcyL/dcJhnbYYUTadau65EYPsnUpPtAddvjtcxxPCu43hBpEo58j5g2fbzeMsL1vklqhlrjxyKIf+V248+QDekTfUe86iF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vAMNXiVI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3B67C4AF07; Thu, 25 Apr 2024 18:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714070644; bh=UMnP0mnL7grQXshDwkjNarPO6eRVbHtAkUexGt6fxx4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vAMNXiVIvoFFAn/ntq5SR2ZwG723BMuth8qUQU8VVXh9o0P7K0ICwyp9JEnM5Lu5w ha3gvTMYpaiKa293+Ubtwf4l5NnLlTWe+Exysid4SqjYHi/2n85Uph1StH6vaGV6kY ob6YluVmgVazLCtjQIbVtKN7yjGAOIaHztMepJ8LZRE4LpmEFE6m1r9fh0JWovg1gz lAfKa9NGKZrv+woiLQzbKdsMjmyAYFg2KFZiTUMZzoRXNImryHnlkC36nY4tFM2Nx4 UBW6mYJziTVaqlJSCvgUwBvoJmlXVAr+4UudPU6xUt3MOq4y5h2WhJYJWHbhv8QIql lcR3eWefwgG/Q== Date: Thu, 25 Apr 2024 15:43:59 -0300 From: Arnaldo Carvalho de Melo To: Adrian Hunter Cc: Ian Rogers , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf intel-pt: Fix unassigned instruction op Message-ID: References: <20240320162619.1272015-1-irogers@google.com> <20240326083223.10883-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Mar 26, 2024 at 06:52:12PM +0200, Adrian Hunter wrote: > On 26/03/24 18:13, Ian Rogers wrote: > > On Tue, Mar 26, 2024 at 1:32 AM Adrian Hunter wrote: > >> > >> MemorySanitizer discovered instances where the instruction op value was > >> not assigned.: > >> > >> WARNING: MemorySanitizer: use-of-uninitialized-value > >> #0 0x5581c00a76b3 in intel_pt_sample_flags tools/perf/util/intel-pt.c:1527:17 > >> Uninitialized value was stored to memory at > >> #0 0x5581c005ddf8 in intel_pt_walk_insn tools/perf/util/intel-pt-decoder/intel-pt-decoder.c:1256:25 > >> > >> The op value is used to set branch flags for branch instructions > >> encountered when walking the code, so fix by setting op to > >> INTEL_PT_OP_OTHER in other cases. > >> > >> Reported-by: Ian Rogers > >> Closes: https://lore.kernel.org/linux-perf-users/20240320162619.1272015-1-irogers@google.com/ > >> Signed-off-by: Adrian Hunter > > > > Great, thanks! Should it have a Fixes tag like: > > > > Fixes: 4c761d805bb2 ("perf intel-pt: Fix intel_pt_fup_event() > > assumptions about setting state type") > > Yes, I should have put a fixes tag, cc stable. I think the issue > has always been there, so: > > Fixes: 90e457f7be087 ("perf tools: Add Intel PT support") > Cc: stable@vger.kernel.org Thanks, applied, had fell thru the cracks :-\ - Arnaldo > > > > Tested-by: Ian Rogers > > > > Ian > > > >> --- > >> tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++ > >> tools/perf/util/intel-pt.c | 2 ++ > >> 2 files changed, 4 insertions(+) > >> > >> diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c > >> index b450178e3420..e733f6b1f7ac 100644 > >> --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c > >> +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c > >> @@ -1319,6 +1319,8 @@ static bool intel_pt_fup_event(struct intel_pt_decoder *decoder, bool no_tip) > >> bool ret = false; > >> > >> decoder->state.type &= ~INTEL_PT_BRANCH; > >> + decoder->state.insn_op = INTEL_PT_OP_OTHER; > >> + decoder->state.insn_len = 0; > >> > >> if (decoder->set_fup_cfe_ip || decoder->set_fup_cfe) { > >> bool ip = decoder->set_fup_cfe_ip; > >> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c > >> index f38893e0b036..4db9a098f592 100644 > >> --- a/tools/perf/util/intel-pt.c > >> +++ b/tools/perf/util/intel-pt.c > >> @@ -764,6 +764,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, > >> > >> addr_location__init(&al); > >> intel_pt_insn->length = 0; > >> + intel_pt_insn->op = INTEL_PT_OP_OTHER; > >> > >> if (to_ip && *ip == to_ip) > >> goto out_no_cache; > >> @@ -898,6 +899,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn, > >> > >> if (to_ip && *ip == to_ip) { > >> intel_pt_insn->length = 0; > >> + intel_pt_insn->op = INTEL_PT_OP_OTHER; > >> goto out_no_cache; > >> } > >> > >> -- > >> 2.34.1 > >> >