Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1243129ybi; Tue, 16 Jul 2019 11:49:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTonKfUTZHNHUPBakHjuy652v8DGAcbPji29TLnMxBRdPdBg8gj+y26BiS8guY5C1tz2At X-Received: by 2002:a63:7d05:: with SMTP id y5mr36337386pgc.425.1563302962217; Tue, 16 Jul 2019 11:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563302962; cv=none; d=google.com; s=arc-20160816; b=HfPEkrH97+Ge7ud5XlD6X9/E/bTf1KW+v4h2GIG/pOByOnS3iXsnYsIqH5lHmP2cqu BzKzKupLZrSu/LAPvIAfRqtZUvrgy/2sw3F0pD282MusDmZOuCedH/SKnvzbEvwwbH+B oVrWphmQrIazDKh6pwGzMC73UIGchpeWOwd6LZli6OtdhsqhgjcUsL9PcRdAz0FWvtLO yhvUvfPhpP1K+IWmyTLhGSOz2SihoGZh//aOT2cjmEdk140AaHYjmO6aPSET+FawbkhA gvbWUZohJ2zKD1uVq1J2s7Ajceujoet02qA2ks1YjfXshLODDR2h7ePw15uXcIqS9AGW vOIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=i6md9rIChQVXhaUo7ltMaY/nR+bnXEpUHUJSCYG9md0=; b=TLua6UoYWUW8LJj3M0O1Zk/MOTc+3xuebS9VD0qdBbhcmNDzwJjMmhiEPN5CsPT3LY tkA2yE7yQGP3hILJ6rsHkHNkY+co7KQybzjoNNOkgKyB1xc/vT8KrtTRtUVzMmL2xeVQ C8TjrIN1y1qyaOMWIMolm4yor9dB6Lxg+lebTABcosyfPWB5X/qzsGAeU/L4Dnzg6M0o UN2Kif3gc+Cg7ucAd1NRyH1wlpDUErxhOVH5l4aI+1vhN5WXNIR+x6hpgs20WODSdPKQ j/H94ovngzwJ/yNSXp385i0mGEonAm1bBdEIMRMThfIbNB247CXMRd1GLxe+2Jbeyx4U KA6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ILTfJYZA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si21763801pfo.37.2019.07.16.11.49.05; Tue, 16 Jul 2019 11:49:22 -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=@gmail.com header.s=20161025 header.b=ILTfJYZA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388539AbfGPSsR (ORCPT + 99 others); Tue, 16 Jul 2019 14:48:17 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:45801 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728366AbfGPSsR (ORCPT ); Tue, 16 Jul 2019 14:48:17 -0400 Received: by mail-qk1-f193.google.com with SMTP id s22so15429817qkj.12 for ; Tue, 16 Jul 2019 11:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i6md9rIChQVXhaUo7ltMaY/nR+bnXEpUHUJSCYG9md0=; b=ILTfJYZA0dsy4ktuQXFAJJYv14hDbEnQAQCVgh7Iaq+NYq0ff/1ayrPU5xg8E1z/kR msIuoxQRjAX7FB7gbclF903P0R8cbXcTQb8MeEL9Xfb/4OKT5VbEQIGsI0DHb8jpDBKL O29YGMYytCg1G9XJY0B2oxN2ONXNgzp/NLscQHBHkg3vf+ckCuMnvV9DA4jiDP7gjZde kP0JVrT5cnwABvkRHFI6Kq39KhSX3UFmPO3zam73ETw1hfkd6EUOdOoC3Y4W0rVSKk2T HKM0OSlBQmuTeUIpgNVtOqAnJMtsXhJJIQMY1e+iwZ6keCRCZMAV7YUnv1J2rCNjQNSS U/Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i6md9rIChQVXhaUo7ltMaY/nR+bnXEpUHUJSCYG9md0=; b=jEGi5cYAVwSVRYs6jiJMjEhE1H1KJX9bCUBprr4rjhLyesN0Zcx/rQHzUGIuDYsLo7 yttt3gIP9SHST5Zhu5KNMl8S/rdVncfvgRQnpbTqwJWPsgRcQ+bf5ph5lVdcWj9psdaB GJIhx0ERBnmzUhHFIGVsHydkeeK0NWx7aVO3gV8sOLXob2spioqiTPMw8Pq2v9ARCO1l 6ni4JfGXbfD3W8DpQhmkAuOgMOepzFsvl4vuOZvcudASDC1pXY7DTOegB1LTE8wdY2jw mlm/p6OeUcRCBxwW4zOcm9Hy7nz1znyDPV/1yH3nSQCUAPTa4j7jLsEqN+AWL/Ww/7xr G1VQ== X-Gm-Message-State: APjAAAWJATNti58UifcIYmI9lZV8ePNfB9anbuXOoAe6Wcnwxu1ANOQ2 3fjX0UtamwoLYhmIjsBL5CI= X-Received: by 2002:a37:9a0b:: with SMTP id c11mr23468713qke.204.1563302895920; Tue, 16 Jul 2019 11:48:15 -0700 (PDT) Received: from quaco.ghostprotocols.net ([190.15.121.82]) by smtp.gmail.com with ESMTPSA id h19sm7111975qto.3.2019.07.16.11.48.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 11:48:15 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id F279F40340; Tue, 16 Jul 2019 15:48:10 -0300 (-03) Date: Tue, 16 Jul 2019 15:48:10 -0300 To: Jiri Olsa Cc: Numfor Mbiziwo-Tiapo , Stephane Eranian , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Namhyung Kim , Song Liu , mbd@fb.com, LKML , Ian Rogers Subject: Re: [PATCH] perf stat: Fix segfault for event group in repeat mode Message-ID: <20190716184810.GF3624@kernel.org> References: <20190710204540.176495-1-nums@google.com> <20190714204432.GA8120@krava> <20190714205505.GB8120@krava> <20190715075912.GA2821@krava> <20190715083105.GB2821@krava> <20190715142121.GC6032@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190715142121.GC6032@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Jul 15, 2019 at 04:21:21PM +0200, Jiri Olsa escreveu: > Numfor Mbiziwo-Tiapo reported segfault on stat of event > group in repeat mode: > > # perf stat -e '{cycles,instructions}' -r 10 ls > > It's caused by memory corruption due to not cleaned > evsel's id array and index, which needs to be rebuilt > in every stat iteration. Currently the ids index grows, > while the array (which is also not freed) has the same > size. > > Fixing this by releasing id array and zeroing ids index > in perf_evsel__close function. > > We also need to keep the evsel_list alive for stat > record (which is disabled in repeat mode). Thanks, applied. - Arnaldo