From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754638AbdJRC2M (ORCPT ); Tue, 17 Oct 2017 22:28:12 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58457 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752358AbdJRC2I (ORCPT ); Tue, 17 Oct 2017 22:28:08 -0400 X-ME-Sender: Date: Wed, 18 Oct 2017 13:28:05 +1100 From: "Tobin C. Harding" To: Kees Cook Cc: Steven Rostedt , "kernel-hardening@lists.openwall.com" , Linus Torvalds , 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 , LKML Subject: Re: [PATCH v2] printk: hash addresses printed with %p Message-ID: <20171018022805.GB30848@eros> References: <1508215972-7769-1-git-send-email-me@tobin.cc> <20171017093119.6dd98919@gandalf.local.home> <20171017231559.GD8001@eros> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 17, 2017 at 05:13:10PM -0700, Kees Cook wrote: > On Tue, Oct 17, 2017 at 4:15 PM, Tobin C. Harding wrote: > > On Tue, Oct 17, 2017 at 09:31:19AM -0400, Steven Rostedt wrote: > >> 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 > > > > You are correct %pF and %pS print an offset. Does this provide an attack vector, > > I didn't think so but I'm no security expert. If they do then we need to amend > > those calls also. > > They haven't traditionally been a big deal. If they turn out to be > problematic, we can deal with it then, IMO. Thanks Kees, Tobin.