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] [day] [month] [year] [list]
Message-ID: <3379803.44csPzL39Z@7950hx>
Date: Tue, 07 Oct 2025 11:49:42 +0800
From: Menglong Dong <menglong.dong@...ux.dev>
To: Fushuai Wang <wangfushuai@...du.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, horms@...nel.org, ast@...nel.org, martin.lau@...nel.org,
 houtao1@...wei.com, jkangas@...hat.com, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org, Fushuai Wang <wangfushuai@...du.com>,
 bpf@...r.kernel.org
Subject:
 Re: [PATCH bpf-next] bpf: Use rcu_read_lock_dont_migrate() and and
 rcu_read_unlock_migrate()

On 2025/10/5 23:08, Fushuai Wang wrote:
> Replace the combination of migrate_disable()/migrate_enable() and rcu_read_lock()/rcu_read_unlock()
> with rcu_read_lock_dont_migrate()/rcu_read_unlock_migrate() in bpf_sk_storage.c.

Hi, Fushuai. There are some nits in you patch:

1. The title is too fuzzy. It can be
    "bpf: Use rcu_read_lock_dont_migrate in bpf_sk_storage.c"
2. You can wrap the commit log and don't exceed 75 character per line.
    This is not necessary, but it can stop the check_patch from
    complaining.

And I think you shoud CC bpf@...r.kernel.org too. Before you
send the patch, you can check it with ./scripts/checkpatch.pl to
find potential problems.

Thanks!
Menglong Dong

> 
> Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
> ---
>  net/core/bpf_sk_storage.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c
> index 2e538399757f..bdb70cf89ae1 100644
> --- a/net/core/bpf_sk_storage.c
> +++ b/net/core/bpf_sk_storage.c
> @@ -50,16 +50,14 @@ void bpf_sk_storage_free(struct sock *sk)
>  {
>  	struct bpf_local_storage *sk_storage;
>  
> -	migrate_disable();
> -	rcu_read_lock();
> +	rcu_read_lock_dont_migrate();
>  	sk_storage = rcu_dereference(sk->sk_bpf_storage);
>  	if (!sk_storage)
>  		goto out;
>  
>  	bpf_local_storage_destroy(sk_storage);
>  out:
> -	rcu_read_unlock();
> -	migrate_enable();
> +	rcu_read_unlock_migrate();
>  }
>  
>  static void bpf_sk_storage_map_free(struct bpf_map *map)
> @@ -161,8 +159,7 @@ int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk)
>  
>  	RCU_INIT_POINTER(newsk->sk_bpf_storage, NULL);
>  
> -	migrate_disable();
> -	rcu_read_lock();
> +	rcu_read_lock_dont_migrate();
>  	sk_storage = rcu_dereference(sk->sk_bpf_storage);
>  
>  	if (!sk_storage || hlist_empty(&sk_storage->list))
> @@ -213,9 +210,8 @@ int bpf_sk_storage_clone(const struct sock *sk, struct sock *newsk)
>  	}
>  
>  out:
> -	rcu_read_unlock();
> -	migrate_enable();
>  
> +	rcu_read_unlock_migrate();
>  	/* In case of an error, don't free anything explicitly here, the
>  	 * caller is responsible to call bpf_sk_storage_free.
>  	 */
> 





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ