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] [day] [month] [year] [list]
Message-ID: <CAADnVQL=FSax6b1qOG5G=9Lz-FScQWHAS=YZ+=b86Skvyeqing@mail.gmail.com>
Date: Thu, 9 Oct 2025 08:38:28 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: chensong_2000@....cn
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	John Fastabend <john.fastabend@...il.com>, Andrii Nakryiko <andrii@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>, 
	Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, 
	bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/bpf/syscall: use IS_FD_HASH in bpf_map_update_value

On Wed, Oct 8, 2025 at 11:23 PM <chensong_2000@....cn> wrote:
>
> From: Song Chen <chensong_2000@....cn>
>
> If IS_FD_HASH is defined on the top of the file, then use it to replace
> "map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS".
>
> Signed-off-by: Song Chen <chensong_2000@....cn>
> ---
>  kernel/bpf/syscall.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 0fbfa8532c39..2c194a73aeda 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -154,8 +154,7 @@ static void maybe_wait_bpf_programs(struct bpf_map *map)
>          * time can be very long and userspace may think it will hang forever,
>          * so don't handle sleepable BPF programs now.
>          */
> -       if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS ||
> -           map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
> +       if (IS_FD_HASH(map) || map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
>                 synchronize_rcu();
>  }
>
> @@ -274,7 +273,7 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
>         } else if (IS_FD_ARRAY(map)) {
>                 err = bpf_fd_array_map_update_elem(map, map_file, key, value,
>                                                    flags);
> -       } else if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS) {
> +       } else if (/(map)) {

Let's not. It only obfuscates the code in this case.

pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ