Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1070060ybl; Wed, 14 Aug 2019 10:12:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNqeMDSJTMTB1WYcDept2L6/ESgFldx8SCx7g9bW4beazchUzrYsApwuPyLzxp1C4zvsPo X-Received: by 2002:a65:50c8:: with SMTP id s8mr169419pgp.339.1565802766729; Wed, 14 Aug 2019 10:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802766; cv=none; d=google.com; s=arc-20160816; b=PhEM0gwx2mhT9MGTIWiTmAJiyCp+njdQxfT61Ly+8Pwzgl62kydzAoaU2rs1FFiR5A AP2fJI3OY8WmVho7j9u7cXhS7WkMzSzGwHrrOS7SK/gvsauQs/lYR2xMroUrSVhj6LGI iVNI3GsgoJ0+oG52tAJsWCZLiZK4/WihyJ4JPlyCsDHYdeFBx4vmXE6isJQ7O4juz8vO Il0SyBNV26GzHDQ9WV/5oNAg1GF2I63MMSvYYxHwNBH12LJMK0J3P5zkXqvBesP2v4dV +1pFQBi6jzAotwV+CrYfwhSOodlF1xROmWndWWyBKUvZ2qkd2jNbMf0kCQT2aDryfkI/ JqLg== 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=UP8fgqWR3JFi/CeAqsDo3SwHXv4hNG/lLxewdgyyxz0=; b=p1pkZg0hQiDIo2GEPO6xFynDpowXa4LAlRbNDmcIx4Wn5jKPDyboQvCEFKfqF8RA+5 Besg3N7UMzGMZ+4LwN4+3OF+QoFXCbNY07fUzflFIDFsQKE2Sd2ZcCkX9bWE/KZJAHoz xKBQnWpcUIj1/m14MqD6OxwjEpw1FVJjNCEHnGJqk/tJN8MM7Y7L5QHbTbTBbMQT4I27 dzDi1DYDULIxWoYodQYrt1dSXQTN+uSfQxWByH1HsJSXgJZSOB3ljqVt0nrLtcHT7+5T D1S/tiFHjjuIdYVrutR7BQMVa2LCJqvhC0N5wxdpP503BXVGJyig332kg0aE5z5f5auV +ghg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rBfSBxpY; 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 d18si210081pjz.58.2019.08.14.10.12.30; Wed, 14 Aug 2019 10:12:46 -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=rBfSBxpY; 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 S1730492AbfHNRKh (ORCPT + 99 others); Wed, 14 Aug 2019 13:10:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:33330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730479AbfHNRKb (ORCPT ); Wed, 14 Aug 2019 13:10:31 -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 B43BF2084D; Wed, 14 Aug 2019 17:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802631; bh=EFp/SMpBTVzWs3TIbzirQ1Eay6+G9GJO4+/DAOSrYgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rBfSBxpYShlBKHt2IWZ6GjGvuw0Mfrd6YbHymAzMDZ1M2QUhOtE3ZqdErgtD61MCo qYl4dtM1zBxQtjuQz4BHx9wh8uBHCAX6mzkB2lddAb5gFtdxweS5oq8h4dfVIM8m+W lilLIBDjxPoI6UkecwN+X0c44tc1A2j7B6KTnOH8= 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.19 56/91] perf tools: Fix proper buffer size for feature processing Date: Wed, 14 Aug 2019 19:01:19 +0200 Message-Id: <20190814165751.965803459@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@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 7f2e3b1c746c9..a94bd6850a0b2 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3472,7 +3472,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