* [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
@ 2021-10-31 17:13 Eric Dumazet
2021-11-01 4:01 ` Yonghong Song
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2021-10-31 17:13 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: David S . Miller, netdev, Eric Dumazet, Eric Dumazet, bpf,
Joanne Koong, Andrii Nakryiko, syzbot
From: Eric Dumazet <edumazet@google.com>
Without it, kernel crashes in map_delete_elem(), as reported
by syzbot.
BUG: kernel NULL pointer dereference, address: 0000000000000000
PGD 72c97067 P4D 72c97067 PUD 1e20c067 PMD 0
Oops: 0010 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 6518 Comm: syz-executor196 Not tainted 5.15.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:0x0
Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
RSP: 0018:ffffc90002bafcb8 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: 1ffff92000575f9f RCX: 0000000000000000
RDX: 1ffffffff1327aba RSI: 0000000000000000 RDI: ffff888025a30c00
RBP: ffffc90002baff08 R08: 0000000000000000 R09: 0000000000000001
R10: ffffffff818525d8 R11: 0000000000000000 R12: ffffffff8993d560
R13: ffff888025a30c00 R14: ffff888024bc0000 R15: 0000000000000000
FS: 0000555557491300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 0000000070189000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
map_delete_elem kernel/bpf/syscall.c:1220 [inline]
__sys_bpf+0x34f1/0x5ee0 kernel/bpf/syscall.c:4606
__do_sys_bpf kernel/bpf/syscall.c:4719 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4717 [inline]
__x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4717
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Joanne Koong <joannekoong@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Reported-by: syzbot <syzkaller@googlegroups.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 7c50232b7571f3f038dd45b5c0bd7289125e6d43..31a7af15a83d74af1d88d04cc8d71aa7d403b4ef 100644
--- a/kernel/bpf/bloom_filter.c
+++ b/kernel/bpf/bloom_filter.c
@@ -77,6 +77,11 @@ static int pop_elem(struct bpf_map *map, void *value)
return -EOPNOTSUPP;
}
+static int delete_elem(struct bpf_map *map, void *value)
+{
+ return -EOPNOTSUPP;
+}
+
static struct bpf_map *map_alloc(union bpf_attr *attr)
{
u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
@@ -189,6 +194,7 @@ const struct bpf_map_ops bloom_filter_map_ops = {
.map_pop_elem = pop_elem,
.map_lookup_elem = lookup_elem,
.map_update_elem = update_elem,
+ .map_delete_elem = delete_elem,
.map_check_btf = check_btf,
.map_btf_name = "bpf_bloom_filter",
.map_btf_id = &bpf_bloom_btf_id,
--
2.33.1.1089.g2158813163f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
2021-10-31 17:13 [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map Eric Dumazet
@ 2021-11-01 4:01 ` Yonghong Song
2021-11-01 16:32 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Yonghong Song @ 2021-11-01 4:01 UTC (permalink / raw)
To: Eric Dumazet, Alexei Starovoitov, Daniel Borkmann
Cc: David S . Miller, netdev, Eric Dumazet, bpf, Joanne Koong,
Andrii Nakryiko, syzbot
On 10/31/21 10:13 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Without it, kernel crashes in map_delete_elem(), as reported
> by syzbot.
>
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> PGD 72c97067 P4D 72c97067 PUD 1e20c067 PMD 0
> Oops: 0010 [#1] PREEMPT SMP KASAN
> CPU: 0 PID: 6518 Comm: syz-executor196 Not tainted 5.15.0-rc3-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> RIP: 0010:0x0
> Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
> RSP: 0018:ffffc90002bafcb8 EFLAGS: 00010246
> RAX: dffffc0000000000 RBX: 1ffff92000575f9f RCX: 0000000000000000
> RDX: 1ffffffff1327aba RSI: 0000000000000000 RDI: ffff888025a30c00
> RBP: ffffc90002baff08 R08: 0000000000000000 R09: 0000000000000001
> R10: ffffffff818525d8 R11: 0000000000000000 R12: ffffffff8993d560
> R13: ffff888025a30c00 R14: ffff888024bc0000 R15: 0000000000000000
> FS: 0000555557491300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: ffffffffffffffd6 CR3: 0000000070189000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> map_delete_elem kernel/bpf/syscall.c:1220 [inline]
> __sys_bpf+0x34f1/0x5ee0 kernel/bpf/syscall.c:4606
> __do_sys_bpf kernel/bpf/syscall.c:4719 [inline]
> __se_sys_bpf kernel/bpf/syscall.c:4717 [inline]
> __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4717
> do_syscall_x64 arch/x86/entry/common.c:50 [inline]
>
> Fixes: 9330986c0300 ("bpf: Add bloom filter map implementation")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Joanne Koong <joannekoong@fb.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Reported-by: syzbot <syzkaller@googlegroups.com>
LGTM with a suggestion below.
Acked-by: Yonghong Song <yhs@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 7c50232b7571f3f038dd45b5c0bd7289125e6d43..31a7af15a83d74af1d88d04cc8d71aa7d403b4ef 100644
> --- a/kernel/bpf/bloom_filter.c
> +++ b/kernel/bpf/bloom_filter.c
> @@ -77,6 +77,11 @@ static int pop_elem(struct bpf_map *map, void *value)
> return -EOPNOTSUPP;
> }
>
> +static int delete_elem(struct bpf_map *map, void *value)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> static struct bpf_map *map_alloc(union bpf_attr *attr)
> {
> u32 bitset_bytes, bitset_mask, nr_hash_funcs, nr_bits;
> @@ -189,6 +194,7 @@ const struct bpf_map_ops bloom_filter_map_ops = {
> .map_pop_elem = pop_elem,
> .map_lookup_elem = lookup_elem,
> .map_update_elem = update_elem,
> + .map_delete_elem = delete_elem,
There is a pending patch
https://lore.kernel.org/bpf/20211029224909.1721024-2-joannekoong@fb.com/T/#u
to rename say lookup_elem to bloom_map_lookup_elem.
I think we should change
this delete_elem to bloom_map_delete_elem as well.
> .map_check_btf = check_btf,
> .map_btf_name = "bpf_bloom_filter",
> .map_btf_id = &bpf_bloom_btf_id,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
2021-11-01 4:01 ` Yonghong Song
@ 2021-11-01 16:32 ` Eric Dumazet
2021-11-01 21:24 ` Alexei Starovoitov
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2021-11-01 16:32 UTC (permalink / raw)
To: Yonghong Song
Cc: Eric Dumazet, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, netdev, bpf, Joanne Koong, Andrii Nakryiko,
syzbot
On Sun, Oct 31, 2021 at 9:01 PM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> LGTM with a suggestion below.
>
> Acked-by: Yonghong Song <yhs@fb.com>
>
> There is a pending patch
> https://lore.kernel.org/bpf/20211029224909.1721024-2-joannekoong@fb.com/T/#u
> to rename say lookup_elem to bloom_map_lookup_elem.
> I think we should change
> this delete_elem to bloom_map_delete_elem as well.
>
Thanks for letting me know.
I can rebase my patch after yours is merged, no worries.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
2021-11-01 16:32 ` Eric Dumazet
@ 2021-11-01 21:24 ` Alexei Starovoitov
2021-11-01 23:24 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Alexei Starovoitov @ 2021-11-01 21:24 UTC (permalink / raw)
To: Eric Dumazet
Cc: Yonghong Song, Eric Dumazet, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, netdev, bpf, Joanne Koong, Andrii Nakryiko,
syzbot
On Mon, Nov 1, 2021 at 9:32 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Sun, Oct 31, 2021 at 9:01 PM Yonghong Song <yhs@fb.com> wrote:
> >
> >
> >
> > LGTM with a suggestion below.
> >
> > Acked-by: Yonghong Song <yhs@fb.com>
> >
>
> > There is a pending patch
> > https://lore.kernel.org/bpf/20211029224909.1721024-2-joannekoong@fb.com/T/#u
> > to rename say lookup_elem to bloom_map_lookup_elem.
> > I think we should change
> > this delete_elem to bloom_map_delete_elem as well.
> >
>
> Thanks for letting me know.
> I can rebase my patch after yours is merged, no worries.
I rebased and patched it manually while applying.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
2021-11-01 21:24 ` Alexei Starovoitov
@ 2021-11-01 23:24 ` Eric Dumazet
2021-11-02 0:05 ` Joanne Koong
0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2021-11-01 23:24 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Yonghong Song, Eric Dumazet, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, netdev, bpf, Joanne Koong, Andrii Nakryiko,
syzbot
On Mon, Nov 1, 2021 at 2:25 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> I rebased and patched it manually while applying.
> Thanks!
Excellent, thank you Alexei.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map
2021-11-01 23:24 ` Eric Dumazet
@ 2021-11-02 0:05 ` Joanne Koong
0 siblings, 0 replies; 6+ messages in thread
From: Joanne Koong @ 2021-11-02 0:05 UTC (permalink / raw)
To: Eric Dumazet, Alexei Starovoitov
Cc: Yonghong Song, Eric Dumazet, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, netdev, bpf, Andrii Nakryiko, syzbot
Thanks for fixing this, Eric and Alexei. And
thanks for reviewing it, Yonghong.
On 11/1/21 4:24 PM, Eric Dumazet wrote:
> On Mon, Nov 1, 2021 at 2:25 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>
>> I rebased and patched it manually while applying.
>> Thanks!
> Excellent, thank you Alexei.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-02 0:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31 17:13 [PATCH bpf-next] bpf: add missing map_delete_elem method to bloom filter map Eric Dumazet
2021-11-01 4:01 ` Yonghong Song
2021-11-01 16:32 ` Eric Dumazet
2021-11-01 21:24 ` Alexei Starovoitov
2021-11-01 23:24 ` Eric Dumazet
2021-11-02 0:05 ` Joanne Koong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.