From: Eric Dumazet <eric.dumazet@gmail.com>
To: Alexei Starovoitov <ast@fb.com>,
"David S . Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <daniel@iogearbox.net>, Tejun Heo <tj@kernel.org>,
David Ahern <dsa@cumulusnetworks.com>,
netdev@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH net-next 2/8] bpf: introduce BPF_PROG_QUERY command
Date: Fri, 02 Feb 2018 06:28:43 -0800 [thread overview]
Message-ID: <1517581723.3715.127.camel@gmail.com> (raw)
In-Reply-To: <20171002234857.3707580-3-ast@fb.com>
On Mon, 2017-10-02 at 16:48 -0700, Alexei Starovoitov wrote:
> introduce BPF_PROG_QUERY command to retrieve a set of either
> attached programs to given cgroup or a set of effective programs
> that will execute for events within a cgroup
>
...
> +
> +int bpf_prog_array_copy_to_user(struct bpf_prog_array __rcu *progs,
> + __u32 __user *prog_ids)
> +{
> + struct bpf_prog **prog;
> + u32 cnt = 0, id;
> +
> + rcu_read_lock();
> + prog = rcu_dereference(progs)->progs;
> + for (; *prog; prog++) {
> + id = (*prog)->aux->id;
> + if (copy_to_user(prog_ids + cnt, &id, sizeof(id))) {
> + rcu_read_unlock();
> + return -EFAULT;
> + }
> + cnt++;
> + }
> + rcu_read_unlock();
> + return 0;
> +}
We can not use copy_to_user() inside rcu_read_lock() section.
CONFIG_DEBUG_ATOMIC_SLEEP=y would have detected this problem.
Courtesy of syzbot, obviously.
next prev parent reply other threads:[~2018-02-02 14:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 23:48 [PATCH net-next 0/8] bpf: muli prog support for cgroup-bpf Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 1/8] bpf: multi program support for cgroup+bpf Alexei Starovoitov
2017-10-03 3:54 ` David Ahern
2017-10-03 4:21 ` Alexei Starovoitov
2017-10-03 4:26 ` David Ahern
2017-10-03 5:00 ` Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 2/8] bpf: introduce BPF_PROG_QUERY command Alexei Starovoitov
2018-02-02 14:28 ` Eric Dumazet [this message]
2018-02-02 15:41 ` Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 3/8] bpf: enforce return code for cgroup-bpf programs Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 4/8] libbpf: introduce bpf_prog_detach2() Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 5/8] samples/bpf: add multi-prog cgroup test case Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 6/8] libbpf: sync bpf.h Alexei Starovoitov
2017-10-02 23:48 ` [PATCH net-next 7/8] libbpf: add support for BPF_PROG_QUERY Alexei Starovoitov
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=1517581723.3715.127.camel@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=tj@kernel.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 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).