Received: by 10.223.176.5 with SMTP id f5csp2953845wra; Mon, 5 Feb 2018 13:00:11 -0800 (PST) X-Google-Smtp-Source: AH8x226JPUvZIonOG/wlQgNbxtOBhNR6VMrQHJeA0bjqv34WyI2AH2Sygz//1sanxnKUVOQTvMEp X-Received: by 10.98.162.10 with SMTP id m10mr105016pff.168.1517864411398; Mon, 05 Feb 2018 13:00:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517864411; cv=none; d=google.com; s=arc-20160816; b=Syjbw1SQvtQJYcdDK2ZymkyyShlatafnTvhLYnh1b/mguPY37LBdkjF0q2E8Jba3ZU /X7cLVn7/58kogUT9ACRQgRIiqBXDusOvELvB6mGHflu9grp3OiQJDtRW0vmWkDsmAU4 sjecIGbB52WAkRPKCAkZqktO3V5F8OP9Y79URcTa4g0A0ZJ/1ajk/NJfAEDeqkbzPRav xKuUlzzam5mGFuazyrvOGiZMDaIXvT2PdQHkAsuPWCTHsROySJHmSw4+nBKDEcHsw+Xg RUxEe48j1cbEcUktikfbBQyF3teJ9rbGidAoQ1RS571wz//O0lNj4keSQkAr68ydHsNX Qz/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=UQYOgmQ8+A7FZd8vJX5ZevOb20kHGBu3x8bpDqfyeh8=; b=tRCj6p7kbQG7Qiu1satcby8ZGhK5400hGAuz7MTOMoH8vUi/qnNIHFNvTegRZUGmVp AbI3H8L5b9RYYm4hRkySNmZ8xH5bW+mrbr0glK5YkhzjczgOx61CtRKqkgLQPD4zZ+j6 iemPLr12rRY4Yxa013L1ubFny6+++uiM3FYYjy/06jL7ITWo7CjcXIQF8VGTHm0zFKs+ +U0gT9kNkcCqp/PA2uqXr5Lxib1GH6cA51C/3AJ8oLbIwzopfsXmrkjgUpX6oE1p/1tn K/v4aW/A5tOkGrtGHxSCdr0IKTrCaHtAav5PMul79Luj/U+jrMgoorAVofrdCPpjio0w HswA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si7304547ply.651.2018.02.05.12.59.57; Mon, 05 Feb 2018 13:00:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbeBEU6p (ORCPT + 99 others); Mon, 5 Feb 2018 15:58:45 -0500 Received: from tartarus.angband.pl ([89.206.35.136]:34890 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbeBEU6l (ORCPT ); Mon, 5 Feb 2018 15:58:41 -0500 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.89) (envelope-from ) id 1einqD-00086j-5o; Mon, 05 Feb 2018 21:58:17 +0100 Date: Mon, 5 Feb 2018 21:58:17 +0100 From: Adam Borowski To: Kees Cook Cc: "Tobin C. Harding" , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , LKML , Andrew Morton , Joe Perches , "Roberts, William C" , Linus Torvalds , David Laight , Randy Dunlap , Geert Uytterhoeven Subject: Re: [PATCH] vsprintf: avoid misleading "(null)" for %px Message-ID: <20180205205817.72dy7e7xzjcnwmhs@angband.pl> References: <20180204174521.21383-1-kilobyte@angband.pl> <20180205094438.pfd7ffymlvklpxe7@pathway.suse.cz> <20180205201555.GQ29988@eros> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 06, 2018 at 07:32:32AM +1100, Kees Cook wrote: > On Tue, Feb 6, 2018 at 7:15 AM, Tobin C. Harding wrote: > > On Tue, Feb 06, 2018 at 05:57:17AM +1100, Kees Cook wrote: > >> On Mon, Feb 5, 2018 at 8:44 PM, Petr Mladek wrote: > >> > On Sun 2018-02-04 18:45:21, Adam Borowski wrote: > >> >> Like %pK already does, print "00000000" instead. > >> >> > >> >> This confused people -- the convention is that "(null)" means you tried to > >> >> dereference a null pointer as opposed to printing the address. > > > > Leaving aside what is converting to %px. If we consider that using %px > > is meant to convey to us that we _really_ want the address, in hex hence > > the 'x', then it is not surprising that we will get "00000000"'s for a > > null pointer, right? Yes it is different to before but since we are > > changing the specifier does this not imply that there may be some > > change? > > I personally prefer 0000s, but if we're going to change this, we need > to be aware of the difference. It's easy to paint this bikeshed any color you guys want to: there's an "if" already. My preference is also 0000; NULL would be good, too -- I just don't want (null) as that has a special meaning in usual userspace implementations; (null) also fits well most other modes of %p as they show some object the argument points to. Confusion = wasted debugging time. This is consistent with what we had before, with %pK special-cased. > > In what is now to be expected fashion for %p the discussion appears to > > have split into two different things - what to do with %px and what to > > do with %pK :) > > I say leave %pK alone. :) As in, printing some random (hashed) value? Let's recap: Currently: not-null null %pponies object's description (null) %px address (null) %pK hash hash I'd propose: not-null null %pponies object's description (null) %px address 00000000 %pK hash 00000000 The initial patch in this thread changes printk("%px",0) from (null) to 00000000; what Tobin complained about is that printk("%pK",0) prints a random value. Meow! -- ⢀⣴⠾⠻⢶⣦⠀ The bill with 3 years prison for mentioning Polish concentration ⣾⠁⢰⠒⠀⣿⡁ camps is back. What about KL Warschau (operating until 1956)? ⢿⡄⠘⠷⠚⠋⠀ Zgoda? Łambinowice? Most ex-German KLs? If those were "soviet ⠈⠳⣄⠀⠀⠀⠀ puppets", Bereza Kartuska? Sikorski's camps in UK (thanks Brits!)?