Netdev List
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-atm-general@lists.sourceforge.net,
	linux-can@vger.kernel.org, linux-sctp@vger.kernel.org,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Kuniyuki Iwashima" <kuniyu@google.com>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Marcelo Ricardo Leitner" <marcelo.leitner@gmail.com>,
	"Neal Cardwell" <ncardwell@google.com>,
	"Oliver Hartkopp" <socketcan@hartkopp.net>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Remi Denis-Courmont" <courmisch@gmail.com>,
	"Simon Horman" <horms@kernel.org>,
	"Steffen Klassert" <steffen.klassert@secunet.com>,
	"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
	"Xin Long" <lucien.xin@gmail.com>,
	"Petr Mladek" <pmladek@suse.com>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: Re: [PATCH net-next v3] net: Replace %pK output with 0
Date: Thu, 13 Aug 2026 09:49:43 -0700	[thread overview]
Message-ID: <202608130949.A391CBF6@keescook> (raw)
In-Reply-To: <20260812110531.ITPqiY2O@linutronix.de>

On Wed, Aug 12, 2026 at 01:05:31PM +0200, Sebastian Andrzej Siewior wrote:
> Commit 71338aa7d050c ("net: convert %p usage to %pK") which is from
> 2011 and changed the %p annotation for pointer to %pK. Back then the
> default behaviour for %p was to print the pointer. The %pK modifier was
> introduced to able to control the behaviour of specific pointer values
> without changing the behaviour of %p for everyone. It was dedicated to
> avoid leaking pointers via /proc.
> 
> There was also the idea to remove the check from formatting the string
> and move to the open callback with some helpers but this did not happen.
> 
> Things changed over time. The default behaviour for %p is now to print a
> hash pointer which does not leak the address but allows to correlate if
> two pointers are equal.
> The policy on %p is to not introduce new ones. This is somehow in
> between since it already exists. The pointer are usually socket pointers
> and I don't see any value in exposing them. Therefore I am following the
> recommendation of removing them. Since their usage in /proc/ can be
> considered ABI I replace the pointer with a 0.
> 
> Replace the %pK annotation with 0 value. Correct the spacing for the
> cases where pointer is at the beginning. Use %ps in CAN where the read
> callback is used.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

I love this kind of replacement. :)

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

      reply	other threads:[~2026-08-13 16:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 11:05 [PATCH net-next v3] net: Replace %pK output with 0 Sebastian Andrzej Siewior
2026-08-13 16:49 ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202608130949.A391CBF6@keescook \
    --to=kees@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=courmisch@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=mkl@pengutronix.de \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmladek@suse.com \
    --cc=socketcan@hartkopp.net \
    --cc=steffen.klassert@secunet.com \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox