Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5280142yba; Mon, 13 May 2019 08:17:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx0RtdQCJQRaGhs58x5AL6mMOyfgcJtg1DiJcyAEaP2SX5mC0qTToTfMwwQO8dYsaFBmhT X-Received: by 2002:aa7:9159:: with SMTP id 25mr2444302pfi.64.1557760628139; Mon, 13 May 2019 08:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557760628; cv=none; d=google.com; s=arc-20160816; b=nXFXRjdXXVkXkBo8S6qrpRRp2uEDpmaKXdiJ5+ViYxdd7GghQCXaExBkhWDiKSALmX yR1CHaAusqPr2dRFEwFF21dlXSrJq8TGJno/TpiUz+8xL5n0lxnTOEnY0YXAH9DzcAb8 QsvkBoAhR27Dq3W/N6nm3IySzkjPW5ZKuzpiWBv5dn07RG1xbhB89XruGcHf7Ul1NXL8 9VcU8MV1W1r5ptZm2PLKlmEVef9aX0lz2pxott80KO7B4LFcE+7tIDlc4UIee/IA95Qz aXc5OmZQvZGY9RRTQ7tyYWTS/EJ1mwmjiHV1IfQeRnTdG8rUw4wzXWjMLA0Na+ywZgsf /GIg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=AhUpY2H3dEgtThBx8aoPNhiu6wpbgFY8PoeBa1h8JHE=; b=0bJ+quDctXil46HAbNG567D8TNpCe98mhQmm4K+GS4nbVW7rWh9C9AiUawJv6vs7SN tDn2LizoVXRlFt47uKJedSuUoj7eT3qcMcVmnw0DgKt3dxkYHagLVnb9GO7AzU5xqu7D bl4D6TJsy8AuRgD1W3i2TwfP7QTYqVMyx6kLEQAeFVH+BsYPC3zDPKqZwU8tAVtTHHjh HB3vq1aHmB+fUKtOMbF16qXhxEpo/1uirzH9xArTMZVSqt4UPRAy7N9s4RySD76bcT5b 5h5RiH1SIYTVJdO9pK3XhYkhMjmBA94h0YriOEViSq1a13+qIhf+FJygTU7iJs9EqluL yUXQ== 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 q8si17191819pfa.124.2019.05.13.08.16.51; Mon, 13 May 2019 08:17:08 -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 S1729024AbfEMMmX (ORCPT + 99 others); Mon, 13 May 2019 08:42:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:36514 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728015AbfEMMmX (ORCPT ); Mon, 13 May 2019 08:42:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B3F83AF79; Mon, 13 May 2019 12:42:21 +0000 (UTC) Date: Mon, 13 May 2019 14:42:20 +0200 From: Petr Mladek To: Andy Shevchenko Cc: David Laight , 'christophe leroy' , Steven Rostedt , Linus Torvalds , Rasmus Villemoes , "Tobin C . Harding" , Michal Hocko , Sergey Senozhatsky , Sergey Senozhatsky , "linux-kernel@vger.kernel.org" , Michael Ellerman , "linuxppc-dev@lists.ozlabs.org" , Russell Currey , Stephen Rothwell , Heiko Carstens , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , Martin Schwidefsky Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Message-ID: <20190513124220.wty2qbnz4wo52h3x@pathway.suse.cz> References: <20190510081635.GA4533@jagdpanzerIV> <20190510084213.22149-1-pmladek@suse.com> <20190510122401.21a598f6@gandalf.local.home> <096d6c9c17b3484484d9d9d3f3aa3a7c@AcuMS.aculab.com> <20190513091320.GK9224@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190513091320.GK9224@smile.fi.intel.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-05-13 12:13:20, Andy Shevchenko wrote: > On Mon, May 13, 2019 at 08:52:41AM +0000, David Laight wrote: > > From: christophe leroy > > > Sent: 10 May 2019 18:35 > > > Le 10/05/2019 ? 18:24, Steven Rostedt a ?crit?: > > > > On Fri, 10 May 2019 10:42:13 +0200 > > > > Petr Mladek wrote: > > > > >> - if (probe_kernel_address(ptr, byte)) > > > >> + if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr)) > > > >> return "(efault)"; > > > > "efault" looks a bit like a spellling mistake for "default". > > It's a special, thus it's in parenthesis, though somebody can be > misguided. > > > > Usually, < PAGE_SIZE means NULL pointer dereference (via the member of a > > > struct) > > > > Maybe the caller should pass in a short buffer so that you can return > > "(err-%d)" > > or "(null+%#x)" ? There are many vsprintf() users. I am afraid that nobody would want to define extra buffers for error messages. It must fit into the one for the formatted string. > In both cases it should be limited to the size of pointer (8 or 16 > characters). Something like "(e:%4d)" would work for error codes. I am afraid that we could get 10 different proposals from a huge enough group of people. I wanted to start with something simple (source code). I know that (efault) might be confused with "default" but it is still just one string to grep. > The "(null)" is good enough by itself and already an established > practice.. (efault) made more sense with the probe_kernel_read() that checked wide range of addresses. Well, I still think that it makes sense to distinguish a pure NULL. And it still used also for IS_ERR_VALUE(). Best Regards, Petr