Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2396896ybj; Mon, 23 Sep 2019 03:08:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9WQ7W+eJsla9g5U3uzfG614KAH0mVQl8sTsDx6UXCGmR/M2a/5Y99mUP8jsO04azkkVjU X-Received: by 2002:a50:d096:: with SMTP id v22mr36248929edd.81.1569233293914; Mon, 23 Sep 2019 03:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569233293; cv=none; d=google.com; s=arc-20160816; b=LrwH95HBTOVYKuPXwHLuxPHd+a4rForfrXT4Bhfx82Tgfg7k23Bci4+STI1MfmMBFb a9qHxhLxkQUMgMdSb0XgaioF54uKBOhalR9d5nkYh7ZSyOjjs9x35yJF0PHCCJTMAq9s 3ABuQyHpguNoWdSahVx/N0FUd0lJA9gkdqAbGfbNWpaRU2iRObIH+xyD1aNRCLPTnpoe /pJ8r4TKTfhTeL+smDjY+9A4NBNiOLes46InMaPLBFDRz66shlbYvHm6C6q0B6uP4C5g ftLchKc0ZB41Ao4ZW2Kn9TnSQPjlxA9infbnMlq3KdDjnuzkTp/8j8OaUHqcq6pbMElz XHoQ== 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:from:date; bh=r4JTou9HIrzexbJvFknPkdl4gFflk1U6B02+G/dXQi0=; b=t+Tezdhg5gSkJzGMpW8eM5OdiXUsjzScYN144qrOzf7pH0npdT3fLcEn0poTCRMHd+ HJGJCXW4v5p7G6mH/RS4lxKhbjzAK/njSXXe0BNnZZXgG+51PUqknXX9s+T7ScdVbTAh +N+vvLeibkZP4D18MdYT+l9O9f9Yno33iF9IRQZ3n4VTkSOGXWfuzBryR9NYZ8AExGDF l2BM51b2iIARr5KEmOi5aCBnzltpvnr7LnF5DQ9UZrCHwGpQuzfZ9ZAGWBoAASb/gEUW FctOJrgBMxDUsPB7Lmr6WmGMqRipLuf9lw5to7FiHIr5kd99yYzJ5BxyGdA4I6YYKMg2 IAcA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si6226354edu.432.2019.09.23.03.07.50; Mon, 23 Sep 2019 03:08:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405389AbfITSoj (ORCPT + 99 others); Fri, 20 Sep 2019 14:44:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53498 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404617AbfITSoi (ORCPT ); Fri, 20 Sep 2019 14:44:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE87C307CDFC; Fri, 20 Sep 2019 18:44:38 +0000 (UTC) Received: from krava (ovpn-204-62.brq.redhat.com [10.40.204.62]) by smtp.corp.redhat.com (Postfix) with SMTP id DD0B060606; Fri, 20 Sep 2019 18:44:35 +0000 (UTC) Date: Fri, 20 Sep 2019 20:44:33 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: Re: [PATCH] perf tools: Fix segfault in cpu_cache_level__read Message-ID: <20190920184433.GB26850@krava> References: <20190912105235.10689-1-jolsa@kernel.org> <20190920182026.GA4865@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190920182026.GA4865@kernel.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 20 Sep 2019 18:44:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 20, 2019 at 03:20:26PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Sep 12, 2019 at 12:52:35PM +0200, Jiri Olsa escreveu: > > We release wrong pointer on error path in > > cpu_cache_level__read function, leading to > > segfault: > > > > (gdb) r record ls > > Starting program: /root/perf/tools/perf/perf record ls > > ... > > [ perf record: Woken up 1 times to write data ] > > double free or corruption (out) > > > > Thread 1 "perf" received signal SIGABRT, Aborted. > > 0x00007ffff7463798 in raise () from /lib64/power9/libc.so.6 > > (gdb) bt > > #0 0x00007ffff7463798 in raise () from /lib64/power9/libc.so.6 > > #1 0x00007ffff7443bac in abort () from /lib64/power9/libc.so.6 > > #2 0x00007ffff74af8bc in __libc_message () from /lib64/power9/libc.so.6 > > #3 0x00007ffff74b92b8 in malloc_printerr () from /lib64/power9/libc.so.6 > > #4 0x00007ffff74bb874 in _int_free () from /lib64/power9/libc.so.6 > > #5 0x0000000010271260 in __zfree (ptr=0x7fffffffa0b0) at ../../lib/zalloc.. > > #6 0x0000000010139340 in cpu_cache_level__read (cache=0x7fffffffa090, cac.. > > #7 0x0000000010143c90 in build_caches (cntp=0x7fffffffa118, size= > ... > > > > Releasing the proper pointer. > > You forgot to add: > > Fixes: 720e98b5faf1 ("perf tools: Add perf data cache feature") > Cc: stable@vger.kernel.org: # v4.6+ > > I did it, please consider doing it next time, will do, sry jirka