Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp604215imm; Wed, 26 Sep 2018 04:05:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61e2+bSgFz8KFp36RpvMVBKd3dD+Pss8e7TL+cWSYBxJ7WW3yebynD6OtyoM5AF4eGvnaHZ X-Received: by 2002:a17:902:2:: with SMTP id 2-v6mr5763732pla.178.1537959944719; Wed, 26 Sep 2018 04:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537959944; cv=none; d=google.com; s=arc-20160816; b=bXmKRiHC3zqhmIxL/Phr2Gv+huniPbLzUVKvm9aBLtaA4qRRUtevu3WTTt8A1YRVc6 TxF2bGXBAeRub9/e+isxzaWstKVuN4waL7PaphC++7YVvT2Bz9CywjoWcd2stRVBbR9Y hgvXu9+VCHOchK+fKX2kf1lycVAPI7570dfucHD2MlbXRvqU4HwxqkYhBKEcyfLrMI2d jUG3Jiy9ZiwegdjbkXIp+ddWr5+v9C4/x+GInBvj+KMVFRdQTLKrhrQ6jzEFKF7Amom2 PojgAEV7qqnwbJNFOr6Df637VVIRQ5JZ8if61P8cD4TDfNC2k4pehdnCvhxzlij90s2Q rhmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=hsf7S5+kyUZEZqjWM7cExcUS2Rofs8ajKL0EJj9ETI4=; b=SX0BvUZt7qIr9IBtpMFNuuFu3JKNvSXt8ZdYVQWqNsJ33Ewc0m5fOWJ1j76sZonLqT c4mVk8fK65KDEigXo7IXaAX/qtzG/rzU2g9QW4TDMjfLYqeeaosOtADQkZKHUqTS8h/v OjO4+CWIffIUy16cY5vShMGmJsvh1ugzcHjpE8iXQkmw/a9Uk/eVxkHeg8GY4zhECE45 Qh5O7SjaukYiIAkvthnJVHWfCrauGDptbjENMcWml8W4U9w91TCoXKHyVmD/H/xqoc3B v0e245bZ93/I0Ae4mBCwQm+It8atgN8qvUH3h6XMLBubjeoLYBmUk/AcJc3wrNPlXGGX 2Q8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u37-v6si4234741pgl.78.2018.09.26.04.05.28; Wed, 26 Sep 2018 04:05:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727366AbeIZRR3 (ORCPT + 99 others); Wed, 26 Sep 2018 13:17:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:45898 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726315AbeIZRR2 (ORCPT ); Wed, 26 Sep 2018 13:17:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4408BACAE; Wed, 26 Sep 2018 11:05:02 +0000 (UTC) Date: Wed, 26 Sep 2018 13:05:00 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , He Zhe , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] printk: Fix panic caused by passing log_buf_len to command line Message-ID: <20180926110500.vfroi373mookavua@pathway.suse.cz> References: <20180919015030.GA423@jagdpanzerIV> <6c354803-5341-7237-9ee3-7882252c7483@windriver.com> <20180919023932.GA14090@jagdpanzerIV> <20180918224312.6e9aef50@vmware.local.home> <1545bc85-b64a-4b45-d40f-79567ac621dc@windriver.com> <20180920123056.27b2cf18@gandalf.local.home> <20180921073753.mqayzofcofpmhiyu@pathway.suse.cz> <20180925120135.GB523@tigerII.localdomain> <20180925122300.qq5w4skwmxbzi6sy@pathway.suse.cz> <20180925133143.GB601@tigerII.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925133143.GB601@tigerII.localdomain> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2018-09-25 22:31:43, Sergey Senozhatsky wrote: > On (09/25/18 14:23), Petr Mladek wrote: > > The 32GB was mentioned as an example one year ego. This is not enough > > for a new syscall from my point of view. > > I agree. I didn't think of syslog(); was merely thinking about logbuf > and flushing it to the consoles. syslog() stuff is a bit complex. We > sort of don't expect user space to allocate 64G to read all log_buf > messages, do we. > > I'm wondering if we can do something like this > > --- > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index cf275f4d7912..1b48b61da8fe 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1110,9 +1110,15 @@ static void __init log_buf_len_update(unsigned size) > /* save requested log_buf_len since it's too early to process it */ > static int __init log_buf_len_setup(char *str) > { > - unsigned size = memparse(str, &str); > + u64 size = memparse(str, &str); > > - log_buf_len_update(size); > + if (size > UINT_MAX) { > + size = UINT_MAX; > + pr_err("log_buf over 4G is not supported. " > + "Please contact printk maintainers.\n"); > + } > + > + log_buf_len_update((unsigned int)size); > > return 0; > } > > --- > > So we could know that "the day has come". Sounds good to me. Just two nits. First, I would move the check into log_buf_len_update() so that we catch the overflow also in other situations. Second, please, keep only the first line. It is enough to describe the problem. Upstream kernel maintainers are not responsible for implementing all missing features. Best Regards, Petr