All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: "Tobin C. Harding" <me@tobin.cc>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	kernel-hardening@lists.openwall.com,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Theodore Ts'o <tytso@mit.edu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Tycho Andersen <tycho@docker.com>,
	"Roberts, William C" <william.c.roberts@intel.com>,
	Tejun Heo <tj@kernel.org>,
	Jordan Glover <Golden_Miller83@protonmail.ch>,
	Greg KH <gregkh@linuxfoundation.org>,
	Petr Mladek <pmladek@suse.com>, Joe Perches <joe@perches.com>,
	Ian Campbell <ijc@hellion.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <wilal.deacon@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Chris Fries <cfries@google.com>,
	Dave Weinstein <olorin@google.com>,
	Daniel Micay <danielmicay@gmail.com>,
	Djalal Harouni <tixxdz@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [kernel-hardening] Re: [PATCH V8 0/2] printk: hash addresses printed with %p
Date: Thu, 2 Nov 2017 17:23:44 +0900	[thread overview]
Message-ID: <20171102082344.GC655@jagdpanzerIV> (raw)
In-Reply-To: <20171031233533.GD3585@eros>

On (11/01/17 10:35), Tobin C. Harding wrote:
[..]
> Yes. The question has been raised will we be here again in 6 years time
> trying to fix all the uses of %x. And there are already 29K uses of
> %[xX] in tree, which of these are leaking addresses? This is why Linus'
> has commented that really effort should be directed at finding the leaks
> as they happen (in procfs, sysfs, dmesg) instead of fixing this in
> the code.

got it. thanks.

> So far I haven't been able to come up with any meaningful way
> to do this on 32 bit machines. There is a patch adding a script to catch
> leaks on 64 bit machines in flight.

who is expected to run that script?

BTW, can BPF/eBPF printk addresses?

> This patch needs to be a small part of a continued effort to stop the
> leaks if we want to have any hope of stopping them.
> 
> If you have any suggestions on dealing with %x please do say. We have
> code changes, compiler warnings, and checkpatch - none of which
> immediately seem great.

hm... just a huge pile of if's

	if (is_vmalloc_addr(addr))
		do_hashing(addr);
	else if (__module_address(addr))
		do_hashing(addr);
	else if (is_kernel(addr) || is_kernel_inittext(addr))
	...

but that's going to be really messy and "iffy".

	-ss

WARNING: multiple messages have this Message-ID (diff)
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: "Tobin C. Harding" <me@tobin.cc>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	kernel-hardening@lists.openwall.com,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Kees Cook <keescook@chromium.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Tycho Andersen <tycho@docker.com>,
	"Roberts, William C" <william.c.roberts@intel.com>,
	Tejun Heo <tj@kernel.org>,
	Jordan Glover <Golden_Miller83@protonmail.ch>,
	Greg KH <gregkh@linuxfoundation.org>,
	Petr Mladek <pmladek@suse.com>, Joe Perches <joe@perches.com>,
	Ian Campbell <ijc@hellion.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <wilal.deacon@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Chris Fries <cfries@google.com>,
	Dave Weinstein <olorin@google.com>,
	Daniel Micay <danielmicay@gmail.com>,
	Djalal Harouni <tixxdz@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V8 0/2] printk: hash addresses printed with %p
Date: Thu, 2 Nov 2017 17:23:44 +0900	[thread overview]
Message-ID: <20171102082344.GC655@jagdpanzerIV> (raw)
In-Reply-To: <20171031233533.GD3585@eros>

On (11/01/17 10:35), Tobin C. Harding wrote:
[..]
> Yes. The question has been raised will we be here again in 6 years time
> trying to fix all the uses of %x. And there are already 29K uses of
> %[xX] in tree, which of these are leaking addresses? This is why Linus'
> has commented that really effort should be directed at finding the leaks
> as they happen (in procfs, sysfs, dmesg) instead of fixing this in
> the code.

got it. thanks.

> So far I haven't been able to come up with any meaningful way
> to do this on 32 bit machines. There is a patch adding a script to catch
> leaks on 64 bit machines in flight.

who is expected to run that script?

BTW, can BPF/eBPF printk addresses?

> This patch needs to be a small part of a continued effort to stop the
> leaks if we want to have any hope of stopping them.
> 
> If you have any suggestions on dealing with %x please do say. We have
> code changes, compiler warnings, and checkpatch - none of which
> immediately seem great.

hm... just a huge pile of if's

	if (is_vmalloc_addr(addr))
		do_hashing(addr);
	else if (__module_address(addr))
		do_hashing(addr);
	else if (is_kernel(addr) || is_kernel_inittext(addr))
	...

but that's going to be really messy and "iffy".

	-ss

  reply	other threads:[~2017-11-02  8:23 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26  2:53 [kernel-hardening] [PATCH V8 0/2] printk: hash addresses printed with %p Tobin C. Harding
2017-10-26  2:53 ` Tobin C. Harding
2017-10-26  2:53 ` [kernel-hardening] [PATCH V8 1/2] printk: remove tabular output for NULL pointer Tobin C. Harding
2017-10-26  2:53   ` Tobin C. Harding
2017-10-26  4:57   ` [kernel-hardening] " Joe Perches
2017-10-26  4:57     ` Joe Perches
2017-10-26  6:27     ` [kernel-hardening] " Tobin C. Harding
2017-10-26  6:27       ` Tobin C. Harding
2017-10-26  8:05       ` [kernel-hardening] " Joe Perches
2017-10-26  8:05         ` Joe Perches
2017-10-26  9:37         ` [kernel-hardening] " Tobin C. Harding
2017-10-26  9:37           ` Tobin C. Harding
2017-10-26 14:47           ` [kernel-hardening] " Joe Perches
2017-10-26 14:47             ` Joe Perches
2017-10-26 23:57             ` [kernel-hardening] " Tobin C. Harding
2017-10-26 23:57               ` Tobin C. Harding
2017-10-27  0:11               ` [kernel-hardening] " Joe Perches
2017-10-27  0:11                 ` Joe Perches
2017-10-26  2:53 ` [kernel-hardening] [PATCH V8 2/2] printk: hash addresses printed with %p Tobin C. Harding
2017-10-26  2:53   ` Tobin C. Harding
2017-10-26  2:58   ` [kernel-hardening] " Tobin C. Harding
2017-10-26  2:58     ` Tobin C. Harding
2017-10-30 21:33     ` [kernel-hardening] " Steven Rostedt
2017-10-30 21:33       ` Steven Rostedt
2017-10-30 22:41       ` [kernel-hardening] " Tobin C. Harding
2017-10-30 22:41         ` Tobin C. Harding
2017-10-31  0:00         ` [kernel-hardening] " Steven Rostedt
2017-10-31  0:00           ` Steven Rostedt
2017-10-31  2:00           ` [kernel-hardening] " Tobin C. Harding
2017-10-31  2:00             ` Tobin C. Harding
2017-10-26  3:11   ` [kernel-hardening] " Jason A. Donenfeld
2017-10-26  3:11     ` Jason A. Donenfeld
2017-10-27 13:33 ` [kernel-hardening] Re: [PATCH V8 0/2] " Sergey Senozhatsky
2017-10-27 13:33   ` Sergey Senozhatsky
2017-10-31 23:35   ` [kernel-hardening] " Tobin C. Harding
2017-10-31 23:35     ` Tobin C. Harding
2017-11-02  8:23     ` Sergey Senozhatsky [this message]
2017-11-02  8:23       ` Sergey Senozhatsky
2017-11-02 10:14       ` [kernel-hardening] " Tobin C. Harding
2017-11-02 10:14         ` Tobin C. Harding
2017-11-02 13:43         ` [kernel-hardening] " Roberts, William C
2017-11-02 13:43           ` Roberts, William C
2017-11-02 16:04         ` [kernel-hardening] " Sergey Senozhatsky
2017-11-02 16:04           ` Sergey Senozhatsky
2017-11-02 18:11           ` [kernel-hardening] " Petr Nejedlý
2017-10-30 22:03 ` Kees Cook
2017-10-30 22:03   ` Kees Cook
2017-10-30 22:33   ` [kernel-hardening] " Tobin C. Harding
2017-10-30 22:33     ` Tobin C. Harding
2017-10-31  2:08     ` [kernel-hardening] " Joe Perches
2017-10-31  2:08       ` Joe Perches
2017-10-31 23:16       ` [kernel-hardening] " Tobin C. Harding
2017-10-31 23:16         ` Tobin C. Harding
2017-10-31 23:33         ` [kernel-hardening] " Joe Perches
2017-10-31 23:33           ` Joe Perches
2017-11-03  5:13           ` [kernel-hardening] " Vinod Koul
2017-11-03  5:13             ` Vinod Koul

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=20171102082344.GC655@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=Golden_Miller83@protonmail.ch \
    --cc=Jason@zx2c4.com \
    --cc=catalin.marinas@arm.com \
    --cc=cfries@google.com \
    --cc=danielmicay@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc@hellion.org.uk \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@tobin.cc \
    --cc=olorin@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tixxdz@gmail.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tycho@docker.com \
    --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.