Received: by 10.223.176.5 with SMTP id f5csp2933675wra; Mon, 5 Feb 2018 12:34:26 -0800 (PST) X-Google-Smtp-Source: AH8x226TnZV2Ib3zl0asRsPQO2Z6RtglBoY3lxmkfo8ZTcwCKPQ61Os4LDKtkTnDfVOxAsHniu2/ X-Received: by 2002:a17:902:64d6:: with SMTP id y22-v6mr52763pli.444.1517862865989; Mon, 05 Feb 2018 12:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517862865; cv=none; d=google.com; s=arc-20160816; b=BCeZeFw7Tk0r25N6KlugQliQk10WNRm40e7KdlBGzj6dgYOzeDbn6XfcP/oWLrF2gB 4rS1wfjycpFucNBzs40jxM+Q2jN72l/ngmnqwY94WJG2EukvoGoTAfVHJ4W33aWkEtLS 8F22i0iNeBofSxhdme8XETdIeS493mhNcXBxoZ8N1Mzv3KRWHiakXD/h37Zvt64ftx+F eImSs+HOR3fBSdo268OgE/IYm3n1R5QTo+Zfdr/xQ8OO1u49fIGesgIMM+ECqwk2f+b2 nRIqNWxmwHL5wqyOg9QCPe6zYx6b96jx1RxDs9SYMUVHeCEhDQCxon7hsmTDZYrFmU/6 5+aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=WlJESD5ZNZc1ogifAie2g+wzx/bLJ8kXNpayu5b8l+k=; b=SBdiLOcGLh+mAORaEWATX22x3/EkrgIRJfd7uR6dbY9Q3zu5c1a1YCbixeGMuj3rbO o25B5v66OjsyeTK17Id0Pq5M3WaZuKqZNYwhhvbQ8o1rPJNiIXtAL0HvQUbeyYkKR+uo 32XQSC/o+D8sQIzJrU5p3G0bwiTS39YVvMpwFJjRVqVkpIAOKskJU7HJNGkobkNdzlYq iV8HM70swLg2VBaxzYs7YeR2r3gGYlKUK/qMa1UigB4t1J61nD1v1coNox1QroTUSPWq 2ErrosjfZABHQRrssbZkxTyF1X4Jz9yYbtSzsueiN1nOYIBBAe+vgZxp7YawHZ0mFWYv BOwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=lmRNBx0A; dkim=fail header.i=@chromium.org header.s=google header.b=aHcc+6F5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si3990211pgp.297.2018.02.05.12.34.11; Mon, 05 Feb 2018 12:34:25 -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; dkim=fail header.i=@google.com header.s=20161025 header.b=lmRNBx0A; dkim=fail header.i=@chromium.org header.s=google header.b=aHcc+6F5; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881AbeBEUck (ORCPT + 99 others); Mon, 5 Feb 2018 15:32:40 -0500 Received: from mail-ua0-f180.google.com ([209.85.217.180]:46579 "EHLO mail-ua0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbeBEUce (ORCPT ); Mon, 5 Feb 2018 15:32:34 -0500 Received: by mail-ua0-f180.google.com with SMTP id j23so19534239uak.13 for ; Mon, 05 Feb 2018 12:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=WlJESD5ZNZc1ogifAie2g+wzx/bLJ8kXNpayu5b8l+k=; b=lmRNBx0AOrrfSOt5nzYPUo9z1SmkcMU1zYexA+HpRzhnQXsOmphQabY4drmStz3hJf gGZM1Y1yMobUZtUXTUhrcWJzTtPFek/ZiqaRDG1xbdoOXsuxCHj5uaE07k/6MWgBct8A UyTxecvcOHsHYTqO1AWkPOQGWCdixLcxSJS0MjRov8mkVmP8tEHgBR9JC9+sgo22bbQH HbJOvhbScxKLUaxzFbDBTbx300vzVFS5aEDvJtXWfvmyVnPu43DuyvYATP8h+pIUv6v4 zQAOHcq6ks8caoZiayfG04jQc7z4SnDwAxkqKDpcQL9rDmDbTZVNQ12UuJBtgn4E6c7b jB7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=WlJESD5ZNZc1ogifAie2g+wzx/bLJ8kXNpayu5b8l+k=; b=aHcc+6F5tua/k4LkPmzcQ6DHRPkrkfJvAIAQzmjogBlcD3QBeVFeV+ylWWSB/2hLep 61jfRSX9vmLs3j+kmdbKxigjY7ghB89PhsyVFZvNkXFBj4Ns/ATlgm6/5NO2sGzwsUq0 tgsGG8D87ry2OP2L9qLzSWtLtAfd/lZO2C5N8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=WlJESD5ZNZc1ogifAie2g+wzx/bLJ8kXNpayu5b8l+k=; b=Ao+y+NU5iAOOD30S6W/hQWvlEKGiNMnAcxAmidsky/B9j1fmS05+cIdDwgdJC6exhl eZ0ReZDSeu6+y4qKLqsoi5N3xVbZhotcHHa4tDpVGfOqZMZrmuVBO1FjedsqpqXu5KP0 OJRxcd+R1EuisULDONURBzdd/76ZZShEK9mTU1miUK6OJSbnvDGZoT9ROx+YCryg1x9f 1F0wkyTAm3+MPhDDdmMF9me5J8YYL/NojiMcUy4XV3hYUiPwx10jVSr9tC6EOGhvMPZv KZPiHaj0QzYmpe5h7KViWSubddHQBRwdoo/W8wyg16VysgYp6cU2XmWO/JuSx3qVJDzk cx7A== X-Gm-Message-State: APf1xPBpwVOqvy1Tltd3crmpMhxYPNae9+BZKfwICMEj64TDOV4Fh9VQ lckkQ6Og1TIHUiZll/akVGmYFOrqLVcgCevxAfgfSQ== X-Received: by 10.159.35.15 with SMTP id 15mr80635uae.130.1517862753250; Mon, 05 Feb 2018 12:32:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.31.67.196 with HTTP; Mon, 5 Feb 2018 12:32:32 -0800 (PST) In-Reply-To: <20180205201555.GQ29988@eros> References: <20180204174521.21383-1-kilobyte@angband.pl> <20180205094438.pfd7ffymlvklpxe7@pathway.suse.cz> <20180205201555.GQ29988@eros> From: Kees Cook Date: Tue, 6 Feb 2018 07:32:32 +1100 X-Google-Sender-Auth: am-Oe35Gq8Ra1NQm8Q_QqoL_w9w Message-ID: Subject: Re: [PATCH] vsprintf: avoid misleading "(null)" for %px To: "Tobin C. Harding" Cc: Petr Mladek , Adam Borowski , Sergey Senozhatsky , Steven Rostedt , LKML , Andrew Morton , Joe Perches , "Roberts, William C" , Linus Torvalds , David Laight , Randy Dunlap , Geert Uytterhoeven Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: >> > Hi, >> > >> > I add people who actively commented on adding %px modifier, >> > see the thread starting at >> > https://lkml.kernel.org/r/1511921105-3647-5-git-send-email-me@tobin.cc >> > >> > Just for reference. It seems to be related to the commit 9f36e2c448007b54 >> > ("printk: use %pK for /proc/kallsyms and /proc/modules"). >> > >> > >> > 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. >> > >> > By other words, this avoids regressions when people convert >> > %x to %px. Do I get it right, please? >> >> Nothing should be converting from %x to %px, it's %p to %px. %p print >> "(null)" for 0x0, so it would be surprising for a conversion from %p >> to %px to change that. (Though generally speaking "(null)" is never >> useful...) > > 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. > 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. :) -Kees -- Kees Cook Pixel Security