Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4490822pxk; Wed, 30 Sep 2020 04:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+jG9ogCTvNbRmfwaj/+YClR5iBYyJvfLzrgIi5gZMUI1EvDPO4qH6767BnV+8AQ82aBQL X-Received: by 2002:a17:906:a251:: with SMTP id bi17mr2254011ejb.526.1601465522828; Wed, 30 Sep 2020 04:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601465522; cv=none; d=google.com; s=arc-20160816; b=IinoVTbADb2qfK4JRarNr3Okg4gEr1WeePeMUIzFiwWMSC4Mgm8hcvXDC37xMEHE/q KG4m8kuBC3+xow0YamZVWcUK3SA3nyoY8J3E/NT6XtxBzKIbsz1WGuiidJtFe+GAxVeo 5jMgVVDJMfZkODn7+B+6jqiDdJRYfhbpk/7/zu4Y84MLwsO9M4CMlYxyD8pbLEPbT/JY 8Z4koXUL4wQ7hQ+OJeI1ixjjShXRTYyQlUVfq6xdy+WYY7RIAXMRJWRJADxlTDkanXBI JgDxK/mt7tgYlORdKehrdDSZYNYGlLvQZqNh+rpfwljNJk0vSZXiI50n3CD1gchAJuKX xUwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=BJDgWAYhRp6it/2DpEbAViTJ8/e5BFTejOFXfq86KFU=; b=iabemO5TCC9jzJ+8cM2nsbD2ijZKlbfKuV34VczA1sZ1oubCvHQ7XMGv7BVwimbqj2 A0+kzw+OM4eU6rNVbg8lpfFulgHFmzzFkzR/yLAWxR9+wCZcVpGDbj8TtBzDbeRkf96T nleb9AEK5Pbl6JeAzjXh7zwpFQWjml1XKShL0KKydpPxGUcWC1LfqOMjkQppovJxRAQp px/TX2ciIMSMcnMSdy/L174rIeHFfp7SuIRVx0naIuWTG3ZEXuN+mBaeL+7ilgJoZjUU hWq3g7TMTMzYHpLxdn8q3S1tmK0Y6uHkVJcJF1TxIzdn9KbZhi0jK39nDS3Z8+G55zJz kZ6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=THtL5oLx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si988150ejp.429.2020.09.30.04.31.40; Wed, 30 Sep 2020 04:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=THtL5oLx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728367AbgI3L2i (ORCPT + 99 others); Wed, 30 Sep 2020 07:28:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:47802 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbgI3L2i (ORCPT ); Wed, 30 Sep 2020 07:28:38 -0400 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=1601465317; h=from:from:reply-to:subject:subject: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=BJDgWAYhRp6it/2DpEbAViTJ8/e5BFTejOFXfq86KFU=; b=THtL5oLxX+5tAvr5GMG47Or7AqFGxz5Ug9Lu943eInO8oBaSfeU1cgV1ke8CmmORaVScXf NkpPrFYfzxA8jRp2BMMj5RfRLMHV7JWOKfqPDYFMuswtRolYJtSYYqeWRQvXc9LhmqDTxX +HMYofEotjjnFXG8Ds1jTsvLnXffsZQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0245DABC1; Wed, 30 Sep 2020 11:28:37 +0000 (UTC) Date: Wed, 30 Sep 2020 13:28:36 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , Marek Szyprowski , linux-kernel@vger.kernel.org Subject: Re: [PATCH next v2 1/2] printk: avoid and/or handle record truncation Message-ID: <20200930112836.GC29288@alley> References: <20200930090134.8723-1-john.ogness@linutronix.de> <20200930090134.8723-2-john.ogness@linutronix.de> <20200930094316.GB987@jagdpanzerIV.localdomain> <87imbv1s0d.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87imbv1s0d.fsf@jogness.linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-09-30 12:30:50, John Ogness wrote: > On 2020-09-30, Sergey Senozhatsky wrote: > > On (20/09/30 11:07), John Ogness wrote: > >> bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer *rb, > >> - struct printk_record *r, u32 caller_id); > >> + struct printk_record *r, u32 caller_id, unsigned int max_size); > > > > Isn't `max_size' always LOG_LINE_MAX? > > Yes. But I still think it makes sense that it is an argument of the > function. It is quite an important setting and hard-coding it within the > ringbuffer code might lead to hidden problems later. I personally prefer the argument as well. It is true that printk_ringbuffer is not a fully generic ringbuffer. It has very special behavior so that it can be hardly be used anywhere else. Sometimes it is not clear what printk() requirements should be passed via the API or hardcoded into the ring buffer code. IMHO, it depends on the code complexity. Anyway, I see hardcoded limit more like a hack. It limits something somewhere so that some other code somewhere else is safe to use. And printk.c is really bad from this point. It sometimes does not check for overflow because it "knows" that the buffers are big enough. But it is error prone code, especially when there are more limits defined (pure text, prefix, extended prefix). And it will be worse if we allow to add more optional information into the prefix. Best Regards, Petr