From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Rostedt Subject: Re: [PATCH -tip v2 4/7] kprobes: Replace %p with other pointer types Date: Thu, 26 Apr 2018 22:48:24 -0400 Message-ID: <20180426224824.3492232e@vmware.local.home> References: <152473007907.8819.10449983839199591406.stgit@devbox> <152473020349.8819.11597612324633031612.stgit@devbox> <20180426211351.419d3502@vmware.local.home> <20180427113951.8e3192af570c0bae925b2a71@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180427113951.8e3192af570c0bae925b2a71@kernel.org> Sender: stable-owner@vger.kernel.org To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , Jon Medhurst , Will Deacon , Arnd Bergmann , David Howells , Heiko Carstens , "Tobin C . Harding" , Linus Torvalds , Thomas Richter , akpm@linux-foundation.org, acme@kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, stable@vger.kernel.org List-Id: linux-arch.vger.kernel.org On Fri, 27 Apr 2018 11:39:51 +0900 Masami Hiramatsu wrote: > On Thu, 26 Apr 2018 21:13:51 -0400 > Steven Rostedt wrote: > > > On Thu, 26 Apr 2018 17:10:03 +0900 > > Masami Hiramatsu wrote: > > > > > Replace %p with appropriate pointer types (or just remove it) > > > - Use %pS if possible > > > - Use %px only for the function right before BUG(). > > > - Remove unneeded error message. > > > > I'm not sure "right before BUG()" is legitimate for using %px. Why not > > still use %pS? > > Since BUG() will dump all registers and stacks which includes > raw address information and reboot the system (means reset the > kaslr base offset), I thought it may not add additional damage. BUG() has been changed to print out %pS and not the address while doing the stack dump. It only prints the address if it doesn't find a function name. For example: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc3-test+ #48 Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014 Call Trace: dump_stack+0x68/0x92 lockdep_rcu_suspicious+0xf7/0x100 rcu_read_lock+0x5f/0x61 __is_insn_slot_addr+0x23/0x5c __kernel_text_address+0x4a/0x80 show_trace_log_lvl+0x157/0x296 ? module_assert_mutex_or_preempt+0x4f/0x51 show_stack+0x3d/0x3f dump_stack+0x68/0x92 __warn+0xc2/0xdd ? 0xffffffffa0026077 warn_slowpath_null+0x1d/0x1f module_assert_mutex_or_preempt+0x4f/0x51 __module_address+0x2a/0xac ? 0xffffffffa0026077 __module_text_address+0x12/0x59 ? 0xffffffffa0026077 is_module_text_address+0xe/0x16 __kernel_text_address+0x2b/0x80 ? 0xffffffffa0026077 unwind_get_return_address+0x50/0x5c > > Anyway, for this patch we can use %pS. For the next [5/7] patch, > I'm not sure %pS is good for dumping a stack address... Although it now is. -- Steve From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]:39464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751626AbeD0Cs2 (ORCPT ); Thu, 26 Apr 2018 22:48:28 -0400 Date: Thu, 26 Apr 2018 22:48:24 -0400 From: Steven Rostedt Subject: Re: [PATCH -tip v2 4/7] kprobes: Replace %p with other pointer types Message-ID: <20180426224824.3492232e@vmware.local.home> In-Reply-To: <20180427113951.8e3192af570c0bae925b2a71@kernel.org> References: <152473007907.8819.10449983839199591406.stgit@devbox> <152473020349.8819.11597612324633031612.stgit@devbox> <20180426211351.419d3502@vmware.local.home> <20180427113951.8e3192af570c0bae925b2a71@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , Jon Medhurst , Will Deacon , Arnd Bergmann , David Howells , Heiko Carstens , "Tobin C . Harding" , Linus Torvalds , Thomas Richter , akpm@linux-foundation.org, acme@kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, stable@vger.kernel.org Message-ID: <20180427024824.5gPLAIGeuAmxWpySOKMP5GNWX2g16ByLMTOXmkrGRp0@z> On Fri, 27 Apr 2018 11:39:51 +0900 Masami Hiramatsu wrote: > On Thu, 26 Apr 2018 21:13:51 -0400 > Steven Rostedt wrote: > > > On Thu, 26 Apr 2018 17:10:03 +0900 > > Masami Hiramatsu wrote: > > > > > Replace %p with appropriate pointer types (or just remove it) > > > - Use %pS if possible > > > - Use %px only for the function right before BUG(). > > > - Remove unneeded error message. > > > > I'm not sure "right before BUG()" is legitimate for using %px. Why not > > still use %pS? > > Since BUG() will dump all registers and stacks which includes > raw address information and reboot the system (means reset the > kaslr base offset), I thought it may not add additional damage. BUG() has been changed to print out %pS and not the address while doing the stack dump. It only prints the address if it doesn't find a function name. For example: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc3-test+ #48 Hardware name: MSI MS-7823/CSM-H87M-G43 (MS-7823), BIOS V1.6 02/22/2014 Call Trace: dump_stack+0x68/0x92 lockdep_rcu_suspicious+0xf7/0x100 rcu_read_lock+0x5f/0x61 __is_insn_slot_addr+0x23/0x5c __kernel_text_address+0x4a/0x80 show_trace_log_lvl+0x157/0x296 ? module_assert_mutex_or_preempt+0x4f/0x51 show_stack+0x3d/0x3f dump_stack+0x68/0x92 __warn+0xc2/0xdd ? 0xffffffffa0026077 warn_slowpath_null+0x1d/0x1f module_assert_mutex_or_preempt+0x4f/0x51 __module_address+0x2a/0xac ? 0xffffffffa0026077 __module_text_address+0x12/0x59 ? 0xffffffffa0026077 is_module_text_address+0xe/0x16 __kernel_text_address+0x2b/0x80 ? 0xffffffffa0026077 unwind_get_return_address+0x50/0x5c > > Anyway, for this patch we can use %pS. For the next [5/7] patch, > I'm not sure %pS is good for dumping a stack address... Although it now is. -- Steve