From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Date: Fri, 10 May 2019 19:41:34 +0300 Message-ID: <20190510164134.GH9224@smile.fi.intel.com> References: <20190510081635.GA4533@jagdpanzerIV> <20190510084213.22149-1-pmladek@suse.com> <20190510122401.21a598f6@gandalf.local.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190510122401.21a598f6@gandalf.local.home> Sender: linux-kernel-owner@vger.kernel.org To: Steven Rostedt Cc: Petr Mladek , 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 , Christophe Leroy , Stephen Rothwell , Heiko Carstens , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Martin Schwidefsky List-Id: linux-arch.vger.kernel.org On Fri, May 10, 2019 at 12:24:01PM -0400, Steven Rostedt wrote: > On Fri, 10 May 2019 10:42:13 +0200 > Petr Mladek wrote: > > > static const char *check_pointer_msg(const void *ptr) > > { > > - char byte; > > - > > if (!ptr) > > return "(null)"; > > > > - if (probe_kernel_address(ptr, byte)) > > + if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr)) > > return "(efault)"; > > > > > < PAGE_SIZE ? > > do you mean: < TASK_SIZE ? Original code used PAGE_SIZE. If it needs to be changed, that it might be a separate explanation / patch. -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com ([192.55.52.136]:13840 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727496AbfEJQlk (ORCPT ); Fri, 10 May 2019 12:41:40 -0400 Date: Fri, 10 May 2019 19:41:34 +0300 From: Andy Shevchenko Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses Message-ID: <20190510164134.GH9224@smile.fi.intel.com> References: <20190510081635.GA4533@jagdpanzerIV> <20190510084213.22149-1-pmladek@suse.com> <20190510122401.21a598f6@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510122401.21a598f6@gandalf.local.home> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Steven Rostedt Cc: Petr Mladek , 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 , Christophe Leroy , Stephen Rothwell , Heiko Carstens , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Martin Schwidefsky Message-ID: <20190510164134.MOFEXv4lZ0byKuO5xFyCeqdaA9zePgipycDNWtjfBrg@z> On Fri, May 10, 2019 at 12:24:01PM -0400, Steven Rostedt wrote: > On Fri, 10 May 2019 10:42:13 +0200 > Petr Mladek wrote: > > > static const char *check_pointer_msg(const void *ptr) > > { > > - char byte; > > - > > if (!ptr) > > return "(null)"; > > > > - if (probe_kernel_address(ptr, byte)) > > + if ((unsigned long)ptr < PAGE_SIZE || IS_ERR_VALUE(ptr)) > > return "(efault)"; > > > > > < PAGE_SIZE ? > > do you mean: < TASK_SIZE ? Original code used PAGE_SIZE. If it needs to be changed, that it might be a separate explanation / patch. -- With Best Regards, Andy Shevchenko