From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jason Wang <jasowang@redhat.com>,
Michal Hocko <mhocko@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
syzbot <syzbot+1a240cdb1f4cc88819df@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, dhowells@redhat.com,
hannes@cmpxchg.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, mingo@kernel.org, rppt@linux.vnet.ibm.com,
syzkaller-bugs@googlegroups.com, vbabka@suse.cz,
viro@zeniv.linux.org.uk, Alexei Starovoitov <ast@kernel.org>,
netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
brouer@redhat.com
Subject: Re: WARNING in kvmalloc_node
Date: Wed, 14 Feb 2018 13:29:50 +0100 [thread overview]
Message-ID: <20180214132950.2d06e612@redhat.com> (raw)
In-Reply-To: <dcbb4ead-2a76-310c-69dc-4f253e711fe9@iogearbox.net>
On Wed, 14 Feb 2018 13:17:18 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 02/14/2018 01:02 PM, Jason Wang wrote:
> > On 2018年02月14日 19:51, Michal Hocko wrote:
> >> On Wed 14-02-18 19:47:30, Jason Wang wrote:
> >>> On 2018年02月14日 17:28, Daniel Borkmann wrote:
> >>>> [ +Jason, +Jesper ]
> >>>>
> >>>> On 02/14/2018 09:43 AM, Michal Hocko wrote:
> >>>>> On Tue 13-02-18 18:55:33, Matthew Wilcox wrote:
> >>>>>> On Tue, Feb 13, 2018 at 03:59:01PM -0800, syzbot wrote:
> >>>>> [...]
> >>>>>>> kvmalloc include/linux/mm.h:541 [inline]
> >>>>>>> kvmalloc_array include/linux/mm.h:557 [inline]
> >>>>>>> __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:474 [inline]
> >>>>>>> ptr_ring_init include/linux/ptr_ring.h:492 [inline]
> >>>>>>> __cpu_map_entry_alloc kernel/bpf/cpumap.c:359 [inline]
> >>>>>>> cpu_map_update_elem+0x3c3/0x8e0 kernel/bpf/cpumap.c:490
> >>>>>>> map_update_elem kernel/bpf/syscall.c:698 [inline]
> >>>>>> Blame the BPF people, not the MM people ;-)
> >>>> Heh, not really. ;-)
> >>>>
> >>>>> Yes. kvmalloc (the vmalloc part) doesn't support GFP_ATOMIC semantic.
> >>>> Agree, that doesn't work.
> >>>>
> >>>> Bug was added in commit 0bf7800f1799 ("ptr_ring: try vmalloc() when kmalloc() fails").
> >>>>
> >>>> Jason, please take a look at fixing this, thanks!
> >>> It looks to me the only solution is to revert that commit.
> >> Do you really need this to be GFP_ATOMIC? I can see some callers are
> >> under RCU read lock but can we perhaps do the allocation outside of this
> >> section?
> >
> > If I understand the code correctly, the code would be called by XDP program (usually run inside a bh) which makes it hard to do this.
> >
> > Rethink of this, we can probably test gfp and not call kvmalloc if GFP_ATOMIC is set in __ptr_ring_init_queue_alloc().
>
> That would be one option indeed (probably useful in any case to make the API
> more robust). Another one is to just not use GFP_ATOMIC in cpumap. Looking at
> it, update can neither be called out of a BPF prog since prevented by verifier
> nor under RCU reader side when updating this type of map from syscall path.
> Jesper, any concrete reason we still need GFP_ATOMIC here?
Allocations in cpumap (related to ptr_ring) should only be possible to
be initiated through userspace via bpf-syscall. Thus, there isn't any
reason for GFP_ATOMIC here.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jason Wang <jasowang@redhat.com>,
Michal Hocko <mhocko@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
syzbot <syzbot+1a240cdb1f4cc88819df@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, dhowells@redhat.com,
hannes@cmpxchg.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, mingo@kernel.org, rppt@linux.vnet.ibm.com,
syzkaller-bugs@googlegroups.com, vbabka@suse.cz,
viro@zeniv.linux.org.uk, Alexei Starovoitov <ast@kernel.org>,
netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
brouer@redhat.com
Subject: Re: WARNING in kvmalloc_node
Date: Wed, 14 Feb 2018 13:29:50 +0100 [thread overview]
Message-ID: <20180214132950.2d06e612@redhat.com> (raw)
In-Reply-To: <dcbb4ead-2a76-310c-69dc-4f253e711fe9@iogearbox.net>
On Wed, 14 Feb 2018 13:17:18 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 02/14/2018 01:02 PM, Jason Wang wrote:
> > On 2018年02月14日 19:51, Michal Hocko wrote:
> >> On Wed 14-02-18 19:47:30, Jason Wang wrote:
> >>> On 2018年02月14日 17:28, Daniel Borkmann wrote:
> >>>> [ +Jason, +Jesper ]
> >>>>
> >>>> On 02/14/2018 09:43 AM, Michal Hocko wrote:
> >>>>> On Tue 13-02-18 18:55:33, Matthew Wilcox wrote:
> >>>>>> On Tue, Feb 13, 2018 at 03:59:01PM -0800, syzbot wrote:
> >>>>> [...]
> >>>>>>> kvmalloc include/linux/mm.h:541 [inline]
> >>>>>>> kvmalloc_array include/linux/mm.h:557 [inline]
> >>>>>>> __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:474 [inline]
> >>>>>>> ptr_ring_init include/linux/ptr_ring.h:492 [inline]
> >>>>>>> __cpu_map_entry_alloc kernel/bpf/cpumap.c:359 [inline]
> >>>>>>> cpu_map_update_elem+0x3c3/0x8e0 kernel/bpf/cpumap.c:490
> >>>>>>> map_update_elem kernel/bpf/syscall.c:698 [inline]
> >>>>>> Blame the BPF people, not the MM people ;-)
> >>>> Heh, not really. ;-)
> >>>>
> >>>>> Yes. kvmalloc (the vmalloc part) doesn't support GFP_ATOMIC semantic.
> >>>> Agree, that doesn't work.
> >>>>
> >>>> Bug was added in commit 0bf7800f1799 ("ptr_ring: try vmalloc() when kmalloc() fails").
> >>>>
> >>>> Jason, please take a look at fixing this, thanks!
> >>> It looks to me the only solution is to revert that commit.
> >> Do you really need this to be GFP_ATOMIC? I can see some callers are
> >> under RCU read lock but can we perhaps do the allocation outside of this
> >> section?
> >
> > If I understand the code correctly, the code would be called by XDP program (usually run inside a bh) which makes it hard to do this.
> >
> > Rethink of this, we can probably test gfp and not call kvmalloc if GFP_ATOMIC is set in __ptr_ring_init_queue_alloc().
>
> That would be one option indeed (probably useful in any case to make the API
> more robust). Another one is to just not use GFP_ATOMIC in cpumap. Looking at
> it, update can neither be called out of a BPF prog since prevented by verifier
> nor under RCU reader side when updating this type of map from syscall path.
> Jesper, any concrete reason we still need GFP_ATOMIC here?
Allocations in cpumap (related to ptr_ring) should only be possible to
be initiated through userspace via bpf-syscall. Thus, there isn't any
reason for GFP_ATOMIC here.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2018-02-14 12:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 23:59 WARNING in kvmalloc_node syzbot
2018-02-14 2:55 ` Matthew Wilcox
2018-02-14 2:55 ` Matthew Wilcox
2018-02-14 8:43 ` Michal Hocko
2018-02-14 8:43 ` Michal Hocko
2018-02-14 9:28 ` Daniel Borkmann
2018-02-14 9:28 ` Daniel Borkmann
2018-02-14 11:47 ` Jason Wang
2018-02-14 11:47 ` Jason Wang
2018-02-14 11:47 ` Jason Wang
2018-02-14 11:51 ` Michal Hocko
2018-02-14 11:51 ` Michal Hocko
2018-02-14 11:51 ` Michal Hocko
2018-02-14 12:02 ` Jason Wang
2018-02-14 12:02 ` Jason Wang
2018-02-14 12:17 ` Daniel Borkmann
2018-02-14 12:17 ` Daniel Borkmann
2018-02-14 12:29 ` Jesper Dangaard Brouer [this message]
2018-02-14 12:29 ` Jesper Dangaard Brouer
2018-02-14 12:47 ` Jason Wang
2018-02-14 12:47 ` Jason Wang
2018-02-14 12:47 ` Jason Wang
2018-02-14 13:29 ` Daniel Borkmann
2018-02-14 13:29 ` Daniel Borkmann
2018-02-14 19:20 ` Dmitry Vyukov
2018-02-14 19:20 ` Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180214132950.2d06e612@redhat.com \
--to=brouer@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=dhowells@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mingo@kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rppt@linux.vnet.ibm.com \
--cc=syzbot+1a240cdb1f4cc88819df@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.