From nobody Sun Oct 5 01:45:14 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41DC31F4E59; Mon, 11 Aug 2025 09:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754905411; cv=none; b=posaJ5pUpa6kWgstlDHB0voSO5iMM+az0znQcYmVEOz+9RwKl90PhiV9HfUQYHn5XfgEIpSMJJLUF3jia+NVQjGdttHb4RpRBjVEoXXscL+btMPda16X+kFBuhOLxR+wUvVwDzrlPqBvx5GD1XTQu2lNa56jgFjW5HFaJ80o2Vk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754905411; c=relaxed/simple; bh=T7FC9rutQZGsiSkiu1zAZb/dBlfuJq8IFe85Y1+xvHk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g/609SCV5z10ofOHy7vgPPuwBdcavjZfg4qBdqrqESlSRTNV/wL3KZx1DRiOVycxjNVby/mB58qdaXsGzd2VTGNzIfRGicJUkagt9ZHPheeBC+WZRqpb9SpsiGNRC1RPeAJoPjOqIBaBnkrOfumGz3K9zdXMNXqfv0leff+Qpx4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=O8ialkK2; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=t7OVbk4M; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O8ialkK2"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="t7OVbk4M" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1754905408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5JZnt0Ku0ytDK5JOMZavp4kcCh/ydTN+qKpiPT34+tE=; b=O8ialkK2fXxYKKOcWAyLqkhIYevDp9nZY4X8MQEezdIe/h66gFInzW5YfyLFkGGy6dGpZB NiFZVwmaMd072+8qT9yZCsr+KmgRiSRO2Rizwrr/9dOSplbsz94o95F9i+8qp8trgqDJkP eGXMjoZkR3ng2KxKXtdKKPpRMaO0LQn0h43q5dnBGDMIT8QDR/AjBcCJILDrHfXhkSFRr7 7ljhqEUToGmninxbaD/vHAgrO+iiu9eQgUoF/9zUlPMJYENZwT4Y99mTZyHpbZFdHV/XiU azNQkFxOJ5KFb4yefIP33xjgT3koyRUcVhTA2ADeJPgJGt/1bfx5TaBkWizZxw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1754905408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5JZnt0Ku0ytDK5JOMZavp4kcCh/ydTN+qKpiPT34+tE=; b=t7OVbk4MDYbptjzl/Sbp2zrCi+Deu88cU47eRGI5pn92vtxzzMR/sgNSnqXgboDXNcGVgJ F7EOEz1MrLMwD3CA== Date: Mon, 11 Aug 2025 11:43:18 +0200 Subject: [PATCH net-next v5 1/2] ice: Don't use %pK through printk or tracepoints Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250811-restricted-pointers-net-v5-1-2e2fdc7d3f2c@linutronix.de> References: <20250811-restricted-pointers-net-v5-0-2e2fdc7d3f2c@linutronix.de> In-Reply-To: <20250811-restricted-pointers-net-v5-0-2e2fdc7d3f2c@linutronix.de> 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@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Aleksandr Loktionov , Simon Horman , Paul Menzel , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1754905404; l=3684; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=T7FC9rutQZGsiSkiu1zAZb/dBlfuJq8IFe85Y1+xvHk=; b=mKlILFF7kSO3ybDXAeYwn5R/RnSczRsC9Z68XhaG4rZrL53qaeKK0nOYQOBX+XKuTSQQQOaSK y3cZTZbMkMtA+eN58wx+B7QzVKbfc4Uw8SsvZSUk58EvhmgRBqxwTdc X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= 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=C3=9Fschuh Acked-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Reviewed-by: Simon Horman Reviewed-by: Paul Menzel Reviewed-by: Jacob Keller --- 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/ethern= et/intel/ice/ice_main.c index 8e0b06c1e02b2a0ca25bd6f30395cc237e8c541e..93c6e64ed9404e48be5fedd5f78= 87a1bca8dda0e 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] =3D 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; =20 diff --git a/drivers/net/ethernet/intel/ice/ice_trace.h b/drivers/net/ether= net/intel/ice/ice_trace.h index 07aab6e130cd553fa1fcaa2feac9d14f0433239a..4f35ef8d6b299b4acd6c85992c2= c93b164a88372 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 =3D buf; __assign_str(devname);), =20 - TP_printk("netdev: %s ring: %pK desc: %pK buf %pK", __get_str(devnam= e), + TP_printk("netdev: %s ring: %p desc: %p buf %p", __get_str(devname), __entry->ring, __entry->desc, __entry->buf) ); =20 @@ -158,7 +158,7 @@ DECLARE_EVENT_CLASS(ice_rx_template, __entry->desc =3D desc; __assign_str(devname);), =20 - 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 =3D skb; __assign_str(devname);), =20 - TP_printk("netdev: %s ring: %pK desc: %pK skb %pK", __get_str(devnam= e), + TP_printk("netdev: %s ring: %p desc: %p skb %p", __get_str(devname), __entry->ring, __entry->desc, __entry->skb) ); =20 @@ -205,7 +205,7 @@ DECLARE_EVENT_CLASS(ice_xmit_template, __entry->skb =3D skb; __assign_str(devname);), =20 - 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) ); =20 @@ -228,7 +228,7 @@ DECLARE_EVENT_CLASS(ice_tx_tstamp_template, TP_fast_assign(__entry->skb =3D skb; __entry->idx =3D idx;), =20 - TP_printk("skb %pK idx %d", + TP_printk("skb %p idx %d", __entry->skb, __entry->idx) ); #define DEFINE_TX_TSTAMP_OP_EVENT(name) \ --=20 2.50.1 From nobody Sun Oct 5 01:45:14 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58DD62DD5E0; Mon, 11 Aug 2025 09:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754905411; cv=none; b=MPowzdACSroaqqRmZlJB6iWX7irLE3+V6moXKJqzup3rXEVF7vRllxbiZBUIuHSwXaza2ENKq9T0FH5jZjUTzNsgHmwrvQQYraY/yhflBxXO9LUnKs893nWFOj5/YFDXdbmUaF/gxVrao3i+JvJLNzkvOwX6y8fDys6lvi5gfMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754905411; c=relaxed/simple; bh=R1wk1yI3kHdZ7b3M38TExwDnKAtQ2lEAsVfqoGYAhQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sNKWW+8pYfPinYZ83x3BV/oSC4cQvBF6oC2MfxoVT9TTQScCSykH/XIJUquRZSmcWo+nYCgyjh98GYuKf6kiL29JG/bjQ+ERjq8PzD8biZGC2mdW548GOzURNxm0pvLOMRfDryl7vuBrgPLnwrIZo0iyt5409MUGDi1krOwx/as= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qxcuOZfB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1iNUsZA0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qxcuOZfB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1iNUsZA0" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1754905408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l7t/hJpLZL9a29LQoJFY/OvuUjqQAza1kYKvckTHXaI=; b=qxcuOZfBB9DR2m4PBOhYb9x/va1gwxkXs2aGvUlhoO/bUget9N3YS5cNYM5fUmj149LAOe BqFJgTjkjTsvph+FUmKBn6JXynlKxttSgpcFq5C/FWxR9kitke9mquGU1KIUn+WRdGYSZw EvBpU2R6qbD/YqUSfehoRh5I5FEdAY0YOXj0ZqHgczuUdnGlEe3gtM3jFhwVrG0+ZDbyuf kMBjQ49F07+eBeWHNmDM36LCMGoCdCvogqG2dTKxcEetQl2lP/eY0CaryfxygyGmGz19z8 gNMgXmHejf8NO5sTrZTjLsOFLPAkmleYTta4ssJZmEuTohgjwKrUEvy9c0yqSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1754905408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l7t/hJpLZL9a29LQoJFY/OvuUjqQAza1kYKvckTHXaI=; b=1iNUsZA0Dsv3SCLGiL2lwuq7tlUathk4gu7tAwMuTMWl4QlMFkLim3abWm3T7U7ijhFSGu tCCn9DaKwKwypbDQ== Date: Mon, 11 Aug 2025 11:43:19 +0200 Subject: [PATCH net-next v5 2/2] net/mlx5: Don't use %pK through tracepoints Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250811-restricted-pointers-net-v5-2-2e2fdc7d3f2c@linutronix.de> References: <20250811-restricted-pointers-net-v5-0-2e2fdc7d3f2c@linutronix.de> In-Reply-To: <20250811-restricted-pointers-net-v5-0-2e2fdc7d3f2c@linutronix.de> 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@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Aleksandr Loktionov , Simon Horman , Paul Menzel , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1754905404; l=1849; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=R1wk1yI3kHdZ7b3M38TExwDnKAtQ2lEAsVfqoGYAhQc=; b=6UPHoiJhSPpGmb/061Ob7xHhfAakKowmdb1LmSyBYr3RLzmr3od6wG7u9hxnoYtCryrvigJDU lszTqbo35PzA5okI63amZ81CIHpdrMR9lUurslOXwsV4ZQPQLDW3NI+ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= 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=C3=9Fschuh Reviewed-by: Aleksandr Loktionov Reviewed-by: Tariq Toukan Reviewed-by: Simon Horman Reviewed-by: Paul Menzel Reviewed-by: Jacob Keller --- 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_tracep= oint.h b/drivers/net/ethernet/mellanox/mlx5/core/sf/dev/diag/dev_tracepoint= .h index 0537de86f9817dc80bd897688c539135b1ad37ac..9b0f44253f332aa602a84a1f6d7= 532a500dd4f55 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 =3D sfdev->fn_id; __entry->sfnum =3D sfdev->sfnum; ), - TP_printk("(%s) sfdev=3D%pK aux_id=3D%d hw_id=3D0x%x sfnum=3D%u\n", + TP_printk("(%s) sfdev=3D%p aux_id=3D%d hw_id=3D0x%x sfnum=3D%u\n", __get_str(devname), __entry->sfdev, __entry->aux_id, __entry->hw_fn_id, __entry->sfnum) --=20 2.50.1