From nobody Mon Feb 9 12:12:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFC71135418 for ; Wed, 6 Mar 2024 18:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709750509; cv=none; b=Y5RCXMiWKRdH4UkinUOdRX6HSU+Pf7raG/Ije492UtoMRblrxGyrI42FDKGGYkYfjhD/IJgTPs7+AlUqB4AAyNTnrdfjGqEgKiWeqefWpP+sMBjuHGWtR0iY81iVok50LyjEae2yRJ4c5sS721FupWj9mo5ffYT4QbRgHTVJ9/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709750509; c=relaxed/simple; bh=X4WfEJ6vv6eukyGzEmI+iPFGtD8Sbu7/bUkHDWL7TCM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=gmjT+K+BOjBkkm8aX1gYEnX9Z07UFKtREDLPHEruFeTG6tS2VyIVnnF2gSnKZztL6f5JQOdMw6JOVz4u/bVhTw3JNkHQACCJ2Mhp1vItmRAVogWnPhj/VE/yxCRbrBv44P2xu/gwI4m8GqB29MeI5h/84IucMSH0mkPOsU0CXEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65F66C433F1; Wed, 6 Mar 2024 18:41:49 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rhwEw-00000000Y9k-2X9y; Wed, 06 Mar 2024 13:43:42 -0500 Message-ID: <20240306184342.463314544@goodmis.org> User-Agent: quilt/0.67 Date: Wed, 06 Mar 2024 13:42:45 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Linus Torvalds , Sachin Sant Subject: [for-linus][PATCH 1/3] tracing: Remove precision vsnprintf() check from print event References: <20240306184244.754263547@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" This reverts 60be76eeabb3d ("tracing: Add size check when printing trace_marker output"). The only reason the precision check was added was because of a bug that miscalculated the write size of the string into the ring buffer and it truncated it removing the terminating nul byte. On reading the trace it crashed the kernel. But this was due to the bug in the code that happened during development and should never happen in practice. If anything, the precision can hide bugs where the string in the ring buffer isn't nul terminated and it will not be checked. Link: https://lore.kernel.org/all/C7E7AF1A-D30F-4D18-B8E5-AF1EF58004F5@linu= x.ibm.com/ Link: https://lore.kernel.org/linux-trace-kernel/20240227125706.04279ac2@ga= ndalf.local.home Link: https://lore.kernel.org/all/20240302111244.3a1674be@gandalf.local.hom= e/ Link: https://lore.kernel.org/linux-trace-kernel/20240304174341.2a561d9f@ga= ndalf.local.home Cc: Masami Hiramatsu Cc: Linus Torvalds Fixes: 60be76eeabb3d ("tracing: Add size check when printing trace_marker o= utput") Reported-by: Sachin Sant Tested-by: Sachin Sant Reviewed-by: Mathieu Desnoyers Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_output.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 3e7fa44dc2b2..d8b302d01083 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -1587,12 +1587,11 @@ static enum print_line_t trace_print_print(struct t= race_iterator *iter, { struct print_entry *field; struct trace_seq *s =3D &iter->seq; - int max =3D iter->ent_size - offsetof(struct print_entry, buf); =20 trace_assign_type(field, iter->ent); =20 seq_print_ip_sym(s, field->ip, flags); - trace_seq_printf(s, ": %.*s", max, field->buf); + trace_seq_printf(s, ": %s", field->buf); =20 return trace_handle_return(s); } @@ -1601,11 +1600,10 @@ static enum print_line_t trace_print_raw(struct tra= ce_iterator *iter, int flags, struct trace_event *event) { struct print_entry *field; - int max =3D iter->ent_size - offsetof(struct print_entry, buf); =20 trace_assign_type(field, iter->ent); =20 - trace_seq_printf(&iter->seq, "# %lx %.*s", field->ip, max, field->buf); + trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf); =20 return trace_handle_return(&iter->seq); } --=20 2.43.0