* [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints
@ 2025-08-11 9:43 Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 1/2] ice: " Thomas Weißschuh
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-08-11 9:43 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Saeed Mahameed,
Leon Romanovsky, Tariq Toukan, Mark Bloch
Cc: intel-wired-lan, netdev, linux-kernel, linux-rdma,
Aleksandr Loktionov, Simon Horman, Paul Menzel,
Thomas Weißschuh
In the past %pK was preferable to %p as it would not leak raw pointer
values into the kernel log.
Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used
through printk(). They can still unintentionally leak raw pointers or
acquire sleeping locks in atomic contexts.
Switch to the regular pointer formatting which is safer and
easier to reason about.
There are still a few users of %pK left, but these use it through seq_file,
for which its usage is safe.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Changes in v5:
- Rebase on v6.17-rc1
- Bick up Reviewed-by from Paul
- Link to v4: https://lore.kernel.org/r/20250718-restricted-pointers-net-v4-0-4baa64e40658@linutronix.de
Changes in v4:
- Pick up Reviewed-by from Simon
- Link to v3: https://lore.kernel.org/r/20250618-restricted-pointers-net-v3-0-3b7a531e58bb@linutronix.de
Changes in v3:
- Fix typo in commit messages
- Link to v2: https://lore.kernel.org/r/20250417-restricted-pointers-net-v2-0-94cf7ef8e6ae@linutronix.de
Changes in v2:
- Drop wifi/ath patches, they are submitted on their own now
- Link to v1: https://lore.kernel.org/r/20250414-restricted-pointers-net-v1-0-12af0ce46cdd@linutronix.de
---
Thomas Weißschuh (2):
ice: Don't use %pK through printk or tracepoints
net/mlx5: Don't use %pK through tracepoints
drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
drivers/net/ethernet/intel/ice/ice_trace.h | 10 +++++-----
.../ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250404-restricted-pointers-net-a8cddd03e5d1
Best regards,
--
Thomas Weißschuh <thomas.weissschuh@linutronix.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v5 1/2] ice: Don't use %pK through printk or tracepoints
2025-08-11 9:43 [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Thomas Weißschuh
@ 2025-08-11 9:43 ` Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 2/2] net/mlx5: Don't use %pK through tracepoints Thomas Weißschuh
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-08-11 9:43 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Saeed Mahameed,
Leon Romanovsky, Tariq Toukan, Mark Bloch
Cc: intel-wired-lan, netdev, linux-kernel, linux-rdma,
Aleksandr Loktionov, Simon Horman, Paul Menzel,
Thomas Weißschuh
In the past %pK was preferable to %p as it would not leak raw pointer
values into the kernel log.
Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used
through printk(). They can still unintentionally leak raw pointers or
acquire sleeping locks in atomic contexts.
Switch to the regular pointer formatting which is safer and
easier to reason about.
There are still a few users of %pK left, but these use it through seq_file,
for which its usage is safe.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
drivers/net/ethernet/intel/ice/ice_trace.h | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 8e0b06c1e02b2a0ca25bd6f30395cc237e8c541e..93c6e64ed9404e48be5fedd5f7887a1bca8dda0e 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -9117,7 +9117,7 @@ static int ice_create_q_channels(struct ice_vsi *vsi)
list_add_tail(&ch->list, &vsi->ch_list);
vsi->tc_map_vsi[i] = ch->ch_vsi;
dev_dbg(ice_pf_to_dev(pf),
- "successfully created channel: VSI %pK\n", ch->ch_vsi);
+ "successfully created channel: VSI %p\n", ch->ch_vsi);
}
return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_trace.h b/drivers/net/ethernet/intel/ice/ice_trace.h
index 07aab6e130cd553fa1fcaa2feac9d14f0433239a..4f35ef8d6b299b4acd6c85992c2c93b164a88372 100644
--- a/drivers/net/ethernet/intel/ice/ice_trace.h
+++ b/drivers/net/ethernet/intel/ice/ice_trace.h
@@ -130,7 +130,7 @@ DECLARE_EVENT_CLASS(ice_tx_template,
__entry->buf = buf;
__assign_str(devname);),
- TP_printk("netdev: %s ring: %pK desc: %pK buf %pK", __get_str(devname),
+ TP_printk("netdev: %s ring: %p desc: %p buf %p", __get_str(devname),
__entry->ring, __entry->desc, __entry->buf)
);
@@ -158,7 +158,7 @@ DECLARE_EVENT_CLASS(ice_rx_template,
__entry->desc = desc;
__assign_str(devname);),
- TP_printk("netdev: %s ring: %pK desc: %pK", __get_str(devname),
+ TP_printk("netdev: %s ring: %p desc: %p", __get_str(devname),
__entry->ring, __entry->desc)
);
DEFINE_EVENT(ice_rx_template, ice_clean_rx_irq,
@@ -182,7 +182,7 @@ DECLARE_EVENT_CLASS(ice_rx_indicate_template,
__entry->skb = skb;
__assign_str(devname);),
- TP_printk("netdev: %s ring: %pK desc: %pK skb %pK", __get_str(devname),
+ TP_printk("netdev: %s ring: %p desc: %p skb %p", __get_str(devname),
__entry->ring, __entry->desc, __entry->skb)
);
@@ -205,7 +205,7 @@ DECLARE_EVENT_CLASS(ice_xmit_template,
__entry->skb = skb;
__assign_str(devname);),
- TP_printk("netdev: %s skb: %pK ring: %pK", __get_str(devname),
+ TP_printk("netdev: %s skb: %p ring: %p", __get_str(devname),
__entry->skb, __entry->ring)
);
@@ -228,7 +228,7 @@ DECLARE_EVENT_CLASS(ice_tx_tstamp_template,
TP_fast_assign(__entry->skb = skb;
__entry->idx = idx;),
- TP_printk("skb %pK idx %d",
+ TP_printk("skb %p idx %d",
__entry->skb, __entry->idx)
);
#define DEFINE_TX_TSTAMP_OP_EVENT(name) \
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next v5 2/2] net/mlx5: Don't use %pK through tracepoints
2025-08-11 9:43 [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 1/2] ice: " Thomas Weißschuh
@ 2025-08-11 9:43 ` Thomas Weißschuh
2025-08-11 23:59 ` [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Jacob Keller
2025-08-14 1:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2025-08-11 9:43 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Saeed Mahameed,
Leon Romanovsky, Tariq Toukan, Mark Bloch
Cc: intel-wired-lan, netdev, linux-kernel, linux-rdma,
Aleksandr Loktionov, Simon Horman, Paul Menzel,
Thomas Weißschuh
In the past %pK was preferable to %p as it would not leak raw pointer
values into the kernel log.
Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used
through tracepoints. They can still unintentionally leak raw pointers or
acquire sleeping locks in atomic contexts.
Switch to the regular pointer formatting which is safer and
easier to reason about.
There are still a few users of %pK left, but these use it through seq_file,
for which its usage is safe.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h
index 0537de86f9817dc80bd897688c539135b1ad37ac..9b0f44253f332aa602a84a1f6d7532a500dd4f55 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(mlx5_sf_dev_template,
__entry->hw_fn_id = sfdev->fn_id;
__entry->sfnum = sfdev->sfnum;
),
- TP_printk("(%s) sfdev=%pK aux_id=%d hw_id=0x%x sfnum=%u\n",
+ TP_printk("(%s) sfdev=%p aux_id=%d hw_id=0x%x sfnum=%u\n",
__get_str(devname), __entry->sfdev,
__entry->aux_id, __entry->hw_fn_id,
__entry->sfnum)
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints
2025-08-11 9:43 [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 1/2] ice: " Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 2/2] net/mlx5: Don't use %pK through tracepoints Thomas Weißschuh
@ 2025-08-11 23:59 ` Jacob Keller
2025-08-14 1:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2025-08-11 23:59 UTC (permalink / raw)
To: Thomas Weißschuh, Tony Nguyen, Przemek Kitszel, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch
Cc: intel-wired-lan, netdev, linux-kernel, linux-rdma,
Aleksandr Loktionov, Simon Horman, Paul Menzel
[-- Attachment #1.1: Type: text/plain, Size: 1037 bytes --]
On 8/11/2025 2:43 AM, Thomas Weißschuh wrote:
> In the past %pK was preferable to %p as it would not leak raw pointer
> values into the kernel log.
> Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
> the regular %p has been improved to avoid this issue.
> Furthermore, restricted pointers ("%pK") were never meant to be used
> through printk(). They can still unintentionally leak raw pointers or
> acquire sleeping locks in atomic contexts.
>
> Switch to the regular pointer formatting which is safer and
> easier to reason about.
> There are still a few users of %pK left, but these use it through seq_file,
> for which its usage is safe.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> Changes in v5:
> - Rebase on v6.17-rc1
> - Bick up Reviewed-by from Paul
> - Link to v4: https://lore.kernel.org/r/20250718-restricted-pointers-net-v4-0-4baa64e40658@linutronix.de
>
Thanks for fixing these up!
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints
2025-08-11 9:43 [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Thomas Weißschuh
` (2 preceding siblings ...)
2025-08-11 23:59 ` [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Jacob Keller
@ 2025-08-14 1:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-14 1:30 UTC (permalink / raw)
To: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=3Cthomas=2Eweissschuh=40linutronix=2Ede=3E?=
Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
edumazet, kuba, pabeni, saeedm, leon, tariqt, mbloch,
intel-wired-lan, netdev, linux-kernel, linux-rdma,
aleksandr.loktionov, horms, pmenzel
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 11 Aug 2025 11:43:17 +0200 you wrote:
> In the past %pK was preferable to %p as it would not leak raw pointer
> values into the kernel log.
> Since commit ad67b74d2469 ("printk: hash addresses printed with %p")
> the regular %p has been improved to avoid this issue.
> Furthermore, restricted pointers ("%pK") were never meant to be used
> through printk(). They can still unintentionally leak raw pointers or
> acquire sleeping locks in atomic contexts.
>
> [...]
Here is the summary with links:
- [net-next,v5,1/2] ice: Don't use %pK through printk or tracepoints
https://git.kernel.org/netdev/net-next/c/66ceb45b7d7e
- [net-next,v5,2/2] net/mlx5: Don't use %pK through tracepoints
https://git.kernel.org/netdev/net-next/c/e2068f74b976
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-14 1:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 9:43 [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 1/2] ice: " Thomas Weißschuh
2025-08-11 9:43 ` [PATCH net-next v5 2/2] net/mlx5: Don't use %pK through tracepoints Thomas Weißschuh
2025-08-11 23:59 ` [PATCH net-next v5 0/2] net: Don't use %pK through printk or tracepoints Jacob Keller
2025-08-14 1:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).