[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOi1vP_Ned9QG32+o9KT-Bh3qMTb6h0SaP8W74Am_gkVX3mcSQ@mail.gmail.com>
Date: Tue, 18 Feb 2020 21:19:06 +0100
From: Ilya Dryomov <idryomov@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Adam Borowski <kilobyte@...band.pl>,
Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>,
Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Randy Dunlap <rdunlap@...radead.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
"Tobin C . Harding" <me@...in.cc>
Subject: Re: [PATCH] vsprintf: don't obfuscate NULL and error pointers
On Tue, Feb 18, 2020 at 8:39 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Tue, Feb 18, 2020 at 11:31 AM Adam Borowski <kilobyte@...band.pl> wrote:
> >
> > Either "0" or "NULL" (or "∅" if you allow cp437-subset Unicode ) wouldn't
> > cause such confusion.
>
> An all-uppercase "NULL" probably matches the error code printout
> syntax better too, and is more clearly a pointer.
>
> And with %pe you can't assume columnar output anyway (unless you
> explicitly ask for some width), so the length of the output cannot
> matter.
>
> So yeah, I agree. To extend on Ilya's example:
>
> ptr error-ptr NULL
> %p: 0000000001f8cc5b fffffffffffffff2 0000000000000000
> %pK, kptr = 0: 0000000001f8cc5b fffffffffffffff2 0000000000000000
> %px: ffff888048c04020 fffffffffffffff2 0000000000000000
> %pK, kptr = 1: ffff888048c04020 fffffffffffffff2 0000000000000000
> %pK, kptr = 2: 0000000000000000 0000000000000000 0000000000000000
> %p: 0000000001f8cc5b -EFAULT NULL
^^^
I assume you meant %pe here.
>
> would seem to be a sane output format. Hmm?
Looks sensible to me. Without this patch NULL is obfuscated for
both %p and %pe though. Do you want this patch amended or prefer
a follow-up for %pe "0000000000000000" -> "NULL" so that it can be
discussed separately?
Thanks,
Ilya
Powered by blists - more mailing lists