Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5615087img; Wed, 27 Mar 2019 11:45:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxT+cJCTp3sbZ2MaUBPbtihYAzlpfDmY1ceOwEQatcIoOBtzOHAlplRT1KNUzJTPPQe7MTE X-Received: by 2002:a17:902:f81:: with SMTP id 1mr4187994plz.216.1553712344589; Wed, 27 Mar 2019 11:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712344; cv=none; d=google.com; s=arc-20160816; b=K2lZXcMjW0SHrLjGBfjEACZ/DJ738TM3JvT7rin5wZTL6A/o9eQ8piBj+w8rCxxGPl JVkusYOEj81B3SYfNcPz9IQScztxMdUThPCT5huagD9lk6b85Ko9Sb0qAbovx3Y6xw6w 1SkhnNILDUNmy1jZPBaPNxiHi3a4czE9l/mN8tSmsqJHMX7NPzUlTnwBFg69d8t+Csjf x1DH+xzz6JCcm5ApzirgNNl/QKIKkDa87jTsGuZUT4Iz6n6txs06pJGPzza5vpZQGUW+ qG/+QKDeqcM+0gH8p9GRW7nUv9RPQqgI7bnQ+93V/ga8l4Zy1YXk0JKswH1cOulSM3Fd 6ZEw== 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=1/HC5aNsOPZI8oTSQH8w4MH6EaMPhqcEES7CCe2Xexc=; b=VMdHEyvQ99iWhDm6sxymDSgkbSPDuy3i0mfTYP+6BeHsf+O95XoPQ3JLfVx+zguJNR oeE3nbat5x/D/7HE8cz1pkhSEBWIWHQeN8cecwvVphTE696mGXCZUYCi13cJPFzHCk+k hIBXxL9dhUpHBVjjDVtn0b+FhN1OkQl0ok+ys5UDKthckI3oQazHRmrK2Qa9wM1NAc/J tarIlp28DrZhTKz6AfHJGXCoE8Mi5h0pYFsIgRWeqPFzeo+SBm1pEdlFIKHiba8lyApO t8Vae5bNnoiMVIFapWXDfp5FxIA4KWapYSXSsvuSl2dvQT/W/F0HQGXBEOxy7Nas2R9i vElA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DJvlKS7h; 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 q7si13042452pls.259.2019.03.27.11.45.29; Wed, 27 Mar 2019 11:45:44 -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=DJvlKS7h; 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 S2391143AbfC0SVV (ORCPT + 99 others); Wed, 27 Mar 2019 14:21:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:39198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390824AbfC0SVU (ORCPT ); Wed, 27 Mar 2019 14:21:20 -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 747892063F; Wed, 27 Mar 2019 18:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710880; bh=2j7PLRLt/M+BsKgB9z0U9KW2fA2Leh2JvhNClrDAYH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJvlKS7h/NTHkM42zu/XfAeHnroyD9k8QyHtq96sv4BtdpVtGkeqAPfFtnoA1duDT RBXqwJdLkoDycFVnHqbB6aaPK3yk4SgisAm4dfGr85VNSnpGzJUNBSdrNbfsyfh6WX IgQ5duzmy9kj9NEhoPHIX9eDg19Rg2twv+vNa/Hw= 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 4.9 23/87] tools lib traceevent: Fix buffer overflow in arg_eval Date: Wed, 27 Mar 2019 14:19:36 -0400 Message-Id: <20190327182040.17444-23-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-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 669475300ba8..700c74b0aed0 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -2428,7 +2428,7 @@ static int arg_num_eval(struct print_arg *arg, long long *val) static char *arg_eval (struct print_arg *arg) { long long val; - static char buf[20]; + static char buf[24]; switch (arg->type) { case PRINT_ATOM: -- 2.19.1