diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2026-09-01 18:03:45 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-09-02 18:38:16 -0700 |
| commit | 7c0ec6288b497fc4dd190e243141a8d429488fd2 (patch) | |
| tree | 97da4b8667d3670541d0061a513e312dfb78ab58 /net/atm | |
| parent | 5add7c8d59fa3a54ebf7b662ef68dce9d44ddbef (diff) | |
| download | linux-next-7c0ec6288b497fc4dd190e243141a8d429488fd2.tar.gz linux-next-7c0ec6288b497fc4dd190e243141a8d429488fd2.zip | |
net: Replace %pK output with 0
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.
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://patch.msgid.link/20260901160345.eeknHmY2@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/atm')
| -rw-r--r-- | net/atm/proc.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/atm/proc.c b/net/atm/proc.c index 8f20b49b9c02..ca0fc6b90998 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c @@ -159,7 +159,7 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc) { struct sock *sk = sk_atm(vcc); - seq_printf(seq, "%pK ", vcc); + seq_puts(seq, " 0 "); if (!vcc->dev) seq_printf(seq, "Unassigned "); else @@ -228,9 +228,8 @@ static const struct seq_operations pvc_seq_ops = { static int vcc_seq_show(struct seq_file *seq, void *v) { if (v == SEQ_START_TOKEN) { - seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", - "Address ", "Itf VPI VCI Fam Flags Reply " - "Send buffer Recv buffer [refcnt]\n"); + seq_puts(seq, "Address Itf VPI VCI Fam Flags Reply " + "Send buffer Recv buffer [refcnt]\n"); } else { struct vcc_state *state = seq->private; struct atm_vcc *vcc = atm_sk(state->sk); |
