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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 CFB19C433DB for ; Thu, 18 Feb 2021 18:40:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DC9664EB3 for ; Thu, 18 Feb 2021 18:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230412AbhBRSkR (ORCPT ); Thu, 18 Feb 2021 13:40:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:43474 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbhBRQP6 (ORCPT ); Thu, 18 Feb 2021 11:15:58 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613664911; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J0NKBCRFWn5alqpNkuoDBrrfu6DDjmvlrvYuUcGThG4=; b=JXhHq6gmFS1ebPfmy76358du2DqVPMm7OCVZ11qEdRbraNWTCckn1ZXpBAr2/3TCQpVKpz sDmKRnnNXhoq6YSqQtdLxM/6f+c46TTXgF9L44Z96t7mZH5aOJ18BfWRpR4fWm1vUP3pE6 zXTpaqtiLvVSSw5xihmh6M7L4Wo9vs8= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 837BEACD4; Thu, 18 Feb 2021 16:15:11 +0000 (UTC) Date: Thu, 18 Feb 2021 17:15:10 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk-rework 01/14] printk: limit second loop of syslog_print_all Message-ID: References: <20210218081817.28849-1-john.ogness@linutronix.de> <20210218081817.28849-2-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210218081817.28849-2-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-02-18 09:18:04, John Ogness wrote: > The second loop of syslog_print_all() subtracts lengths that were > added in the first loop. With commit b031a684bfd0 ("printk: remove > logbuf_lock writer-protection of ringbuffer") it is possible that > records are (over)written during syslog_print_all(). This allows the > possibility of the second loop subtracting lengths that were never > added in the first loop. > > This situation can result in syslog_print_all() filling the buffer > starting from a later record, even though there may have been room > to fit the earlier record(s) as well. > > Fixes: b031a684bfd0 ("printk: remove logbuf_lock writer-protection of ringbuffer") > Signed-off-by: John Ogness It makes sense after all. We reach the limit only when many old messages has got replaced. It means that there is a flood of messages. And this limit looks like a reasonable point where to start filling the provided buffer. Reviewed-by: Petr Mladek Best Regards, Petr