Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1336217ybj; Fri, 20 Sep 2019 08:51:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqw45mL3tKt0o6HpDCGhbyxPHBxxRpGnxnS1v+knDh7wRdwET1l18C5bUtxziQRybnU9lbCQ X-Received: by 2002:a50:ef12:: with SMTP id m18mr22449761eds.18.1568994663566; Fri, 20 Sep 2019 08:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568994663; cv=none; d=google.com; s=arc-20160816; b=Auhcyi7Ed6CFOXouzfargr5djloZN6dI3t+SaxYaOe3uvb4BU/zSRww7+gn2zTJLFa yVKw7GTNve+/meoPyWkiUgH9HHP4gMLgITR+ExmGbqMMpvKdjwP8oFcNHmFm1CKx+iE1 bVAIaVtd6rL/252GJtmd7tDqjyUaBS30vmiyV303qsKgK+psbYjcvVJh7a/LmQv8MNzq IInG8rVEPo3RnLUHPij+ZnKeTbtD1JJk/I/Ksc5vSKaOuoSN4JQW9Yb2ZvIgPsKZJxkL Pwcbi6f4Eocr6mIf8+Poze2yA/JJ5lYlfcFM1+zUJquzCPGVwiz8VqeA46K7Q0eA7iTw nX4w== 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=iZbrWMGU2oaz9OZtF6ZYoslVJPQyrYqUyImC3jo00NA=; b=je/Pqj1sMCT0Jy3NjPE7oiFGhjnxNDcek5VUig9f7k0ZQhCa0jXRUlRtqmmGtg1THa uaA8hGDpay7B7AifYODuodSzNhUcDP5AhldKcWA6+XMyIGiC0iFMbFoLaijSBjmoa/bY E46ZwR+zHvQ+I+71XPi1wIIwr+P+Y133RYoFQnRmHrWK3X6TGhXP27bInJA5Z4Ee3q6N wdbYNedKKPT0ETUvIyMC6FVowhGF8LLfBB9rPs/I5lF+81WHVoWAWofc0MR6LQP2FQnr a/IrWH4AGClA5yhdQMGX+0nGK0gsmyLiMtWWnC7T7WhEKmxrGEUHsiJro9AnE0/ozLep Nr9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JueD8uZe; 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 m20si1478001eds.363.2019.09.20.08.50.39; Fri, 20 Sep 2019 08:51:03 -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=JueD8uZe; 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 S2407014AbfISWXi (ORCPT + 99 others); Thu, 19 Sep 2019 18:23:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:39374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404833AbfISWXg (ORCPT ); Thu, 19 Sep 2019 18:23:36 -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 4FE5021929; Thu, 19 Sep 2019 22:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931816; bh=VlEPEG/5/6vOlgK2tyw5SjA1y6Lt098z68Ly0L6u+/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JueD8uZeotFEgwrw6NhcKw1LPMgVlvWpQwSx1ixczjd/xnzjy87rJXTG6yFHCV++P ygmM3n/bvlyWS7HpP4gijKblPQ/OIH2oQbpXmSl2Uc+ZZhycCVRjrh+dj6/T66cjab yMxqjJOZHev9lNCun3eXMstkEzMP9PQ7fHjcNO8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naoya Horiguchi , Len Brown , Sasha Levin Subject: [PATCH 4.4 50/56] tools/power turbostat: fix buffer overrun Date: Fri, 20 Sep 2019 00:04:31 +0200 Message-Id: <20190919214803.948625363@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214742.483643642@linuxfoundation.org> References: <20190919214742.483643642@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 From: Naoya Horiguchi [ Upstream commit eeb71c950bc6eee460f2070643ce137e067b234c ] turbostat could be terminated by general protection fault on some latest hardwares which (for example) support 9 levels of C-states and show 18 "tADDED" lines. That bloats the total output and finally causes buffer overrun. So let's extend the buffer to avoid this. Signed-off-by: Naoya Horiguchi Signed-off-by: Len Brown Signed-off-by: Sasha Levin --- tools/power/x86/turbostat/turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 532e7bf068689..58cf161887225 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3014,7 +3014,7 @@ int initialize_counters(int cpu_id) void allocate_output_buffer() { - output_buffer = calloc(1, (1 + topo.num_cpus) * 1024); + output_buffer = calloc(1, (1 + topo.num_cpus) * 2048); outp = output_buffer; if (outp == NULL) err(-1, "calloc output buffer"); -- 2.20.1