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: <c3472d5f-54da-2e20-2c3c-3f6690de6f04@iogearbox.net>
Date:   Tue, 24 Nov 2020 23:11:05 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Zhu Yanjun <yanjunz@...dia.com>, magnus.karlsson@...el.com,
        bjorn.topel@...el.com, davem@...emloft.net, netdev@...r.kernel.org
Cc:     Zhu Yanjun <zyjzyj2000@...il.com>
Subject: Re: [PATCH v3 1/1] xdp: remove the function xsk_map_inc

On 11/23/20 4:05 PM, Zhu Yanjun wrote:
> From: Zhu Yanjun <zyjzyj2000@...il.com>
> 
> The function xsk_map_inc is a simple wrapper of bpf_map_inc and
> always returns zero. As such, replacing this function with bpf_map_inc
> and removing the test code.
> 
> Signed-off-by: Zhu Yanjun <zyjzyj2000@...il.com>
> ---
>   net/xdp/xsk.c    |  2 +-
>   net/xdp/xsk.h    |  1 -
>   net/xdp/xskmap.c | 13 +------------
>   3 files changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index cfbec3989a76..a3c1f07d77d8 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -548,7 +548,7 @@ static struct xsk_map *xsk_get_map_list_entry(struct xdp_sock *xs,
>   	node = list_first_entry_or_null(&xs->map_list, struct xsk_map_node,
>   					node);
>   	if (node) {
> -		WARN_ON(xsk_map_inc(node->map));
> +		bpf_map_inc(&node->map->map);
>   		map = node->map;
>   		*map_entry = node->map_entry;
>   	}
> diff --git a/net/xdp/xsk.h b/net/xdp/xsk.h
> index b9e896cee5bb..0aad25c0e223 100644
> --- a/net/xdp/xsk.h
> +++ b/net/xdp/xsk.h
> @@ -41,7 +41,6 @@ static inline struct xdp_sock *xdp_sk(struct sock *sk)
>   
>   void xsk_map_try_sock_delete(struct xsk_map *map, struct xdp_sock *xs,
>   			     struct xdp_sock **map_entry);
> -int xsk_map_inc(struct xsk_map *map);
>   void xsk_map_put(struct xsk_map *map);
>   void xsk_clear_pool_at_qid(struct net_device *dev, u16 queue_id);
>   int xsk_reg_pool_at_qid(struct net_device *dev, struct xsk_buff_pool *pool,
> diff --git a/net/xdp/xskmap.c b/net/xdp/xskmap.c
> index 49da2b8ace8b..6b7e9a72b101 100644
> --- a/net/xdp/xskmap.c
> +++ b/net/xdp/xskmap.c
> @@ -11,12 +11,6 @@
>   
>   #include "xsk.h"
>   
> -int xsk_map_inc(struct xsk_map *map)
> -{
> -	bpf_map_inc(&map->map);
> -	return 0;
> -}
> -
>   void xsk_map_put(struct xsk_map *map)
>   {

So, the xsk_map_put() is defined as:

   void xsk_map_put(struct xsk_map *map)
   {
         bpf_map_put(&map->map);
   }

What is the reason to get rid of xsk_map_inc() but not xsk_map_put() wrapper?
Can't we just remove both while we're at it?

Thanks,
Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ