From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 9 Nov 2017 13:23:18 +0900 From: Sergey Senozhatsky Message-ID: <20171109042318.GB775@jagdpanzerIV> References: <1510192229-20038-1-git-send-email-me@tobin.cc> <20171108223555.52c01531@vmware.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171108223555.52c01531@vmware.local.home> Subject: [kernel-hardening] Re: [PATCH] kallsyms: don't leak address when printing symbol To: Steven Rostedt Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, "Jason A. Donenfeld" , Theodore Ts'o , 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 , "Paul E. McKenney" , Andy Lutomirski , Peter Zijlstra , David Miller , Network Development , linux-kernel@vger.kernel.org List-ID: On (11/08/17 22:35), Steven Rostedt wrote: > On Thu, 9 Nov 2017 12:50:29 +1100 > "Tobin C. Harding" wrote: > > > Currently if a pointer is printed using %p[ssB] and the symbol is not > > found (kallsyms_lookup() fails) then we print the actual address. This > > leaks kernel addresses. We should instead print something _safe_. > > > > Print "" instead of kernel address. > > Ug, ftrace requires this to work as is, as it uses it to print some > addresses that may or may not be a symbol. > > If anything, can this return a success or failure if it were to find a > symbol or not, and then something like ftrace could decide to use %x if > it does not. > > And yes, ftrace leaks kernel addresses all over the place, that's just > the nature of tracing the kernel. > agree, I kinda suspect that that "0x%lx" sometimes can be useful. at least one can tell if the frame is from modules or kernel, and objdump it may be. -ss From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752243AbdKIEXZ (ORCPT ); Wed, 8 Nov 2017 23:23:25 -0500 Received: from mail-pg0-f41.google.com ([74.125.83.41]:44537 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751653AbdKIEXX (ORCPT ); Wed, 8 Nov 2017 23:23:23 -0500 X-Google-Smtp-Source: ABhQp+RKgjdwdmWbqjRSpCdfoI9qPSHdGlhSe/QFWofsRSrBudJer/q/+D/rUWJdZLy6C1P3SxjQsQ== Date: Thu, 9 Nov 2017 13:23:18 +0900 From: Sergey Senozhatsky To: Steven Rostedt Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, "Jason A. Donenfeld" , "Theodore Ts'o" , 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 , "Paul E. McKenney" , Andy Lutomirski , Peter Zijlstra , David Miller , Network Development , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kallsyms: don't leak address when printing symbol Message-ID: <20171109042318.GB775@jagdpanzerIV> References: <1510192229-20038-1-git-send-email-me@tobin.cc> <20171108223555.52c01531@vmware.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171108223555.52c01531@vmware.local.home> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (11/08/17 22:35), Steven Rostedt wrote: > On Thu, 9 Nov 2017 12:50:29 +1100 > "Tobin C. Harding" wrote: > > > Currently if a pointer is printed using %p[ssB] and the symbol is not > > found (kallsyms_lookup() fails) then we print the actual address. This > > leaks kernel addresses. We should instead print something _safe_. > > > > Print "" instead of kernel address. > > Ug, ftrace requires this to work as is, as it uses it to print some > addresses that may or may not be a symbol. > > If anything, can this return a success or failure if it were to find a > symbol or not, and then something like ftrace could decide to use %x if > it does not. > > And yes, ftrace leaks kernel addresses all over the place, that's just > the nature of tracing the kernel. > agree, I kinda suspect that that "0x%lx" sometimes can be useful. at least one can tell if the frame is from modules or kernel, and objdump it may be. -ss From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Senozhatsky Subject: Re: [PATCH] kallsyms: don't leak address when printing symbol Date: Thu, 9 Nov 2017 13:23:18 +0900 Message-ID: <20171109042318.GB775@jagdpanzerIV> References: <1510192229-20038-1-git-send-email-me@tobin.cc> <20171108223555.52c01531@vmware.local.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, "Jason A. Donenfeld" , Theodore Ts'o , 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 Return-path: Content-Disposition: inline In-Reply-To: <20171108223555.52c01531@vmware.local.home> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On (11/08/17 22:35), Steven Rostedt wrote: > On Thu, 9 Nov 2017 12:50:29 +1100 > "Tobin C. Harding" wrote: > > > Currently if a pointer is printed using %p[ssB] and the symbol is not > > found (kallsyms_lookup() fails) then we print the actual address. This > > leaks kernel addresses. We should instead print something _safe_. > > > > Print "" instead of kernel address. > > Ug, ftrace requires this to work as is, as it uses it to print some > addresses that may or may not be a symbol. > > If anything, can this return a success or failure if it were to find a > symbol or not, and then something like ftrace could decide to use %x if > it does not. > > And yes, ftrace leaks kernel addresses all over the place, that's just > the nature of tracing the kernel. > agree, I kinda suspect that that "0x%lx" sometimes can be useful. at least one can tell if the frame is from modules or kernel, and objdump it may be. -ss