From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43503C4727C for ; Thu, 1 Oct 2020 07:39:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13D5021531 for ; Thu, 1 Oct 2020 07:39:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731353AbgJAHjf (ORCPT ); Thu, 1 Oct 2020 03:39:35 -0400 Received: from smtprelay0132.hostedemail.com ([216.40.44.132]:46424 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731131AbgJAHjf (ORCPT ); Thu, 1 Oct 2020 03:39:35 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 67409180A68AD; Thu, 1 Oct 2020 07:39:34 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: boats10_320b5cc27199 X-Filterd-Recvd-Size: 3019 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Thu, 1 Oct 2020 07:39:32 +0000 (UTC) Message-ID: <873100a17ac1a9fc1c435ff7957b63d2540ce7fc.camel@perches.com> Subject: Re: [PATCH next v2 1/2] printk: avoid and/or handle record truncation From: Joe Perches To: Petr Mladek Cc: John Ogness , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , Marek Szyprowski , linux-kernel@vger.kernel.org Date: Thu, 01 Oct 2020 00:39:31 -0700 In-Reply-To: <20201001072659.GB17717@alley> References: <20200930090134.8723-1-john.ogness@linutronix.de> <20200930090134.8723-2-john.ogness@linutronix.de> <20201001072659.GB17717@alley> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-10-01 at 09:26 +0200, Petr Mladek wrote: > On Wed 2020-09-30 08:25:24, Joe Perches wrote: > > On Wed, 2020-09-30 at 11:07 +0206, John Ogness wrote: > > > If a reader provides a buffer that is smaller than the message text, > > > the @text_len field of @info will have a value larger than the buffer > > > size. If readers blindly read @text_len bytes of data without > > > checking the size, they will read beyond their buffer. > > > > > > Add this check to record_print_text() to properly recognize when such > > > truncation has occurred. > > > > > > Add a maximum size argument to the ringbuffer function to extend > > > records so that records can not be created that are larger than the > > > buffer size of readers. > > > > > > When extending records (LOG_CONT), do not extend records beyond > > > LOG_LINE_MAX since that is the maximum size available in the buffers > > > used by consoles and syslog. > > > > I still think it better to support backspace by rewinding > > the buffer rather than truncation of the output. > > IMHO, backspace support is not worth the complexity. It might do > some fancy animation on console but it does not bring any advantage > in static logs (dmesg, journalctl). > > It is possible that it worked in the past when the log buffer was > just an array of characters that were pushed to the console when > they appeared. > > But I am pretty sure that it has stopped working many years agl > variable-length record buffer"). It's more that spinner or timer dots could fill the buffer and any message after the spinner/dots like success or failure is lost via truncation. There aren't many spinners/dots, perhaps it's better to find and delete them.