Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1072410ybl; Wed, 14 Aug 2019 10:14:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3RRepNjhocjpURoh1O/RmjoYOQU8KgKw4SazRrJjkbUC6usc2LMWru8En/sES9iDWmr1w X-Received: by 2002:a62:6c1:: with SMTP id 184mr986141pfg.230.1565802898413; Wed, 14 Aug 2019 10:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802898; cv=none; d=google.com; s=arc-20160816; b=RjSIijkpQx5H+YEo4inaa52KnNcdK5d13TeJcPlb+6hctFJGop++oPNg1e1Qf8ZEu/ +zdEVb6iX6s3SLVuKHmcAeZHwCr+ejfR/J1bqyHBU11V19R+B75hXq/YAT+JLNFxthEY O1lG6zMxAIOXEnNlvgQ+P55ToGFUks7RAvM6DOIaax35NWTbXLQKmYOpQ8olSRhoVuu6 hoNxHQIfseKDPepm1q8ZvBv04OBci47Tk6vbjolbjrWmT26b1ykN0nglYsAHy5p6a2c4 SYNndC3JSFsqQZc4Ve6DyNANctY4No2cVaYFOdgIwqVknvI5yRfdOX1TaFCBNwm55b6N 9JXw== 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=XITda3I3Pc6CLAZSwFo9kJVyVZDJgTfjCxdnpUvz+EI=; b=TwnyxPbUGIX8yK2bngwR1yDXhRh3eP25+eRmrXAsNyf94poxhUFFX5kuM57rejR+SL GYWsdDF8kZq/Wan5+X8cqBiiCJzrZGLxsATduMYgRDUpvMX7iY2aGTIQLUBWJ2dflWnF ifgXevtlRglbPmAoB0C7XTir+e+UPOTXlaRsb7Xb/ZR6SZoZX4PYLemSJsYyhCcuiXze AutqFSWc/KTQeg8hN/nLKcBK8aNayFG6kETVlIzEQl4A5Wc6JeiXWjAjvbxaVNE7Bm70 /Ttu3JRZ9HXgduFjbNVpJNdyqlxd7zUMQzpQQPTDMjX6b/6eDefIQ9DTii6kJmVTYV5K myWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Cz/oqRzx"; 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 y11si197310pjp.54.2019.08.14.10.14.42; Wed, 14 Aug 2019 10:14:58 -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="Cz/oqRzx"; 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 S1730961AbfHNRNu (ORCPT + 99 others); Wed, 14 Aug 2019 13:13:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:38088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbfHNRNq (ORCPT ); Wed, 14 Aug 2019 13:13:46 -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 151852063F; Wed, 14 Aug 2019 17:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802825; bh=Yy44GzBlOhNX+cRH3VDEQOL4SygaJSzEKGBGdEzPOQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cz/oqRzxZNtxykNQyIC0ob4ZhGUymXbQgG5slpVqmA6SIOqMw8Jd5KJumb6Jekdw6 x9xi7NmLLbZflBY/QODua39qyDrTvTPKZfIU+bkAHnejxbtQ2UTaFL6XZaomHxjpaL EzX/9GBh5vmO0RPqz+JxGwZ6g3Otj/7IXU7M8BqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , David Carrillo-Cisneros , Kan Liang , Namhyung Kim , Peter Zijlstra , Song Liu , Sasha Levin Subject: [PATCH 4.14 40/69] perf tools: Fix proper buffer size for feature processing Date: Wed, 14 Aug 2019 19:01:38 +0200 Message-Id: <20190814165748.156633204@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@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 [ Upstream commit 79b2fe5e756163897175a8f57d66b26cd9befd59 ] After Song Liu's segfault fix for pipe mode, Arnaldo reported following error: # perf record -o - | perf script 0x514 [0x1ac]: failed to process type: 80 It's caused by wrong buffer size setup in feature processing, which makes cpu topology feature fail, because it's using buffer size to recognize its header version. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: David Carrillo-Cisneros Cc: Kan Liang Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Song Liu Fixes: e9def1b2e74e ("perf tools: Add feature header record to pipe-mode") Link: http://lkml.kernel.org/r/20190715140426.32509-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 26437143c9406..c892a28e7b048 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3081,7 +3081,7 @@ int perf_event__process_feature(struct perf_tool *tool, return 0; ff.buf = (void *)fe->data; - ff.size = event->header.size - sizeof(event->header); + ff.size = event->header.size - sizeof(*fe); ff.ph = &session->header; if (feat_ops[feat].process(&ff, NULL)) -- 2.20.1