All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf v2 2/2] bpf: add missing bpf_read_[un]lock_trace() for syscall program
Date: Mon, 9 Aug 2021 10:16:37 -0700	[thread overview]
Message-ID: <CAEf4BzZ4-L0KQX8b+hMQZrbAejva3i4ZE1ZrjVTh-yDyUQv7=Q@mail.gmail.com> (raw)
In-Reply-To: <20210809060320.1176782-1-yhs@fb.com>

On Sun, Aug 8, 2021 at 11:03 PM Yonghong Song <yhs@fb.com> wrote:
>
> Commit 79a7f8bdb159d ("bpf: Introduce bpf_sys_bpf() helper and program type.")
> added support for syscall program, which is a sleepable program.
> But the program run missed bpf_read_lock_trace()/bpf_read_unlock_trace(),
> which is needed to ensure proper rcu callback invocations.
> This patch added bpf_read_[un]lock_trace() properly.
>
> Fixes: 79a7f8bdb159d ("bpf: Introduce bpf_sys_bpf() helper and program type.")
> Signed-off-by: Yonghong Song <yhs@fb.com>
> ---

LGTM.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  net/bpf/test_run.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 1cc75c811e24..caa16bf30fb5 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -7,6 +7,7 @@
>  #include <linux/vmalloc.h>
>  #include <linux/etherdevice.h>
>  #include <linux/filter.h>
> +#include <linux/rcupdate_trace.h>
>  #include <linux/sched/signal.h>
>  #include <net/bpf_sk_storage.h>
>  #include <net/sock.h>
> @@ -951,7 +952,10 @@ int bpf_prog_test_run_syscall(struct bpf_prog *prog,
>                         goto out;
>                 }
>         }
> +
> +       rcu_read_lock_trace();
>         retval = bpf_prog_run_pin_on_cpu(prog, ctx);
> +       rcu_read_unlock_trace();
>
>         if (copy_to_user(&uattr->test.retval, &retval, sizeof(u32))) {
>                 err = -EFAULT;
> --
> 2.30.2
>

      reply	other threads:[~2021-08-09 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  6:03 [PATCH bpf v2 0/2] bpf: fix a couple of issues with syscall program Yonghong Song
2021-08-09  6:03 ` [PATCH bpf v2 1/2] bpf: don't call bpf_get_current_[ancestor_]cgroup_id() in sleepable progs Yonghong Song
2021-08-09 17:18   ` Andrii Nakryiko
2021-08-09 17:41     ` Yonghong Song
2021-08-09 17:58       ` Andrii Nakryiko
2021-08-09 20:29         ` Daniel Borkmann
2021-08-09 22:34           ` Yonghong Song
2021-08-09  6:03 ` [PATCH bpf v2 2/2] bpf: add missing bpf_read_[un]lock_trace() for syscall program Yonghong Song
2021-08-09 17:16   ` Andrii Nakryiko [this message]

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='CAEf4BzZ4-L0KQX8b+hMQZrbAejva3i4ZE1ZrjVTh-yDyUQv7=Q@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=yhs@fb.com \
    /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.