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: <87zg0mofiv.fsf@nvidia.com>
Date: Fri, 13 Oct 2023 14:43:05 +0200
From: Petr Machata <petrm@...dia.com>
To: Christoph Paasch <cpaasch@...le.com>
CC: <netdev@...r.kernel.org>, David Miller <davem@...emloft.net>, Paolo Abeni
	<pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>, Petr Machata
	<petrm@...dia.com>, Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net] netlink: Correct offload_xstats size


Christoph Paasch <cpaasch@...le.com> writes:

> rtnl_offload_xstats_get_size_hw_s_info_one() conditionalizes the
> size-computation for IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED based on whether
> or not the device has offload_xstats enabled.
>
> However, rtnl_offload_xstats_fill_hw_s_info_one() is adding the u8 for
> that field uncondtionally.

> Which didn't happen prior to commit bf9f1baa279f ("net: add dedicated
> kmem_cache for typical/small skb->head") as the skb always was large
> enough.
>
> Cc: Petr Machata <petrm@...dia.com>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Fixes: 0e7788fd7622 ("net: rtnetlink: Add UAPI for obtaining L3 offload xstats")
> Signed-off-by: Christoph Paasch <cpaasch@...le.com>
> ---
>
> Notes:
>     Another fix would be to make rtnl_offload_xstats_fill_hw_s_info_one()
>     check whether the device has offload_xstats enabled. Let me know if that
>     is a preferred route.

I think I decided that it's going to be useful to get the info always,
but then neglected to update the size computation. So this fix looks
good to me. Also, it maintains the same behavior as before, minus the
size computation bug.

Reviewed-by: Petr Machata <petrm@...dia.com>

>
>  net/core/rtnetlink.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 4a2ec33bfb51..53c377d054f0 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -5503,13 +5503,11 @@ static unsigned int
>  rtnl_offload_xstats_get_size_hw_s_info_one(const struct net_device *dev,
>  					   enum netdev_offload_xstats_type type)
>  {
> -	bool enabled = netdev_offload_xstats_enabled(dev, type);
> -
>  	return nla_total_size(0) +
>  		/* IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST */
>  		nla_total_size(sizeof(u8)) +
>  		/* IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED */
> -		(enabled ? nla_total_size(sizeof(u8)) : 0) +
> +		nla_total_size(sizeof(u8)) +
>  		0;
>  }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ