[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190513122424.ynaox4v77uhgmvn6@pathway.suse.cz>
Date: Mon, 13 May 2019 14:24:24 +0200
From: Petr Mladek <pmladek@...e.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
"Tobin C . Harding" <me@...in.cc>, Michal Hocko <mhocko@...e.cz>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
linuxppc-dev@...ts.ozlabs.org, Russell Currey <ruscur@...sell.cc>,
Christophe Leroy <christophe.leroy@....fr>,
Stephen Rothwell <sfr@...abs.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-arch@...r.kernel.org, linux-s390@...r.kernel.org
Subject: Re: [PATCH] vsprintf: Do not break early boot with probing addresses
On Fri 2019-05-10 12:40:58, Steven Rostedt wrote:
> On Fri, 10 May 2019 18:32:58 +0200
> Martin Schwidefsky <schwidefsky@...ibm.com> wrote:
>
> > On Fri, 10 May 2019 12:24:01 -0400
> > Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > > On Fri, 10 May 2019 10:42:13 +0200
> > > Petr Mladek <pmladek@...e.com> 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 ?
> >
> > The check with < TASK_SIZE would break on s390. The 'ptr' is
> > in the kernel address space, *not* in the user address space.
> > Remember s390 has two separate address spaces for kernel/user
> > the check < TASK_SIZE only makes sense with a __user pointer.
> >
>
> So we allow this to read user addresses? Can't that cause a fault?
I did some quick check and did not found anywhere a user pointer
being dereferenced via vsprintf().
In each case, %s did the check (ptr < PAGE_SIZE) even before this
patchset. The other checks are in %p format modifiers that are
used to print various kernel structures.
Finally, it accesses the pointer directly. I am not completely sure
but I think that it would not work that easily with an address
from the user address space.
Best Regards,
Petr
Powered by blists - more mailing lists