Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1514961

Re: bpf: kernel BUG in htab_elem_free

From Dmitry Vyukov <dvyukov@google.com>
Newsgroups linux.kernel
Subject Re: bpf: kernel BUG in htab_elem_free
Date 2016-11-04 01:50 +0100
Message-ID <szARH-2Os-1@gated-at.bofh.it> (permalink)
References <sziBs-7YG-5@gated-at.bofh.it> <szr22-4Zd-19@gated-at.bofh.it> <sztdv-6nD-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 3, 2016 at 10:36 AM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 11/03/2016 03:15 PM, Dmitry Vyukov wrote:
>>
>> On Wed, Nov 2, 2016 at 11:14 PM, Dmitry Vyukov <dvyukov@google.com> wrote:
>>>
>>> Here we go.
>>>
>>> The following program triggers kernel BUG in htab_elem_free.
>>> On commit 0c183d92b20b5c84ca655b45ef57b3318b83eb9e (Oct 31).
>>> Run as "while true; do ./a.out; done".
>
>
> This one fixes it for me. Could you check it from your side as well?
> I'll submit an official fix then.

I've seen you mailed the fix already.
If you were able to reproduce it and test the fix, then there is
nothing else I can do.

> Thanks a lot for the catch!
> Daniel
>
> diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> index 570eeca..ad1bc67 100644
> --- a/kernel/bpf/hashtab.c
> +++ b/kernel/bpf/hashtab.c
> @@ -687,7 +687,8 @@ static void delete_all_elements(struct bpf_htab *htab)
>
>                 hlist_for_each_entry_safe(l, n, head, hash_node) {
>                         hlist_del_rcu(&l->hash_node);
> -                       htab_elem_free(htab, l);
> +                       if (l->state != HTAB_EXTRA_ELEM_USED)
> +                               htab_elem_free(htab, l);
>                 }
>         }
>  }

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

bpf: kernel BUG in htab_elem_free Dmitry Vyukov <dvyukov@google.com> - 2016-11-03 06:20 +0100
  Re: bpf: kernel BUG in htab_elem_free Dmitry Vyukov <dvyukov@google.com> - 2016-11-03 15:20 +0100
    Re: bpf: kernel BUG in htab_elem_free Daniel Borkmann <daniel@iogearbox.net> - 2016-11-03 17:40 +0100
      Re: bpf: kernel BUG in htab_elem_free Dmitry Vyukov <dvyukov@google.com> - 2016-11-04 01:50 +0100

csiph-web