From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762295AbdJQNb1 (ORCPT ); Tue, 17 Oct 2017 09:31:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:33260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753994AbdJQNbX (ORCPT ); Tue, 17 Oct 2017 09:31:23 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44415218B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Tue, 17 Oct 2017 09:31:19 -0400 From: Steven Rostedt To: "Tobin C. Harding" Cc: kernel-hardening@lists.openwall.com, Linus Torvalds , Kees Cook , Paolo Bonzini , Tycho Andersen , "Roberts, William C" , Tejun Heo , Jordan Glover , Greg KH , Petr Mladek , Joe Perches , Ian Campbell , Sergey Senozhatsky , Catalin Marinas , Will Deacon , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] printk: hash addresses printed with %p Message-ID: <20171017093119.6dd98919@gandalf.local.home> In-Reply-To: <1508215972-7769-1-git-send-email-me@tobin.cc> References: <1508215972-7769-1-git-send-email-me@tobin.cc> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Oct 2017 15:52:51 +1100 "Tobin C. Harding" wrote: > Currently there are many places in the kernel where addresses are being > printed using an unadorned %p. Kernel pointers should be printed using > %pK allowing some control via the kptr_restrict sysctl. Exposing addresses > gives attackers sensitive information about the kernel layout in memory. > > We can reduce the attack surface by hashing all addresses printed with > %p. This will of course break some users, forcing code printing needed > addresses to be updated. > > For what it's worth, usage of unadorned %p can be broken down as follows > > git grep '%p[^KFfSsBRrbMmIiEUVKNhdDgCGO]' | wc -l Does %p[FfSs] leak addresses? Well, I guess it does if they are not found in kallsyms, but otherwise you have: function+0x -- Steve > > arch: 2512 > block: 20 > crypto: 12 > fs: 1221 > include: 147 > kernel: 109 > lib: 77 > mm: 120 > net: 1516 > security: 11 > sound: 168 > virt: 2 > drivers: 8420 > > Add helper function siphash_1ulong(). Add function ptr_to_id() to map an > address to a 32 bit unique identifier. > > Signed-off-by: Tobin C. Harding > --- >