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]
Date: Thu, 14 Dec 2023 19:23:58 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, pabeni@...hat.com, davem@...emloft.net,
 edumazet@...gle.com, jacob.e.keller@...el.com, jhs@...atatu.com,
 johannes@...solutions.net, andriy.shevchenko@...ux.intel.com,
 amritha.nambiar@...el.com, sdf@...gle.com, horms@...nel.org,
 przemyslaw.kitszel@...el.com
Subject: Re: [patch net-next v7 5/9] genetlink: introduce per-sock family
 private storage

On Thu, 14 Dec 2023 19:15:45 +0100 Jiri Pirko wrote:
> - converted family->sock_priv_list to family->sock_privs xarray
>   and use it to store the per-socket privs, use sock pointer as
>   an xarrar index. This made the code much simpler

Nice! 

FWIW I think I remember Willy saying that storing pointers in xarray is
comparatively inefficient / slow, but we can cross that bridge later.

> +void *__genl_sk_priv_get(struct genl_family *family, struct sock *sk)
> +{
> +	if (WARN_ON_ONCE(!family->sock_privs))
> +		return NULL;
> +	return xa_load(family->sock_privs, (unsigned long) sk);
> +}
> +
> +/**
> + * genl_sk_priv_get - Get family private pointer for socket
> + *
> + * @family: family
> + * @sk: socket
> + *
> + * Lookup a private memory for a Generic netlink family and specified socket.
> + * Allocate the private memory in case it was not already done.
> + *
> + * Return: valid pointer on success, otherwise negative error value
> + * encoded by ERR_PTR().

nit: probably better if __genl_sk_priv_get() returned an error pointer
     if family is broken, save ourselves the bot-generated "fixes"..

> + */
> +void *genl_sk_priv_get(struct genl_family *family, struct sock *sk)
> +{
> +	void *priv, *old_priv;
> +
> +	priv = __genl_sk_priv_get(family, sk);
> +	if (priv)
> +		return priv;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ