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: <48FE07AD-06AA-4D01-88D8-FAE628AF281B@isovalent.com>
Date: Fri, 12 Jan 2024 15:59:44 -0800
From: Aditi Ghag <aditi.ghag@...valent.com>
To: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: bpf@...r.kernel.org,
 Alexei Starovoitov <ast@...nel.org>,
 Andrii Nakryiko <andrii@...nel.org>,
 Daniel Borkmann <daniel@...earbox.net>,
 netdev@...r.kernel.org,
 kernel-team@...a.com,
 Yonghong Song <yonghong.song@...ux.dev>
Subject: Re: [PATCH v3 bpf 1/3] bpf: iter_udp: Retry with a larger batch size
 without going back to the previous bucket



> On Jan 12, 2024, at 11:05 AM, Martin KaFai Lau <martin.lau@...ux.dev> wrote:
> 
> From: Martin KaFai Lau <martin.lau@...nel.org>
> 
> The current logic is to use a default size 16 to batch the whole bucket.
> If it is too small, it will retry with a larger batch size.
> 
> The current code accidentally does a state->bucket-- before retrying.
> This goes back to retry with the previous bucket which has already
> been done. This patch fixed it.
> 
> It is hard to create a selftest. I added a WARN_ON(state->bucket < 0),
> forced a particular port to be hashed to the first bucket,
> created >16 sockets, and observed the for-loop went back
> to the "-1" bucket.
> 
> Cc: Aditi Ghag <aditi.ghag@...valent.com>
> Fixes: c96dac8d369f ("bpf: udp: Implement batching for sockets iterator")
> Acked-by: Yonghong Song <yonghong.song@...ux.dev>
> Signed-off-by: Martin KaFai Lau <martin.lau@...nel.org>

Reviewed-by: Aditi Ghag <aditi.ghag@...valent.com>
LGTM!

> ---
> net/ipv4/udp.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 89e5a806b82e..978b83d3c094 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -3213,7 +3213,6 @@ static struct sock *bpf_iter_udp_batch(struct seq_file *seq)
> 		/* After allocating a larger batch, retry one more time to grab
> 		 * the whole bucket.
> 		 */
> -		state->bucket--;
> 		goto again;
> 	}
> done:
> -- 
> 2.34.1
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ