lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 7 Feb 2018 16:41:16 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     Adam Borowski <kilobyte@...band.pl>,
        Kees Cook <keescook@...omium.org>,
        "Tobin C. Harding" <me@...in.cc>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Joe Perches <joe@...ches.com>,
        "Roberts, William C" <william.c.roberts@...el.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        David Laight <David.Laight@...lab.com>,
        Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH] vsprintf: avoid misleading "(null)" for %px

On Wed 2018-02-07 16:11:13, Geert Uytterhoeven wrote:
> Hi Petr,
> 
> On Wed, Feb 7, 2018 at 4:03 PM, Petr Mladek <pmladek@...e.com> wrote:
> > [*] I made some archaeology:
> >
> > The "(null)" string was added by the commit d97106ab53f812910
> > ("Make %p print '(null)' for NULL pointers").
> >
> > It was a generic solution to prevent eventual crashes, see
> > https://lkml.kernel.org/r/1230979341-23029-1-git-send-email-xyzzy@speakeasy.org
> >
> > From this point, printing 00000000 for %px looks perfectly fine because
> > it does not crash.
> >
> > In fact, it would have made perfect sense to print 00000000 for pure
> > %p because it did not crash. But nobody has cared about the eventual
> > confusion yet.
> >
> > I am not sure if it makes sense to change the pure %p handling
> > now. Note that printing "(null)" has the advantage that we
> > get this string instead of the hash ;-)
> 
> Note that "(null)" is also used for printing strings, where you do dereference
> the pointer, unlike for printing pointers.
> In addition, "(null)" for strings is not just printed for real NULL
> pointers, but
> also for anything pointing within the first page of virtual memory.

We are on the safe side. "(null)" for "%s" is handled
separately, see string() function in lib/vsprintf.c.

To make it clear. I was talking about "%p" format that is handled
in the pointer() function in lib/vsprintf.c. The "(null)" makes
sense only for the many modifiers that do deference of
the pointer, e.g. "%pa", "%pE", "%ph". It makes less sense
for the pure "%p" used without any modifier. Well, it actually
started to makes some sense after we started printing
the hash instead of the real pointer value.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ