Skip to contentSkip to conversation

ref_tracker: use %p instead of %px in debugfs dentry name

PATCH RESEND Applied Jeff Layton 4 participants 4 messages Aug 8, 2025 – Nov 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ref_tracker: use %p instead of %px in debugfs dentry name

As Kees points out, this is a kernel address leak, and debugging is not a sufficiently good reason to expose the real kernel address.

Fixes 65b584f53611 ("ref_tracker: automatically register a file in debugfs for a ref_tracker_dir")

---
Resending since I didn't get a response from Andrew. This time I've included netdev in the mailing list in case Jakub wants to pick this up instead.

---
 lib/ref_tracker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ref_tracker.c +1 -1
index a9e6ffcff04b1da162a5a6add6bff075c2c9405e..cce12287708ea43e9eda9fe42f82a80423cea4e3 100644
@@ -434,7 +434,7 @@ void ref_tracker_dir_debugfs(struct ref_tracker_dir *dir)
 	if (dentry && !xa_is_err(dentry))
 		return;
 
-	ret = snprintf(name, sizeof(name), "%s@%px", dir->class, dir);
+	ret = snprintf(name, sizeof(name), "%s@%p", dir->class, dir);
 	name[sizeof(name) - 1] = '\0';
 
 	if (ret < sizeof(name)) {

---
base-commit: 260f6f4fda93c8485c8037865c941b42b9cba5d2
change-id: 20250731-reftrack-dbgfs-f99ad92068bc

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jeff Layton

As Kees points out, this is a kernel address leak, and debugging is not a sufficiently good reason to expose the real kernel address.

Fixes 65b584f53611 ("ref_tracker: automatically register a file in debugfs for a ref_tracker_dir")

---

#2 lore raw
In reply to Jeff Layton
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Fri, 08 Aug 2025 07:45:23 -0400 you wrote:

As Kees points out, this is a kernel address leak, and debugging is not a sufficiently good reason to expose the real kernel address.

Fixes 65b584f53611 ("ref_tracker: automatically register a file in debugfs for a ref_tracker_dir")

[...]

Here is the summary with links:
- [RESEND] ref_tracker: use %p instead of %px in debugfs dentry name

    https://git.kernel.org/netdev/net/c/52966bf71de9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Jeff Layton
Quoted 20 lines · Jeff Layton

As Kees points out, this is a kernel address leak, and debugging is not a sufficiently good reason to expose the real kernel address.

Fixes 65b584f53611 ("ref_tracker: automatically register a file in debugfs for a ref_tracker_dir")

---
Resending since I didn't get a response from Andrew. This time I've included netdev in the mailing list in case Jakub wants to pick this up instead.

---
 lib/ref_tracker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ref_tracker.c +0 -0
index a9e6ffcff04b1da162a5a6add6bff075c2c9405e..cce12287708ea43e9eda9fe42f82a80423cea4e3 100644

lib/ref_tracker.c void ref_tracker_dir_debugfs(struct ref_tracker_dir *dir) · line 437

Quoted 5 lines
lib/ref_tracker.c +1 -1
@@ -434,7 +434,7 @@ void ref_tracker_dir_debugfs(struct ref_tracker_dir *dir)
 	if (dentry && !xa_is_err(dentry))
 		return;
 
-	ret = snprintf(name, sizeof(name), "%s@%px", dir->class, dir);
+	ret = snprintf(name, sizeof(name), "%s@%p", dir->class, dir);

This now results in attempts to register the same nonsense looking debugfs file multiple times, which leads to errors in dmesg:
"debugfs: 'netdev@(____ptrval____)' already exists in 'ref_tracker'"

And we end up with a single file instead the one per network interface (or whatever it was trying to achieve here):

 # tree /sys/kernel/debug/ref_tracker/
 /sys/kernel/debug/ref_tracker/
 └── netdev@(____ptrval____)
Quoted 12 lines
lib/ref_tracker.c +0 -1
 	name[sizeof(name) - 1] = '\0';
 
 	if (ret < sizeof(name)) {
 
---

base-commit: 260f6f4fda93c8485c8037865c941b42b9cba5d2
change-id: 20250731-reftrack-dbgfs-f99ad92068bc

Best regards,

Signature · 1 line
Jeff Layton <[email protected]>
Signature · 2 lines
Ville Syrjälä
Intel