bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] bpf: Add missing map_get_next_key method to bloom filter map
@ 2021-12-29 11:20 tcs.kernel
  2021-12-29 17:21 ` Joanne Koong
  0 siblings, 1 reply; 3+ messages in thread
From: tcs.kernel @ 2021-12-29 11:20 UTC (permalink / raw)
  To: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, joannekoong, bpf
  Cc: Haimin Zhang

From: Haimin Zhang <tcs_kernel@tencent.com>

Without it, kernel crashes in map_get_next_key().

Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")

Reported-by: TCS Robot <tcs_robot@tencent.com>
Signed-off-by: Haimin Zhang <tcs_kernel@tencent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
 kernel/bpf/bloom_filter.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/bpf/bloom_filter.c b/kernel/bpf/bloom_filter.c
index 277a05e9c984..fa34dc871995 100644
--- a/kernel/bpf/bloom_filter.c
+++ b/kernel/bpf/bloom_filter.c
@@ -82,6 +82,11 @@ static int bloom_map_delete_elem(struct bpf_map *map, void *value)
 	return -EOPNOTSUPP;
 }
 
+static int bloom_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
+{
+	return -EOPNOTSUPP;
+}
+
 static struct bpf_map *bloom_map_alloc(union bpf_attr *attr)
 {
 	u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
@@ -192,6 +197,7 @@ const struct bpf_map_ops bloom_filter_map_ops = {
 	.map_meta_equal = bpf_map_meta_equal,
 	.map_alloc = bloom_map_alloc,
 	.map_free = bloom_map_free,
+	.map_get_next_key = bloom_map_get_next_key,
 	.map_push_elem = bloom_map_push_elem,
 	.map_peek_elem = bloom_map_peek_elem,
 	.map_pop_elem = bloom_map_pop_elem,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] bpf: Add missing map_get_next_key method to bloom filter map
  2021-12-29 11:20 [PATCH v2] bpf: Add missing map_get_next_key method to bloom filter map tcs.kernel
@ 2021-12-29 17:21 ` Joanne Koong
  2021-12-29 17:41   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Joanne Koong @ 2021-12-29 17:21 UTC (permalink / raw)
  To: tcs.kernel, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, bpf
  Cc: Haimin Zhang

On 12/29/21 3:20 AM, tcs.kernel@gmail.com wrote:

> From: Haimin Zhang <tcs_kernel@tencent.com>
>
> Without it, kernel crashes in map_get_next_key().
>
> Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
>
> Reported-by: TCS Robot <tcs_robot@tencent.com>
> Signed-off-by: Haimin Zhang <tcs_kernel@tencent.com>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---

Thanks for fixing this. I'll take a look at the other bpf_map_ops and see if
there are other missing ones.

Acked-by: Joanne Koong <joannekoong@fb.com>
>   kernel/bpf/bloom_filter.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/kernel/bpf/bloom_filter.c b/kernel/bpf/bloom_filter.c
> index 277a05e9c984..fa34dc871995 100644
> --- a/kernel/bpf/bloom_filter.c
> +++ b/kernel/bpf/bloom_filter.c
> @@ -82,6 +82,11 @@ static int bloom_map_delete_elem(struct bpf_map *map, void *value)
>   	return -EOPNOTSUPP;
>   }
>   
> +static int bloom_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
> +{
> +	return -EOPNOTSUPP;
> +}
> +
>   static struct bpf_map *bloom_map_alloc(union bpf_attr *attr)
>   {
>   	u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
> @@ -192,6 +197,7 @@ const struct bpf_map_ops bloom_filter_map_ops = {
>   	.map_meta_equal = bpf_map_meta_equal,
>   	.map_alloc = bloom_map_alloc,
>   	.map_free = bloom_map_free,
> +	.map_get_next_key = bloom_map_get_next_key,
>   	.map_push_elem = bloom_map_push_elem,
>   	.map_peek_elem = bloom_map_peek_elem,
>   	.map_pop_elem = bloom_map_pop_elem,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] bpf: Add missing map_get_next_key method to bloom filter map
  2021-12-29 17:21 ` Joanne Koong
@ 2021-12-29 17:41   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2021-12-29 17:41 UTC (permalink / raw)
  To: Joanne Koong
  Cc: tcs.kernel, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, bpf, Haimin Zhang

On Wed, Dec 29, 2021 at 9:22 AM Joanne Koong <joannekoong@fb.com> wrote:
>
> On 12/29/21 3:20 AM, tcs.kernel@gmail.com wrote:
>
> > From: Haimin Zhang <tcs_kernel@tencent.com>
> >
> > Without it, kernel crashes in map_get_next_key().
> >
> > Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
> >
> > Reported-by: TCS Robot <tcs_robot@tencent.com>
> > Signed-off-by: Haimin Zhang <tcs_kernel@tencent.com>
> > Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>

Haimin,

Daniel didn't give you his SOB in v1 patch, so I've dropped it
while applying.


> > ---
>
> Thanks for fixing this. I'll take a look at the other bpf_map_ops and see if
> there are other missing ones.
>
> Acked-by: Joanne Koong <joannekoong@fb.com>


Thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-29 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-29 11:20 [PATCH v2] bpf: Add missing map_get_next_key method to bloom filter map tcs.kernel
2021-12-29 17:21 ` Joanne Koong
2021-12-29 17:41   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).