Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1064121ybl; Wed, 14 Aug 2019 10:07:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/UXwjaezLsHOBIuHRsYLfdDJh/lbimaRQRZ6e80RG/QwF6BwyMioGdzjbL/if+B4sw+m9 X-Received: by 2002:a17:90a:7788:: with SMTP id v8mr744600pjk.132.1565802478548; Wed, 14 Aug 2019 10:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802478; cv=none; d=google.com; s=arc-20160816; b=vy9rEbwf/z1A0+1y8VrqzE8YAcTNqbsPspuicT34gaccMsO4ysVEv1NOeA9c41k+Ob uL2bsyhzrPh9Cx4g+Ve49L5BtSd4x09LCMfFmNegtAMuzpmiNULar7qp1vHlS0QHcWG+ zLiwaEtbv098G9Gxf7NZr9hUpEuBgdTgwR66zPr4VhL5Bfljg1V6bafmvtsqAzMIq2b2 GLS6IJMEEsAJUdhMUeBP0TqGNuHVgKqHi9eZ5tTmAefq7XTW+WU2bzb930FZu0AAQk+6 ANTXv0dPfjUnHGBk1g0fROYS7sR4BBSQAacF5knGYgV/sZHOpbfpKyM7U+Y621nI3QKl HFxg== 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=NWJDybKZFsWEzCdPtym8ikvuHeC+hWIMGcgPrCLjriE=; b=tQ1nwnYj8D20aZJDrVZwL8H8JlEM93wS7UPeLwXe+Z6LGWIp1c3cZT6zIPq+lTTqTF sfZRwY1VqpuwdwfStWyboNE9T1hH5vn/FbjOa6b5XqUrtu7/hqQequqtFZx4RKu1tOKx g7q6dxys/PQVVg4Ln7hQKwVoa5TTpJKSaODrTwzZZwsYedtSmZTLRF/WK3ACP4T1B1el jcWGm6Oq5uAoo7uwMDxweZyIhP1PbEtqpan/O4FNwFMZqRmG+RMDXY5utIrnuszQFfuG bJFZLflwGixaed8c6KQMcFWIcGYY2rksZ3fKvQsqJbl+Bki4nVb6M6V/GZ3S6s4NpHFm O6sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P2aL0mfG; 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 l10si167105pgp.411.2019.08.14.10.07.42; Wed, 14 Aug 2019 10:07: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=P2aL0mfG; 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 S1729578AbfHNRGF (ORCPT + 99 others); Wed, 14 Aug 2019 13:06:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729090AbfHNRGD (ORCPT ); Wed, 14 Aug 2019 13:06:03 -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 D050A214DA; Wed, 14 Aug 2019 17:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802363; bh=Qq5prsGx8ERuiCyQ2VqquS9Mn8rR3/5c2u5GfHM+YEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P2aL0mfGcPbDCiDHmqv+YEOAFJmydH2GkFI2U3XQ6p9pv2ofENEn4bhOOfKSNapUg HJJUoY0nxN/H/cab4aaTEgjqpBgFh8usq0UPsHxqp5QOdvrEvGKz11CWIZM/ozOQvB 4uf/FOaQ/FYVUJh8pEDhi7JsJ4F2Nsr5bXCRMhfM= 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 5.2 097/144] perf tools: Fix proper buffer size for feature processing Date: Wed, 14 Aug 2019 19:00:53 +0200 Message-Id: <20190814165803.938843032@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 b82d4577d9694..e84b70be3fc11 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3666,7 +3666,7 @@ int perf_event__process_feature(struct perf_session *session, 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