* [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0
@ 2026-09-24 15:31 Sebastian Andrzej Siewior
2026-09-24 16:00 ` Alexei Starovoitov
2026-09-24 16:03 ` Daniel Borkmann
0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-24 15:31 UTC (permalink / raw)
To: bpf, linux-kselftest
Cc: Andrii Nakryiko, Eduard Zingerman, Ihor Solodrai,
Alexei Starovoitov, Daniel Borkmann, Kumar Kartikeya Dwivedi,
Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
Emil Tsalapatis, Shuah Khan
Networking used to print the socket pointer with %p as output in the
/proc interface. This was later changed to %pK in order not to reveal
the actual pointer value. The output format has then been copied to bpf
tests which produce the same format including the %pK format modifier.
Networking recently replaced the socket output with a plain 0 because
the socket pointer added no value to the output and the %pK should be
removed from library handling. The format remained otherwise unchanged in
order not to break any tools which are parsing this information.
This change removes the %pK modifier from bpf, following the change in
networking.
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
The networking change is in net-next as commit 7c0ec6288b497 ("net:
Replace %pK output with 0")
The bots complain about "unchanged format" which is changed in terms of
spacing. The order of printed items is unchanged.
v2…v3: https://lore.kernel.org/all/20260918102610.gxA3km8_@linutronix.de/
- correct the subject line
- correct grammar error in the commit description
- Pickup a reviewed-by tag from Emil which was sent for v1
v1…v2: https://lore.kernel.org/all/20260911145011.kErTVDkS@linutronix.de/
- sync dump_udp4(), dump_udp6() with net (0, spacing). The columns are
(were) not aligned.
- Update comment in snprintf.c
tools/testing/selftests/bpf/README.rst | 2 +-
tools/testing/selftests/bpf/prog_tests/snprintf.c | 4 ++--
tools/testing/selftests/bpf/progs/bpf_iter_netlink.c | 4 ++--
tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c | 11 +++++------
tools/testing/selftests/bpf/progs/bpf_iter_tcp6.c | 11 +++++------
tools/testing/selftests/bpf/progs/bpf_iter_udp4.c | 4 ++--
tools/testing/selftests/bpf/progs/bpf_iter_udp6.c | 4 ++--
tools/testing/selftests/bpf/progs/bpf_iter_unix.c | 5 ++---
tools/testing/selftests/bpf/progs/test_snprintf.c | 4 ++--
9 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst
index 07c834433b388..75ff1142c1857 100644
--- a/tools/testing/selftests/bpf/README.rst
+++ b/tools/testing/selftests/bpf/README.rst
@@ -187,7 +187,7 @@ The symptom for ``bpf_iter/netlink`` looks like
...
15: (bf) r2 = r7
16: (0f) r2 += r1
- ; BPF_SEQ_PRINTF(seq, "%pK %-3d ", s, s->sk_protocol);
+ ; BPF_SEQ_PRINTF(seq, "%p %-3d ", s, s->sk_protocol);
17: (7b) *(u64 *)(r7 +0) = r2
only read is supported
diff --git a/tools/testing/selftests/bpf/prog_tests/snprintf.c b/tools/testing/selftests/bpf/prog_tests/snprintf.c
index 4e4a82d54f799..ccfb02bd4e7cd 100644
--- a/tools/testing/selftests/bpf/prog_tests/snprintf.c
+++ b/tools/testing/selftests/bpf/prog_tests/snprintf.c
@@ -15,8 +15,8 @@
#define EXP_SYM_OUT "schedule schedule+0x0/"
#define MIN_SYM_RET sizeof(EXP_SYM_OUT)
-/* The third specifier, %p, is a hashed pointer which changes on every reboot */
-#define EXP_ADDR_OUT "0000000000000000 ffff00000add4e55 "
+/* The second specifier, %p, is a hashed pointer which changes on every reboot */
+#define EXP_ADDR_OUT "ffff00000add4e55 "
#define EXP_ADDR_RET sizeof(EXP_ADDR_OUT "unknownhashedptr")
#define EXP_STR_OUT "str1 a b c d e longstr"
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_netlink.c b/tools/testing/selftests/bpf/progs/bpf_iter_netlink.c
index 00b2ceae81fb0..b9107d3ab6039 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_netlink.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_netlink.c
@@ -25,12 +25,12 @@ int dump_netlink(struct bpf_iter__netlink *ctx)
return 0;
if (ctx->meta->seq_num == 0)
- BPF_SEQ_PRINTF(seq, "sk Eth Pid Groups "
+ BPF_SEQ_PRINTF(seq, "sk Eth Pid Groups "
"Rmem Wmem Dump Locks Drops "
"Inode\n");
s = &nlk->sk;
- BPF_SEQ_PRINTF(seq, "%pK %-3d ", s, s->sk_protocol);
+ BPF_SEQ_PRINTF(seq, "0 %-3d ", s->sk_protocol);
if (!nlk->groups) {
group = 0;
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c b/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
index b1e509b231cd9..d149cf0d07be6 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_tcp4.c
@@ -131,8 +131,7 @@ static int dump_tcp_sock(struct seq_file *seq, struct tcp_sock *tp,
icsk->icsk_probes_out,
sock_i_ino(sp),
sp->sk_refcnt.refs.counter);
- BPF_SEQ_PRINTF(seq, "%pK %lu %lu %u %u %d\n",
- tp,
+ BPF_SEQ_PRINTF(seq, "0 %lu %lu %u %u %d\n",
jiffies_to_clock_t(icsk->icsk_rto),
jiffies_to_clock_t(icsk->icsk_ack.ato),
(icsk->icsk_ack.quick << 1) | inet_csk_in_pingpong_mode(icsk),
@@ -161,10 +160,10 @@ static int dump_tw_sock(struct seq_file *seq, struct tcp_timewait_sock *ttw,
BPF_SEQ_PRINTF(seq, "%4d: %08X:%04X %08X:%04X ",
seq_num, src, srcp, dest, destp);
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d 0\n",
tw->tw_substate, 0, 0,
3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0,
- tw->tw_refcnt.refs.counter, tw);
+ tw->tw_refcnt.refs.counter);
return 0;
}
@@ -185,9 +184,9 @@ static int dump_req_sock(struct seq_file *seq, struct tcp_request_sock *treq,
seq_num, irsk->ir_loc_addr,
irsk->ir_num, irsk->ir_rmt_addr,
bpf_ntohs(irsk->ir_rmt_port));
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d 0\n",
TCP_SYN_RECV, 0, 0, 1, jiffies_to_clock_t(ttd),
- req->num_timeout, uid, 0, 0, 0, req);
+ req->num_timeout, uid, 0, 0, 0);
return 0;
}
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_tcp6.c b/tools/testing/selftests/bpf/progs/bpf_iter_tcp6.c
index dbc7166aee91f..cd65fa81f1219 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_tcp6.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_tcp6.c
@@ -135,8 +135,7 @@ static int dump_tcp6_sock(struct seq_file *seq, struct tcp6_sock *tp,
icsk->icsk_probes_out,
sock_i_ino(sp),
sp->sk_refcnt.refs.counter);
- BPF_SEQ_PRINTF(seq, "%pK %lu %lu %u %u %d\n",
- tp,
+ BPF_SEQ_PRINTF(seq, "0 %lu %lu %u %u %d\n",
jiffies_to_clock_t(icsk->icsk_rto),
jiffies_to_clock_t(icsk->icsk_ack.ato),
(icsk->icsk_ack.quick << 1) | inet_csk_in_pingpong_mode(icsk),
@@ -170,10 +169,10 @@ static int dump_tw_sock(struct seq_file *seq, struct tcp_timewait_sock *ttw,
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3], destp);
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d 0\n",
tw->tw_substate, 0, 0,
3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0,
- tw->tw_refcnt.refs.counter, tw);
+ tw->tw_refcnt.refs.counter);
return 0;
}
@@ -201,9 +200,9 @@ static int dump_req_sock(struct seq_file *seq, struct tcp_request_sock *treq,
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3],
bpf_ntohs(irsk->ir_rmt_port));
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d 0\n",
TCP_SYN_RECV, 0, 0, 1, jiffies_to_clock_t(ttd),
- req->num_timeout, uid, 0, 0, 0, req);
+ req->num_timeout, uid, 0, 0, 0);
return 0;
}
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_udp4.c b/tools/testing/selftests/bpf/progs/bpf_iter_udp4.c
index 23b2aa2604de2..d4079a619da66 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_udp4.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_udp4.c
@@ -57,13 +57,13 @@ int dump_udp4(struct bpf_iter__udp *ctx)
BPF_SEQ_PRINTF(seq, "%5d: %08X:%04X %08X:%04X ",
ctx->bucket, src, srcp, dest, destp);
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d 0 %u\n",
inet->sk.sk_state,
inet->sk.sk_wmem_alloc.refs.counter - 1,
rqueue,
0, 0L, 0, ctx->uid, 0,
sock_i_ino(&inet->sk),
- inet->sk.sk_refcnt.refs.counter, udp_sk,
+ inet->sk.sk_refcnt.refs.counter,
udp_sk->drop_counters.drops0.counter +
udp_sk->drop_counters.drops1.counter);
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_udp6.c b/tools/testing/selftests/bpf/progs/bpf_iter_udp6.c
index c48b05aa2a4b2..dadc5f73ff098 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_udp6.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_udp6.c
@@ -65,13 +65,13 @@ int dump_udp6(struct bpf_iter__udp *ctx)
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3], destp);
- BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n",
+ BPF_SEQ_PRINTF(seq, "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d 0 %u\n",
inet->sk.sk_state,
inet->sk.sk_wmem_alloc.refs.counter - 1,
rqueue,
0, 0L, 0, ctx->uid, 0,
sock_i_ino(&inet->sk),
- inet->sk.sk_refcnt.refs.counter, udp_sk,
+ inet->sk.sk_refcnt.refs.counter,
udp_sk->drop_counters.drops0.counter +
udp_sk->drop_counters.drops1.counter);
return 0;
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_unix.c b/tools/testing/selftests/bpf/progs/bpf_iter_unix.c
index a2652c8c3616f..df3d971b21e8a 100644
--- a/tools/testing/selftests/bpf/progs/bpf_iter_unix.c
+++ b/tools/testing/selftests/bpf/progs/bpf_iter_unix.c
@@ -42,10 +42,9 @@ int dump_unix(struct bpf_iter__unix *ctx)
seq = ctx->meta->seq;
seq_num = ctx->meta->seq_num;
if (seq_num == 0)
- BPF_SEQ_PRINTF(seq, "Num RefCount Protocol Flags Type St Inode Path\n");
+ BPF_SEQ_PRINTF(seq, "Num RefCount Protocol Flags Type St Inode Path\n");
- BPF_SEQ_PRINTF(seq, "%pK: %08X %08X %08X %04X %02X %8lu",
- unix_sk,
+ BPF_SEQ_PRINTF(seq, "%08u: %08X %08X %08X %04X %02X %8lu", 0,
sk->sk_refcnt.refs.counter,
0,
sk->sk_state == TCP_LISTEN ? __SO_ACCEPTCON : 0,
diff --git a/tools/testing/selftests/bpf/progs/test_snprintf.c b/tools/testing/selftests/bpf/progs/test_snprintf.c
index 8fda075440235..48a0025cf2ca8 100644
--- a/tools/testing/selftests/bpf/progs/test_snprintf.c
+++ b/tools/testing/selftests/bpf/progs/test_snprintf.c
@@ -57,8 +57,8 @@ int handler(const void *ctx)
sym_ret = BPF_SNPRINTF(sym_out, sizeof(sym_out), "%ps %pS %pB",
&schedule, &schedule, &schedule);
/* Kernel pointers */
- addr_ret = BPF_SNPRINTF(addr_out, sizeof(addr_out), "%pK %px %p",
- 0, 0xFFFF00000ADD4E55, 0xFFFF00000ADD4E55);
+ addr_ret = BPF_SNPRINTF(addr_out, sizeof(addr_out), "%px %p",
+ 0xFFFF00000ADD4E55, 0xFFFF00000ADD4E55);
/* Strings and single-byte character embedding */
str_ret = BPF_SNPRINTF(str_out, sizeof(str_out), "%s % 9c %+2c %-3c %04c %0c %+05s",
str1, 'a', 'b', 'c', 'd', 'e', longstr);
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0
2026-09-24 15:31 [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0 Sebastian Andrzej Siewior
@ 2026-09-24 16:00 ` Alexei Starovoitov
2026-09-24 17:33 ` Sebastian Andrzej Siewior
2026-09-24 16:03 ` Daniel Borkmann
1 sibling, 1 reply; 4+ messages in thread
From: Alexei Starovoitov @ 2026-09-24 16:00 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, bpf, linux-kselftest
Cc: Andrii Nakryiko, Eduard Zingerman, Ihor Solodrai, Daniel Borkmann,
Kumar Kartikeya Dwivedi, Martin KaFai Lau, Song Liu,
Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan
On Thu, Sep 24, 2026 at 05:31 PM Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> v2…v3: https://lore.kernel.org/all/20260918102610.gxA3km8_@linutronix.de/
> - correct the subject line
> - correct grammar error in the commit description
> - Pickup a reviewed-by tag from Emil which was sent for v1
v2 was applied to bpf-next two days ago.
See commit 79dc258c9392 ("selftests/bpf: Replace %pK output with 0").
The code in v3 is the same. Nothing to apply.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0
2026-09-24 16:00 ` Alexei Starovoitov
@ 2026-09-24 17:33 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-24 17:33 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: bpf, linux-kselftest, Andrii Nakryiko, Eduard Zingerman,
Ihor Solodrai, Daniel Borkmann, Kumar Kartikeya Dwivedi,
Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
Emil Tsalapatis, Shuah Khan
On 2026-09-24 16:00:47 [+0000], Alexei Starovoitov wrote:
> On Thu, Sep 24, 2026 at 05:31 PM Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> > v2…v3: https://lore.kernel.org/all/20260918102610.gxA3km8_@linutronix.de/
> > - correct the subject line
> > - correct grammar error in the commit description
> > - Pickup a reviewed-by tag from Emil which was sent for v1
>
> v2 was applied to bpf-next two days ago.
> See commit 79dc258c9392 ("selftests/bpf: Replace %pK output with 0").
> The code in v3 is the same. Nothing to apply.
Oh, thank you. I haven't seen a mail from the bot and the patch tracker
said had "changes requested".
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0
2026-09-24 15:31 [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0 Sebastian Andrzej Siewior
2026-09-24 16:00 ` Alexei Starovoitov
@ 2026-09-24 16:03 ` Daniel Borkmann
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2026-09-24 16:03 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, bpf, linux-kselftest
Cc: Andrii Nakryiko, Eduard Zingerman, Ihor Solodrai,
Alexei Starovoitov, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis, Shuah Khan
Hi Sebastian,
On 9/24/26 5:31 PM, Sebastian Andrzej Siewior wrote:
> Networking used to print the socket pointer with %p as output in the
> /proc interface. This was later changed to %pK in order not to reveal
> the actual pointer value. The output format has then been copied to bpf
> tests which produce the same format including the %pK format modifier.
>
> Networking recently replaced the socket output with a plain 0 because
> the socket pointer added no value to the output and the %pK should be
> removed from library handling. The format remained otherwise unchanged in
> order not to break any tools which are parsing this information.
>
> This change removes the %pK modifier from bpf, following the change in
> networking.
>
> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
This change was already in the tree:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=79dc258c9392051420a26f1504c647bd3d27c66a
Cheers,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-24 17:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 15:31 [PATCH v3 bpf-next] selftests/bpf: Replace %pK output with 0 Sebastian Andrzej Siewior
2026-09-24 16:00 ` Alexei Starovoitov
2026-09-24 17:33 ` Sebastian Andrzej Siewior
2026-09-24 16:03 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox