From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbdLEVJJ (ORCPT ); Tue, 5 Dec 2017 16:09:09 -0500 Received: from merlin.infradead.org ([205.233.59.134]:41138 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751432AbdLEVJE (ORCPT ); Tue, 5 Dec 2017 16:09:04 -0500 Subject: Re: [PATCH V11 4/5] vsprintf: add printk specifier %px To: David Laight , "'Kees Cook'" Cc: Linus Torvalds , "Tobin C. Harding" , "kernel-hardening@lists.openwall.com" , "Jason A. Donenfeld" , "Theodore Ts'o" , 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 , Steven Rostedt , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , =?UTF-8?Q?Radim_Krcm=c3=a1r?= , Linux Kernel Mailing List , Network Development , David Miller , Stephen Rothwell , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrew Morton References: <1511921105-3647-1-git-send-email-me@tobin.cc> <1511921105-3647-5-git-send-email-me@tobin.cc> <324abe19f1ee4177911d2fc48899ac8a@AcuMS.aculab.com> From: Randy Dunlap Message-ID: <596c917e-3183-d80a-89d4-97e0eb5dc077@infradead.org> Date: Tue, 5 Dec 2017 13:08:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30/2017 02:38 AM, David Laight wrote: > From: Kees Cook >> Sent: 29 November 2017 22:28 >> On Wed, Nov 29, 2017 at 2:07 AM, David Laight wrote: >>> From: Linus Torvalds >>>> Sent: 29 November 2017 02:29 >>>> >>>> On Tue, Nov 28, 2017 at 6:05 PM, Tobin C. Harding wrote: >>>>> >>>>> Let's add specifier %px as a >>>>> clear, opt-in, way to print a pointer and maintain some level of >>>>> isolation from all the other hex integer output within the Kernel. >>>> >>>> Yes, I like this model. It's easy and it's obvious ("'x' for hex"), >>>> and it gives people a good way to say "yes, I really want the actual >>>> address as hex" for if/when the hashed pointer doesn't work for some >>>> reason. >>> >>> Remind me to change every %p to %px on kernels that support it. >>> >>> Although the absolute values of pointers may not be useful, knowing >>> that two pointer differ by a small amount is useful. >>> It is also useful to know whether pointers are to stack, code, static >>> data or heap. >>> >>> This change to %p is going to make debugging a nightmare. >> >> In the future, maybe we could have a knob: unhashed, hashed (default), >> or zeroed. > > Add a 4th, hashed_page+offset. > > Isn't there already a knob for %pK, bits in the same value could be used. > That would make it easy to ensure that %pK is more restructive than %p. (yeah, I'm kind of behind on this thread.) This kind of option (with default hashed) is what I was just thinking of after having seen a few unhelpful traces. But then the knob might not be changed in time for the traces either. :( -- ~Randy From mboxrd@z Thu Jan 1 00:00:00 1970 From: Randy Dunlap Subject: Re: [PATCH V11 4/5] vsprintf: add printk specifier %px Date: Tue, 5 Dec 2017 13:08:41 -0800 Message-ID: <596c917e-3183-d80a-89d4-97e0eb5dc077@infradead.org> References: <1511921105-3647-1-git-send-email-me@tobin.cc> <1511921105-3647-5-git-send-email-me@tobin.cc> <324abe19f1ee4177911d2fc48899ac8a@AcuMS.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Linus Torvalds , "Tobin C. Harding" , "kernel-hardening@lists.openwall.com" , "Jason A. Donenfeld" , Theodore Ts'o , 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 , Steven Rostedt , Chris Fries , 'Kees Cook' Return-path: Received: from merlin.infradead.org ([205.233.59.134]:41138 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751432AbdLEVJE (ORCPT ); Tue, 5 Dec 2017 16:09:04 -0500 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/30/2017 02:38 AM, David Laight wrote: > From: Kees Cook >> Sent: 29 November 2017 22:28 >> On Wed, Nov 29, 2017 at 2:07 AM, David Laight wrote: >>> From: Linus Torvalds >>>> Sent: 29 November 2017 02:29 >>>> >>>> On Tue, Nov 28, 2017 at 6:05 PM, Tobin C. Harding wrote: >>>>> >>>>> Let's add specifier %px as a >>>>> clear, opt-in, way to print a pointer and maintain some level of >>>>> isolation from all the other hex integer output within the Kernel. >>>> >>>> Yes, I like this model. It's easy and it's obvious ("'x' for hex"), >>>> and it gives people a good way to say "yes, I really want the actual >>>> address as hex" for if/when the hashed pointer doesn't work for some >>>> reason. >>> >>> Remind me to change every %p to %px on kernels that support it. >>> >>> Although the absolute values of pointers may not be useful, knowing >>> that two pointer differ by a small amount is useful. >>> It is also useful to know whether pointers are to stack, code, static >>> data or heap. >>> >>> This change to %p is going to make debugging a nightmare. >> >> In the future, maybe we could have a knob: unhashed, hashed (default), >> or zeroed. > > Add a 4th, hashed_page+offset. > > Isn't there already a knob for %pK, bits in the same value could be used. > That would make it easy to ensure that %pK is more restructive than %p. (yeah, I'm kind of behind on this thread.) This kind of option (with default hashed) is what I was just thinking of after having seen a few unhelpful traces. But then the knob might not be changed in time for the traces either. :( -- ~Randy From mboxrd@z Thu Jan 1 00:00:00 1970 References: <1511921105-3647-1-git-send-email-me@tobin.cc> <1511921105-3647-5-git-send-email-me@tobin.cc> <324abe19f1ee4177911d2fc48899ac8a@AcuMS.aculab.com> From: Randy Dunlap Message-ID: <596c917e-3183-d80a-89d4-97e0eb5dc077@infradead.org> Date: Tue, 5 Dec 2017 13:08:41 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: [kernel-hardening] Re: [PATCH V11 4/5] vsprintf: add printk specifier %px To: David Laight , 'Kees Cook' Cc: Linus Torvalds , "Tobin C. Harding" , "kernel-hardening@lists.openwall.com" , "Jason A. Donenfeld" , Theodore Ts'o , 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 , Steven Rostedt , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , =?UTF-8?Q?Radim_Krcm=c3=a1r?= , Linux Kernel Mailing List , Network Development , David Miller , Stephen Rothwell , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Andrew Morton List-ID: On 11/30/2017 02:38 AM, David Laight wrote: > From: Kees Cook >> Sent: 29 November 2017 22:28 >> On Wed, Nov 29, 2017 at 2:07 AM, David Laight wrote: >>> From: Linus Torvalds >>>> Sent: 29 November 2017 02:29 >>>> >>>> On Tue, Nov 28, 2017 at 6:05 PM, Tobin C. Harding wrote: >>>>> >>>>> Let's add specifier %px as a >>>>> clear, opt-in, way to print a pointer and maintain some level of >>>>> isolation from all the other hex integer output within the Kernel. >>>> >>>> Yes, I like this model. It's easy and it's obvious ("'x' for hex"), >>>> and it gives people a good way to say "yes, I really want the actual >>>> address as hex" for if/when the hashed pointer doesn't work for some >>>> reason. >>> >>> Remind me to change every %p to %px on kernels that support it. >>> >>> Although the absolute values of pointers may not be useful, knowing >>> that two pointer differ by a small amount is useful. >>> It is also useful to know whether pointers are to stack, code, static >>> data or heap. >>> >>> This change to %p is going to make debugging a nightmare. >> >> In the future, maybe we could have a knob: unhashed, hashed (default), >> or zeroed. > > Add a 4th, hashed_page+offset. > > Isn't there already a knob for %pK, bits in the same value could be used. > That would make it easy to ensure that %pK is more restructive than %p. (yeah, I'm kind of behind on this thread.) This kind of option (with default hashed) is what I was just thinking of after having seen a few unhelpful traces. But then the knob might not be changed in time for the traces either. :( -- ~Randy