Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1371091ybi; Fri, 14 Jun 2019 13:33:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu6mSnArLLIxyPpHk+BD9wUECbRpH4c2jnOD5sESyXI5/hF8q0xx/jOXSc+Ug+hG4dt3Zm X-Received: by 2002:a17:90a:d14a:: with SMTP id t10mr13005184pjw.85.1560544439282; Fri, 14 Jun 2019 13:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560544439; cv=none; d=google.com; s=arc-20160816; b=pTwKt+AsL15bpurSyxMtpSFP8GDXy6YTwDIzg8GZYQbazIvJ+9l2/gGDJ3c1uPpnHY ekNtPRqqDy7iwHWZQLAAdWjf9G2VhVDkq5G5/h/APScagqb95GrL57ghXjdrLBaWnhm4 xNgRuG5WIOohl2fSPN9xZWLph+kI2hCfnrMOEfFKnp+vSu00dH5k0KMPgmW6a7V8P2MZ eLhuhh5j5I+t2gulspUO67SuD0Xz5A8rMy3rfoyJMk2NuNPY1YRMQxDVP8b7anltRWDi wnmeiT7+QHxh6zM6w/un8ogipTReX/zkMMKIACAFLZ5TtuZeTt+ANNSRBcCo3qvSTDtd GsQA== 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:subject:cc:to:from:date; bh=qV/zkmDKBN6LNPlCKx2jaaZ4c7xMEZ5arDY5Y8zv1Ws=; b=tjbOioIkn2pEEUf6gyGLEwlKZfFb14Y457eiuxQvhb3ZOGyjDP27370sLhEhQXPvIu f/f8fIwJsBsQ/c5oAQX1kkCtBRG5DyCJByoPwtN5xMhThtXiO5Eg+YyiExd3ScYYA/zi IqA2id009pPdawWTEOLYP9zGHjYWWg5V/QFWg322Cs8CNZDvhJ0gj5BND8cfvKImKgIe pZ8Y88hKyEu94hEqXoSvF4hnM0uGr7oIEMLOHUxUC/iNnnDzCouUvu6zd+RAH6OuaEYe FPUSHWlquKHNGxrc4gd1RsW6yCkbkN2yr1ICtvHuJPh9SK4D98j4k5fA3SUtMP7WrApq IIaA== ARC-Authentication-Results: i=1; mx.google.com; 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 w3si3087797plb.416.2019.06.14.13.33.44; Fri, 14 Jun 2019 13:33:59 -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; 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 S1728140AbfFNUbl (ORCPT + 99 others); Fri, 14 Jun 2019 16:31:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727206AbfFNUbi (ORCPT ); Fri, 14 Jun 2019 16:31:38 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 1888E21841; Fri, 14 Jun 2019 20:31:38 +0000 (UTC) Date: Fri, 14 Jun 2019 16:31:36 -0400 From: Steven Rostedt To: Eiichi Tsukata Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH] tracing: Fix out-of-range read in trace_stack_print() Message-ID: <20190614163136.25115131@gandalf.local.home> In-Reply-To: <20190610040016.5598-1-devel@etsukata.com> References: <20190610040016.5598-1-devel@etsukata.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Jun 2019 13:00:16 +0900 Eiichi Tsukata wrote: > Puts range check before dereferencing the pointer. > > Reproducer: > > # echo stacktrace > trace_options > # echo 1 > events/enable > # cat trace > /dev/null > > Thanks I applied this. > > Fixes: 4a9bd3f134dec ("tracing: Have dynamic size event stack traces") Actually it fixes: 4285f2fcef80 ("tracing: Remove the ULONG_MAX stack trace hackery") Because before that, a ULONG_MAX was inserted into the buffer. -- Steve > Signed-off-by: Eiichi Tsukata > --- > kernel/trace/trace_output.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c > index 54373d93e251..ba751f993c3b 100644 > --- a/kernel/trace/trace_output.c > +++ b/kernel/trace/trace_output.c > @@ -1057,7 +1057,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, > > trace_seq_puts(s, "\n"); > > - for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { > + for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) { > > if (trace_seq_has_overflowed(s)) > break;