lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4722246-5694-4b1a-9b1b-d4352fa54ee7@lunn.ch>
Date: Thu, 10 Apr 2025 16:12:09 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jeff Layton <jlayton@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] net: add debugfs files for showing netns refcount
 tracking info

> Oh, ok. I guess you mean these names?
> 
>         ref_tracker_dir_init(&net->refcnt_tracker, 128, "net refcnt");
>         ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net notrefcnt");
> 
> Two problems there:
> 
> 1/ they have an embedded space in the name which is just painful. Maybe we can replace those with underscores?
> 2/ they aren't named in a per-net namespace way

So the first question is, are the names ABI? Are they exposed to
userspace anywhere? Can we change them?

If we can change them, space to _ is a simple change. Another option
is what hwmon does, hwmon_sanitize_name() which turns a name into
something which is legal in a filesystem. If all of this code can be
pushed into the core tracker, so all trackers appear in debugfs, such
a sanitiser is the way i would go.

And if we can change the name, putting the netns into the name would
also work. There is then no need for the directory, if they have
unique names.

Looking at other users of ref_tracker_dir_init():

~/linux$ grep -r ref_tracker_dir_init
lib/test_ref_tracker.c:	ref_tracker_dir_init(&ref_dir, 100, "selftest");

Can only be loaded once, so is unique.

drivers/gpu/drm/i915/intel_wakeref.c:	ref_tracker_dir_init(&wf->debug, INTEL_REFTRACK_DEAD_COUNT, name);

Looks like it is unique for one GPU, but if you have multiple GPUs
they are not unique.

drivers/gpu/drm/i915/intel_runtime_pm.c:	ref_tracker_dir_init(&rpm->debug, INTEL_REFTRACK_DEAD_COUNT, dev_name(rpm->kdev));

At a guess kdev is unique.

drivers/gpu/drm/display/drm_dp_tunnel.c:	ref_tracker_dir_init(&mgr->ref_tracker, 16, "dptun");

Probably not unique.

net/core/net_namespace.c:	ref_tracker_dir_init(&net->refcnt_tracker, 128, "net refcnt");
net/core/net_namespace.c:	ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net notrefcnt");

Not unique across name spaces, but ...

So could the tracker core check if the debugfs file already exists,
emit a warning if it does, and keep going? I think debugfs_lookup()
will tell you if a file already exists, or debugfs_create_file() will
return -EEXIST, which is probably safer, no race condition.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ