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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 EF809C4727D for ; Sat, 26 Sep 2020 03:33:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC24920838 for ; Sat, 26 Sep 2020 03:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729979AbgIZD2F (ORCPT ); Fri, 25 Sep 2020 23:28:05 -0400 Received: from smtprelay0238.hostedemail.com ([216.40.44.238]:46534 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729134AbgIZD2F (ORCPT ); Fri, 25 Sep 2020 23:28:05 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 1B17C1822326F; Sat, 26 Sep 2020 03:28:04 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: comb22_38090052716d X-Filterd-Recvd-Size: 2302 Received: from XPS-9350 (cpe-23-242-83-182.socal.res.rr.com [23.242.83.182]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Sat, 26 Sep 2020 03:28:02 +0000 (UTC) Message-ID: <16c9a13fb945065cd1fc9f0b9ece1862e42867e0.camel@perches.com> Subject: Re: [PATCH next 0/2] printk: fix reading beyond buffer From: Joe Perches To: John Ogness , Petr Mladek Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , Marek Szyprowski , linux-kernel@vger.kernel.org Date: Fri, 25 Sep 2020 20:28:00 -0700 In-Reply-To: <20200926015526.8921-1-john.ogness@linutronix.de> References: <20200926015526.8921-1-john.ogness@linutronix.de> 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 Sat, 2020-09-26 at 04:01 +0206, John Ogness wrote: > Hello, > > Marek Szyprowski reported [0] a problem with a particular printk > usage. This particular usage performs thousands of LOG_CONT calls. > The printk.c implementation was only limiting the growing record by > the maximum size available in the ringbuffer, thus creating a record > that was several kilobytes in size. This in and of itself is not > a problem. Perhaps another mechanism would be to change the code to add a backspace before the rotor and have the printk ringbuffer actually backspace on \h when position > 0 Something like: --- diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index ac021ae6e6fa..8a36443b4866 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -257,7 +258,7 @@ int __init rd_load_image(char *from) kernel_write(out_file, buf, BLOCK_SIZE, &out_pos); #if !defined(CONFIG_S390) if (!(i % 16)) { - pr_cont("%c\b", rotator[rotate & 0x3]); + pr_cont("\h%c\b", rotator[rotate & 0x3]); rotate++; } #endif