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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWtZMvBwMGtC=eR57W5C3u=pna8O=0UCxeAknP0q8Brbg@mail.gmail.com>
Date:   Wed, 7 Feb 2018 16:48:11 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Petr Mladek <pmladek@...e.com>
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

Hi Petr,

On Wed, Feb 7, 2018 at 4:41 PM, Petr Mladek <pmladek@...e.com> wrote:
> On Wed 2018-02-07 16:11:13, Geert Uytterhoeven wrote:
>> 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.

I know.

> 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.

Sure. I agree with all of that.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ