Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5580326img; Wed, 27 Mar 2019 11:05:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDVgsb0+CRjO3jryyQi9IwLeViE6vwzh9V3/cSRYvctEuBBfkUWIIPJcoXNSimBhX/GiuW X-Received: by 2002:aa7:9088:: with SMTP id i8mr35842215pfa.118.1553709912824; Wed, 27 Mar 2019 11:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553709912; cv=none; d=google.com; s=arc-20160816; b=Vow73oZWkMegFTPpPZ/HQ3XL8jETYYqtV0Xb5f/mZnXRFtWmN+7qlsgvCw1+e88L+y hoPNdycjrJu8NaHJLUcLgA+tn+m/CD0E8baRsb2rojyPnD/vhLbEITMlXQUfHtMYwzXW LwIpl9H60FpxtflFNSnDr7lu1tSZQ2CqR2T8gKY73xuxsExIwhFIggonJorUdlfxkrAQ VGYvjGxgxq1dT5BwQt8oeurW18auEQKH8X1Dc/OBUgWx33kgg2naB1XSTj2sZBGzbFHZ FNswYK6nwesku2oNmulsLfwUuICLydOCOTQcubY7rPsWrX3pf+hb6VW6oW2PxKjytxHh 2uNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k0g+CvKvGgpLv+fSGP1EDdJl9TlPQ4yMD+4S5nNRBIg=; b=z/Pdo9mTwUsJjnQZDfsi9r9gQXSWP+8ofViaAerYd+46fSozyyg/fa5xqfUABX1zuW +fPhNtdr417icBGJOhSZBdEa5hL93vvzoCGxeyecHYxf5A6mB/u5Bl4ZPJWC8eU0kmw/ Z0MsG1/hZJFDiKfI0z/W8lEX5shBXsT5vjk8As5dLdp/QXQcX0SU/jRCtrgdSK+5Po3V GlyARLYqElvzR4Ke84f3Gk5YxE+W9pbtbSTAuoiQSVpRyeH3ETZZE1IPz8qt4NwSWFbS 0GXw53QhFUaMNxOW/00z7fbctUBIPK12dTAgGgcXA2Bul1mRlXwIZJwPad/6gh/khlLh 6ErQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0vfCJMmW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si8134639pgm.373.2019.03.27.11.04.57; Wed, 27 Mar 2019 11:05:12 -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=0vfCJMmW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732812AbfC0SDp (ORCPT + 99 others); Wed, 27 Mar 2019 14:03:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:44042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732685AbfC0SDn (ORCPT ); Wed, 27 Mar 2019 14:03:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C4ED2075C; Wed, 27 Mar 2019 18:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709823; bh=WNfYZh7y12hNPXAUXG9FRgRujFq8M7ZP7RIoYcnNdHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0vfCJMmWaAx6dlu2AKG55IjHSot7hjqqYGE1l8IkgsBl63DXKLtI9KvwGMRyXxv1W KUE8NIoSpwr3k8dgzfZDqLxLQiWK11PD2JxGAA/KQPeueyDApGlJZ3XMNBF2r12oSw Mg34aXNwN2iSbKkKRZjAoHTD1utWZqeaNgsx4MgU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tony Jones , Frederic Weisbecker , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL 5.0 060/262] tools lib traceevent: Fix buffer overflow in arg_eval Date: Wed, 27 Mar 2019 13:58:35 -0400 Message-Id: <20190327180158.10245-60-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Jones [ Upstream commit 7c5b019e3a638a5a290b0ec020f6ca83d2ec2aaa ] Fix buffer overflow observed when running perf test. The overflow is when trying to evaluate "1ULL << (64 - 1)" which is resulting in -9223372036854775808 which overflows the 20 character buffer. If is possible this bug has been reported before but I still don't see any fix checked in: See: https://www.spinics.net/lists/linux-perf-users/msg07714.html Reported-by: Michael Sartain Reported-by: Mathias Krause Signed-off-by: Tony Jones Acked-by: Steven Rostedt (VMware) Cc: Frederic Weisbecker Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a") Link: http://lkml.kernel.org/r/20190228015532.8941-1-tonyj@suse.de Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/lib/traceevent/event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index abd4fa5d3088..87494c7c619d 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -2457,7 +2457,7 @@ static int arg_num_eval(struct tep_print_arg *arg, long long *val) static char *arg_eval (struct tep_print_arg *arg) { long long val; - static char buf[20]; + static char buf[24]; switch (arg->type) { case TEP_PRINT_ATOM: -- 2.19.1