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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250701174612.55d55715@kernel.org>
Date: Tue, 1 Jul 2025 17:46:12 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Paolo Abeni
 <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Kuniyuki Iwashima
 <kuniyu@...gle.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next] net: remove RTNL use for
 /proc/sys/net/core/rps_default_mask

On Fri, 27 Jun 2025 13:08:39 +0000 Eric Dumazet wrote:
> diff --git a/net/core/net-sysfs.h b/net/core/net-sysfs.h
> index 8a5b04c2699aaee13ccc3a5b1543eecd0fc10d29..ff3440d721963b2f90b6a83666a63b3f95e61421 100644
> --- a/net/core/net-sysfs.h
> +++ b/net/core/net-sysfs.h
> @@ -11,4 +11,8 @@ int netdev_queue_update_kobjects(struct net_device *net,
>  int netdev_change_owner(struct net_device *, const struct net *net_old,
>  			const struct net *net_new);
>  
> +#if IS_ENABLED(CONFIG_SYSCTL) && IS_ENABLED(CONFIG_RPS)
> +extern struct mutex rps_default_mask_mutex;
> +#endif

Perhaps subjective but hiding definitions under ifdefs often forces
the ifdef to spread, IOW it prevents us from using:

	if (IS_ENABLED(CONFIG_..))

and relying on compiler to remove the dead code. So I'd skip the ifdef.

>  #endif
> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> index 5dbb2c6f371defbf79d4581f9b6c1c3fb13fa9d9..672520e43fefadf4c8c667ff6c77acf3935bc567 100644
> --- a/net/core/sysctl_net_core.c
> +++ b/net/core/sysctl_net_core.c
> @@ -96,50 +96,40 @@ static int dump_cpumask(void *buffer, size_t *lenp, loff_t *ppos,
>  
>  #ifdef CONFIG_RPS
>  
> -static struct cpumask *rps_default_mask_cow_alloc(struct net *net)
> -{
> -	struct cpumask *rps_default_mask;
> -
> -	if (net->core.rps_default_mask)
> -		return net->core.rps_default_mask;
> -
> -	rps_default_mask = kzalloc(cpumask_size(), GFP_KERNEL);
> -	if (!rps_default_mask)
> -		return NULL;
> -
> -	/* pairs with READ_ONCE in rx_queue_default_mask() */
> -	WRITE_ONCE(net->core.rps_default_mask, rps_default_mask);
> -	return rps_default_mask;
> -}
> +DEFINE_MUTEX(rps_default_mask_mutex);

nit: sparse says ../sysfs.h is not included here so it doesn't see the
declaration for the header:

net/core/sysctl_net_core.c:99:1: warning: symbol 'rps_default_mask_mutex' was not declared. Should it be static?
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ