All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: David Laight <David.Laight@aculab.com>
Cc: David Miller <davem@davemloft.net>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"me@tobin.cc" <me@tobin.cc>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"Jason@zx2c4.com" <Jason@zx2c4.com>,
	"tytso@mit.edu" <tytso@mit.edu>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"tycho@tycho.ws" <tycho@tycho.ws>,
	"william.c.roberts@intel.com" <william.c.roberts@intel.com>,
	"tj@kernel.org" <tj@kernel.org>,
	"Golden_Miller83@protonmail.ch" <Golden_Miller83@protonmail.ch>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"joe@perches.com" <joe@perches.com>,
	"ijc@hellion.org.uk" <ijc@hellion.org.uk>,
	"sergey.senozhatsky@gmail.com" <sergey.senozhatsky@gmail.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"wilal.deacon@arm.com" <wilal.deacon@arm.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"cfries@google.com" <cfries@google.com>,
	"olorin@google.com" <olorin@google.com>,
	"danielmicay@gmail.com" <danielmicay@gmail.com>,
	"tixxdz@gmail.com" <tixxdz@gmail.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"aryabinin@virtuozzo.com" <aryabinin@virtuozzo.com>,
	"glider@google.com" <glider@google.com>,
	"dvyukov@google.com" <dvyukov@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"sergei.shtylyov@cogentembedded.com" 
	<sergei.shtylyov@cogentembedded.com>
Subject: Re: [PATCH V11 3/5] printk: hash addresses printed with %p
Date: Wed, 6 Dec 2017 15:21:58 -0800	[thread overview]
Message-ID: <CAGXu5jLYQypb=-kf9swRy8F4tSFx_R-urE2tREavOMF-OaXD8g@mail.gmail.com> (raw)
In-Reply-To: <e8dd4332196348df8938a1ad8991dc84@AcuMS.aculab.com>

On Wed, Dec 6, 2017 at 2:31 AM, David Laight <David.Laight@aculab.com> wrote:
> From: David Miller
>> Sent: 05 December 2017 20:31
> ...
>> > Would it make sense to keep the 3 lowest bits of the address?
>> >
>> > Currently printed pointers no longer have any correlation with the actual
>> > alignment in memory of the object, which is a typical cause of a class of bugs.
>>
>> Yeah, this is driving people nuts who wonder why pointers are aligned
>> all weird now.
>
> I can also image issues where you want to know whether 2 pointers point
> into the same structure (like an skb).

This is already retained due to the hashing. i.e. the same pointer
value will produce the same hash value, so that kind of direct
comparison still works.

> Useful if you suspect that code is using a stale pointer because the
> skb got reallocated by some internal function.
> I'm not sure such pointers are printed by default though.

I hope not. :) skb used to be exported for INET_DIAG, but that got
fixed a while back.

-Kees

-- 
Kees Cook
Pixel Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: David Laight <David.Laight@aculab.com>
Cc: David Miller <davem@davemloft.net>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"me@tobin.cc" <me@tobin.cc>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"Jason@zx2c4.com" <Jason@zx2c4.com>,
	"tytso@mit.edu" <tytso@mit.edu>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"tycho@tycho.ws" <tycho@tycho.ws>,
	"william.c.roberts@intel.com" <william.c.roberts@intel.com>,
	"tj@kernel.org" <tj@kernel.org>,
	"Golden_Miller83@protonmail.ch" <Golden_Miller83@protonmail.ch>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"joe@perches.com" <joe@perches.com>,
	"ijc@hellion.org.uk" <ijc@hellion.org.uk>,
	"sergey.senozhatsk
Subject: Re: [PATCH V11 3/5] printk: hash addresses printed with %p
Date: Wed, 6 Dec 2017 15:21:58 -0800	[thread overview]
Message-ID: <CAGXu5jLYQypb=-kf9swRy8F4tSFx_R-urE2tREavOMF-OaXD8g@mail.gmail.com> (raw)
In-Reply-To: <e8dd4332196348df8938a1ad8991dc84@AcuMS.aculab.com>

On Wed, Dec 6, 2017 at 2:31 AM, David Laight <David.Laight@aculab.com> wrote:
> From: David Miller
>> Sent: 05 December 2017 20:31
> ...
>> > Would it make sense to keep the 3 lowest bits of the address?
>> >
>> > Currently printed pointers no longer have any correlation with the actual
>> > alignment in memory of the object, which is a typical cause of a class of bugs.
>>
>> Yeah, this is driving people nuts who wonder why pointers are aligned
>> all weird now.
>
> I can also image issues where you want to know whether 2 pointers point
> into the same structure (like an skb).

This is already retained due to the hashing. i.e. the same pointer
value will produce the same hash value, so that kind of direct
comparison still works.

> Useful if you suspect that code is using a stale pointer because the
> skb got reallocated by some internal function.
> I'm not sure such pointers are printed by default though.

I hope not. :) skb used to be exported for INET_DIAG, but that got
fixed a while back.

-Kees

-- 
Kees Cook
Pixel Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: David Laight <David.Laight@aculab.com>
Cc: David Miller <davem@davemloft.net>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"me@tobin.cc" <me@tobin.cc>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"Jason@zx2c4.com" <Jason@zx2c4.com>,
	"tytso@mit.edu" <tytso@mit.edu>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"tycho@tycho.ws" <tycho@tycho.ws>,
	"william.c.roberts@intel.com" <william.c.roberts@intel.com>,
	"tj@kernel.org" <tj@kernel.org>,
	"Golden_Miller83@protonmail.ch" <Golden_Miller83@protonmail.ch>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"pmladek@suse.com" <pmladek@suse.com>,
	"joe@perches.com" <joe@perches.com>,
	"ijc@hellion.org.uk" <ijc@hellion.org.uk>,
	"sergey.senozhatsky@gmail.com" <sergey.senozhatsky@gmail.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"wilal.deacon@arm.com" <wilal.deacon@arm.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"cfries@google.com" <cfries@google.com>,
	"olorin@google.com" <olorin@google.com>,
	"danielmicay@gmail.com" <danielmicay@gmail.com>,
	"tixxdz@gmail.com" <tixxdz@gmail.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"aryabinin@virtuozzo.com" <aryabinin@virtuozzo.com>,
	"glider@google.com" <glider@google.com>,
	"dvyukov@google.com" <dvyukov@google.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"sergei.shtylyov@cogentembedded.com"
	<sergei.shtylyov@cogentembedded.com>
Subject: [kernel-hardening] Re: [PATCH V11 3/5] printk: hash addresses printed with %p
Date: Wed, 6 Dec 2017 15:21:58 -0800	[thread overview]
Message-ID: <CAGXu5jLYQypb=-kf9swRy8F4tSFx_R-urE2tREavOMF-OaXD8g@mail.gmail.com> (raw)
In-Reply-To: <e8dd4332196348df8938a1ad8991dc84@AcuMS.aculab.com>

On Wed, Dec 6, 2017 at 2:31 AM, David Laight <David.Laight@aculab.com> wrote:
> From: David Miller
>> Sent: 05 December 2017 20:31
> ...
>> > Would it make sense to keep the 3 lowest bits of the address?
>> >
>> > Currently printed pointers no longer have any correlation with the actual
>> > alignment in memory of the object, which is a typical cause of a class of bugs.
>>
>> Yeah, this is driving people nuts who wonder why pointers are aligned
>> all weird now.
>
> I can also image issues where you want to know whether 2 pointers point
> into the same structure (like an skb).

This is already retained due to the hashing. i.e. the same pointer
value will produce the same hash value, so that kind of direct
comparison still works.

> Useful if you suspect that code is using a stale pointer because the
> skb got reallocated by some internal function.
> I'm not sure such pointers are printed by default though.

I hope not. :) skb used to be exported for INET_DIAG, but that got
fixed a while back.

-Kees

-- 
Kees Cook
Pixel Security

  reply	other threads:[~2017-12-06 23:22 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29  2:05 [PATCH V11 0/5] hash addresses printed with %p Tobin C. Harding
2017-11-29  2:05 ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05 ` Tobin C. Harding
2017-11-29  2:05 ` [PATCH V11 1/5] docs: correct documentation for %pK Tobin C. Harding
2017-11-29  2:05   ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05   ` Tobin C. Harding
2017-11-29  2:05 ` [PATCH V11 2/5] vsprintf: refactor %pK code out of pointer() Tobin C. Harding
2017-11-29  2:05   ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05   ` Tobin C. Harding
2017-11-29  2:39   ` Steven Rostedt
2017-11-29  2:39     ` [kernel-hardening] " Steven Rostedt
2017-11-29  2:39     ` Steven Rostedt
2017-11-29  4:27     ` Tobin C. Harding
2017-11-29  4:27       ` [kernel-hardening] " Tobin C. Harding
2017-11-29  4:27       ` Tobin C. Harding
2017-11-29 11:54       ` Steven Rostedt
2017-11-29 11:54         ` [kernel-hardening] " Steven Rostedt
2017-11-29 11:54         ` Steven Rostedt
2017-11-29  2:05 ` [PATCH V11 3/5] printk: hash addresses printed with %p Tobin C. Harding
2017-11-29  2:05   ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05   ` Tobin C. Harding
2017-11-29 23:21   ` Andrew Morton
2017-11-29 23:21     ` [kernel-hardening] " Andrew Morton
2017-11-29 23:21     ` Andrew Morton
2017-12-05 20:20   ` Geert Uytterhoeven
2017-12-05 20:20     ` [kernel-hardening] " Geert Uytterhoeven
2017-12-05 20:20     ` Geert Uytterhoeven
2017-12-05 20:31     ` David Miller
2017-12-05 20:31       ` [kernel-hardening] " David Miller
2017-12-06 10:31       ` David Laight
2017-12-06 10:31         ` [kernel-hardening] " David Laight
2017-12-06 10:31         ` David Laight
2017-12-06 23:21         ` Kees Cook [this message]
2017-12-06 23:21           ` [kernel-hardening] " Kees Cook
2017-12-06 23:21           ` Kees Cook
2017-12-06 23:28           ` Linus Torvalds
2017-12-06 23:28             ` [kernel-hardening] " Linus Torvalds
2017-12-06 23:28             ` Linus Torvalds
2017-12-05 20:44     ` Tobin C. Harding
2017-12-05 20:44       ` [kernel-hardening] " Tobin C. Harding
2017-12-05 20:44       ` Tobin C. Harding
2017-12-05 22:57       ` Geert Uytterhoeven
2017-12-05 22:57         ` [kernel-hardening] " Geert Uytterhoeven
2017-12-05 22:57         ` Geert Uytterhoeven
2017-12-05 23:33         ` Linus Torvalds
2017-12-05 23:33           ` [kernel-hardening] " Linus Torvalds
2017-12-05 23:33           ` Linus Torvalds
2017-12-06  8:48           ` Geert Uytterhoeven
2017-12-06  8:48             ` [kernel-hardening] " Geert Uytterhoeven
2017-12-06  8:48             ` Geert Uytterhoeven
2017-11-29  2:05 ` [PATCH V11 4/5] vsprintf: add printk specifier %px Tobin C. Harding
2017-11-29  2:05   ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05   ` Tobin C. Harding
2017-11-29  2:29   ` Linus Torvalds
2017-11-29  2:29     ` [kernel-hardening] " Linus Torvalds
2017-11-29  2:29     ` Linus Torvalds
2017-11-29  4:29     ` Tobin C. Harding
2017-11-29  4:29       ` [kernel-hardening] " Tobin C. Harding
2017-11-29  4:29       ` Tobin C. Harding
2017-11-29 10:07     ` David Laight
2017-11-29 10:07       ` [kernel-hardening] " David Laight
2017-11-29 10:07       ` David Laight
2017-11-29 22:28       ` Kees Cook
2017-11-29 22:28         ` [kernel-hardening] " Kees Cook
2017-11-29 22:28         ` Kees Cook
2017-11-29 22:36         ` Roberts, William C
2017-11-29 22:36           ` [kernel-hardening] " Roberts, William C
2017-11-29 22:36           ` Roberts, William C
2017-11-29 22:47         ` Linus Torvalds
2017-11-29 22:47           ` [kernel-hardening] " Linus Torvalds
2017-11-29 22:47           ` Linus Torvalds
2017-11-30 10:38         ` David Laight
2017-11-30 10:38           ` [kernel-hardening] " David Laight
2017-11-30 10:38           ` David Laight
2017-12-05 21:08           ` Randy Dunlap
2017-12-05 21:08             ` [kernel-hardening] " Randy Dunlap
2017-12-05 21:08             ` Randy Dunlap
2017-12-05 21:22             ` Linus Torvalds
2017-12-05 21:22               ` [kernel-hardening] " Linus Torvalds
2017-12-05 21:22               ` Linus Torvalds
2017-12-06  1:36               ` Sergey Senozhatsky
2017-12-06  1:36                 ` [kernel-hardening] " Sergey Senozhatsky
2017-12-06  1:36                 ` Sergey Senozhatsky
2017-12-06  1:59                 ` Linus Torvalds
2017-12-06  1:59                   ` [kernel-hardening] " Linus Torvalds
2017-12-06  1:59                   ` Linus Torvalds
2017-12-06  2:15                   ` Sergey Senozhatsky
2017-12-06  2:15                     ` [kernel-hardening] " Sergey Senozhatsky
2017-12-06  2:15                     ` Sergey Senozhatsky
2017-12-06  8:32                   ` Geert Uytterhoeven
2017-12-06  8:32                     ` [kernel-hardening] " Geert Uytterhoeven
2017-12-06  8:32                     ` Geert Uytterhoeven
2017-12-06  8:45                     ` Sergey Senozhatsky
2017-12-06  8:45                       ` [kernel-hardening] " Sergey Senozhatsky
2017-12-06  8:45                       ` Sergey Senozhatsky
2017-12-07  5:17                       ` Tobin C. Harding
2017-12-07  5:17                         ` [kernel-hardening] " Tobin C. Harding
2017-12-07  5:17                         ` Tobin C. Harding
2017-12-07  5:29                         ` Linus Torvalds
2017-12-07  5:29                           ` [kernel-hardening] " Linus Torvalds
2017-12-07  5:37                         ` Sergey Senozhatsky
2017-12-07  5:37                           ` [kernel-hardening] " Sergey Senozhatsky
2017-12-07  5:37                           ` Sergey Senozhatsky
2017-12-07  5:12                     ` Tobin C. Harding
2017-12-07  5:12                       ` [kernel-hardening] " Tobin C. Harding
2017-12-07  5:12                       ` Tobin C. Harding
2017-11-29 23:20   ` Andrew Morton
2017-11-29 23:20     ` [kernel-hardening] " Andrew Morton
2017-11-29 23:20     ` Andrew Morton
2017-11-29 23:26     ` Tobin C. Harding
2017-11-29 23:26       ` [kernel-hardening] " Tobin C. Harding
2017-11-29 23:26       ` Tobin C. Harding
2017-11-30  3:58       ` Joe Perches
2017-11-30  3:58         ` [kernel-hardening] " Joe Perches
2017-11-30  3:58         ` Joe Perches
2017-11-30  4:18         ` Tobin C. Harding
2017-11-30  4:18           ` [kernel-hardening] " Tobin C. Harding
2017-11-30  4:18           ` Tobin C. Harding
2017-11-30  4:41           ` Joe Perches
2017-11-30  4:41             ` [kernel-hardening] " Joe Perches
2017-11-30  4:41             ` Joe Perches
2017-11-30  5:00             ` Tobin C. Harding
2017-11-30  5:00               ` [kernel-hardening] " Tobin C. Harding
2017-11-30  5:00               ` Tobin C. Harding
2017-11-29  2:05 ` [PATCH V11 5/5] kasan: use %px to print addresses instead of %p Tobin C. Harding
2017-11-29  2:05   ` [kernel-hardening] " Tobin C. Harding
2017-11-29  2:05   ` Tobin C. Harding
2017-11-29 23:20 ` [PATCH V11 0/5] hash addresses printed with %p Andrew Morton
2017-11-29 23:20   ` [kernel-hardening] " Andrew Morton
2017-11-29 23:20   ` Andrew Morton
2017-11-29 23:34   ` Tobin C. Harding
2017-11-29 23:34     ` [kernel-hardening] " Tobin C. Harding
2017-11-29 23:34     ` Tobin C. Harding
2017-11-30 10:23   ` David Laight
2017-11-30 10:23     ` [kernel-hardening] " David Laight
2017-11-30 10:23     ` David Laight
2017-11-30 10:26     ` Sergey Senozhatsky
2017-11-30 10:26       ` [kernel-hardening] " Sergey Senozhatsky
2017-11-30 10:26       ` Sergey Senozhatsky
2017-12-01  6:15       ` Sergey Senozhatsky
2017-12-01  6:15         ` [kernel-hardening] " Sergey Senozhatsky
2017-12-01  6:15         ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGXu5jLYQypb=-kf9swRy8F4tSFx_R-urE2tREavOMF-OaXD8g@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=David.Laight@aculab.com \
    --cc=Golden_Miller83@protonmail.ch \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=cfries@google.com \
    --cc=danielmicay@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=geert@linux-m68k.org \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc@hellion.org.uk \
    --cc=joe@perches.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@tobin.cc \
    --cc=netdev@vger.kernel.org \
    --cc=olorin@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rkrcmar@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tixxdz@gmail.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tycho@tycho.ws \
    --cc=tytso@mit.edu \
    --cc=wilal.deacon@arm.com \
    --cc=william.c.roberts@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.