From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752672AbdLGUjH (ORCPT ); Thu, 7 Dec 2017 15:39:07 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52837 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbdLGUjF (ORCPT ); Thu, 7 Dec 2017 15:39:05 -0500 X-ME-Sender: Date: Fri, 8 Dec 2017 07:39:00 +1100 From: "Tobin C. Harding" To: Jonathan Corbet , Kees Cook Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] docs: add documentation on printing kernel addresses Message-ID: <20171207203900.GG2191@eros> References: <1512606398-31409-1-git-send-email-me@tobin.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512606398-31409-1-git-send-email-me@tobin.cc> 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 Please drop this patch, needs amendment (commented inline). On Thu, Dec 07, 2017 at 11:26:38AM +1100, Tobin C. Harding wrote: > Hashing addresses printed with printk specifier %p was implemented > recently. During development a number of issues were raised regarding > leaking kernel addresses to userspace. We should update the > documentation appropriately. > > Add documentation regarding printing kernel addresses. > > Signed-off-by: Tobin C. Harding > --- > > Is there a proffered method for subscripts in sphinx kernel docs? Here > we use '[*]' > > thanks, > Tobin. > > Documentation/security/self-protection.rst | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/Documentation/security/self-protection.rst b/Documentation/security/self-protection.rst > index 60c8bd8b77bf..e711280cfdd7 100644 > --- a/Documentation/security/self-protection.rst > +++ b/Documentation/security/self-protection.rst > @@ -270,6 +270,20 @@ attacks, it is important to defend against exposure of both kernel memory > addresses and kernel memory contents (since they may contain kernel > addresses or other sensitive things like canary values). > > +Kernel addresses > +---------------- > + > +Printing kernel addresses to userspace leaks sensitive information about > +the kernel memory layout. Care should be exercised when using any printk > +specifier that prints the raw address, currently %px, %p[ad], (and %p[sSb] > +in certain circumstances [*]). Any file written to using one of these > +specifiers should be readable only by privileged processes. > + > +Kernels 4.14 and older printed the raw address using %p. As of 4.15-rc1 > +addresses printed with the specifier %p are hashed before printing. > + > +[*] If symbol lookup fails, the raw address is currently printed. [*] If KALLSYMS is enabled and symbol lookup fails, the raw address is currently printed. If KALLSYMS is not enabled the address is printed. thanks, Tobin.