From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751520AbdJZIFx (ORCPT ); Thu, 26 Oct 2017 04:05:53 -0400 Received: from smtprelay0129.hostedemail.com ([216.40.44.129]:57028 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750997AbdJZIFq (ORCPT ); Thu, 26 Oct 2017 04:05:46 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:968:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2691:2692:2828:2911:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:3872:3873:3874:4250:4321:4425:5007:6119:6691:6742:6743:7903:8660:10004:10400:10848:11232:11658:11914:12679:12740:12760:12895:13069:13148:13161:13229:13230:13311:13357:13439:14096:14097:14180:14659:14721:21060:21080:21627:30003:30012:30034:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: son64_1498db265af4a X-Filterd-Recvd-Size: 3153 Message-ID: <1509005139.10651.39.camel@perches.com> Subject: Re: [PATCH V8 1/2] printk: remove tabular output for NULL pointer From: Joe Perches To: "Tobin C. Harding" Cc: 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 , Ian Campbell , Sergey Senozhatsky , Catalin Marinas , Will Deacon , Steven Rostedt , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , linux-kernel@vger.kernel.org Date: Thu, 26 Oct 2017 01:05:39 -0700 In-Reply-To: <20171026062734.GH12341@eros> References: <1508986436-31966-1-git-send-email-me@tobin.cc> <1508986436-31966-2-git-send-email-me@tobin.cc> <1508993843.10651.22.camel@perches.com> <20171026062734.GH12341@eros> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-10-26 at 17:27 +1100, Tobin C. Harding wrote: > Hi Joe, > > thanks for your review. > > On Wed, Oct 25, 2017 at 09:57:23PM -0700, Joe Perches wrote: > > On Thu, 2017-10-26 at 13:53 +1100, Tobin C. Harding wrote: > > > Currently pointer() checks for a NULL pointer argument and then if so > > > attempts to print "(null)" with _some_ standard width. This width cannot > > > correctly be ascertained here because many of the printk specifiers > > > print pointers of varying widths. > > > > I believe this is not a good change. > > Only pointers without a extension call pointer() > > Sorry, I don't understand what you mean here. All the %p specifier code is > handled by pointer()? Sorry, I was imprecise/wrong. None of the %p extensions except %pK and %p actually use this bit of the pointer() call. All of the other valid %p extension uses do not end up at this block being executed so it's effectively only regular pointers being output by number() > > > Remove the attempt to print NULL pointers with a correct width. > > > > the correct width for a %p is the default width. > > It is the default width if we are printing addresses. Once we hash 64 > bit address to a 32 bit identifier then we don't have a default width. Perhaps that 32 bit identifier should use leading 0's for the default width. aside: Why hash 64 bits to 32? Why shouldn't the hash width be 64 bits on 64 bit systems?