Hi Roman,

On Tue, 13 Nov 2018 at 23:07, Roman Gushchin <g...@fb.com> wrote:
>
> On Tue, Nov 13, 2018 at 10:03:38PM +0530, Naresh Kamboju wrote:
> > While running kernel selftests bpf test_cgroup_storage test this
> > kernel BUG reported every time on all devices running Linux -next
> > 4.20.0-rc2-next-20181113 (from 4.19.0-rc5-next-20180928).
> > This kernel BUG log is from x86_64 machine.
> >
> > Do you see at your end ?
> >
> > [   73.047526] BUG: sleeping function called from invalid context at
> > /srv/oe/build/tmp-rpb-glibc/work-shared/intel-corei7-64/kernel-source/mm/slab.h:421
> > [   73.060915] in_atomic(): 1, irqs_disabled(): 0, pid: 3157, name:
> > test_cgroup_sto
> > [   73.068342] INFO: lockdep is turned off.
> > [   73.072293] CPU: 2 PID: 3157 Comm: test_cgroup_sto Not tainted
> > 4.20.0-rc2-next-20181113 #1
> > [   73.080548] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS
> > 2.0b 07/27/2017
> > [   73.088018] Call Trace:
> > [   73.090463]  dump_stack+0x70/0xa5
> > [   73.093783]  ___might_sleep+0x152/0x240
> > [   73.097619]  __might_sleep+0x4a/0x80
> > [   73.101191]  __kmalloc_node+0x1cf/0x2f0
> > [   73.105031]  ? cgroup_storage_update_elem+0x46/0x90
> > [   73.109909]  cgroup_storage_update_elem+0x46/0x90
>
> Hi Naresh!
>
> Thank you for the report! Can you, please, try the following patch?

The below patch tested and it is working.
After applying the patch i do not see reported "BUG:".
Thanks for the fix patch.
Happy to test :)

- Naresh

>
> Thanks!
>
> --
>
> diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c
> index c97a8f968638..d91710fb8360 100644
> --- a/kernel/bpf/local_storage.c
> +++ b/kernel/bpf/local_storage.c
> @@ -139,8 +139,8 @@ static int cgroup_storage_update_elem(struct bpf_map 
> *map, void *_key,
>                 return -ENOENT;
>
>         new = kmalloc_node(sizeof(struct bpf_storage_buffer) +
> -                          map->value_size, __GFP_ZERO | GFP_USER,
> -                          map->numa_node);
> +                          map->value_size, __GFP_ZERO | GFP_ATOMIC |
> +                          __GFP_NOWARN, map->numa_node);
>         if (!new)
>                 return -ENOMEM;
>

Reply via email to