ref_tracker: use %p instead of %px in debugfs dentry name
Subsystems (3)
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.
---
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
@@ -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]>
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")Reported-by Kees Cook <[email protected]>Signed-off-by Jeff Layton <[email protected]>---
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")Reported-by Kees Cook <[email protected]>Signed-off-by Jeff Layton <[email protected]>[...]
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
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")Reported-by Kees Cook <[email protected]>Signed-off-by Jeff Layton <[email protected]>---
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
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
-1name[sizeof (name) -1 ] ='\0' ;if (ret <sizeof (name)) { ---base-commit:
260f6f4fda93c8485c8037865c941b42b9cba5d2
change-id: 20250731-reftrack-dbgfs-f99ad92068bcBest regards,
Signature · 1 line
Jeff Layton <[email protected]>
Signature · 2 lines
Ville Syrjälä Intel