bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Yonghong Song <yhs@fb.com>,
	Sami Tolvanen <samitolvanen@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Tom Herbert <tom@herbertland.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kcm: use BPF_PROG_RUN
Date: Tue, 24 Sep 2019 20:59:08 +0200	[thread overview]
Message-ID: <20190924185908.GC5889@pc-63.home> (raw)
In-Reply-To: <048e82f4-5b31-f9f4-5bf7-82dfbf7ec8f3@gmail.com>

On Mon, Sep 23, 2019 at 02:31:04PM -0700, Eric Dumazet wrote:
> On 9/6/19 10:06 AM, Alexei Starovoitov wrote:
> > On Fri, Sep 6, 2019 at 3:03 AM Yonghong Song <yhs@fb.com> wrote:
> >> On 9/5/19 2:15 PM, Sami Tolvanen wrote:
> >>> Instead of invoking struct bpf_prog::bpf_func directly, use the
> >>> BPF_PROG_RUN macro.
> >>>
> >>> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> >>
> >> Acked-by: Yonghong Song <yhs@fb.com>
> > 
> > Applied. Thanks
> 
> Then we probably need this as well, what do you think ?

Yep, it's broken. 6cab5e90ab2b ("bpf: run bpf programs with preemption
disabled") probably forgot about it since it wasn't using BPF_PROG_RUN()
in the first place. If you get a chance, please send a proper patch,
thanks!

> diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
> index 8f12f5c6ab875ebaa6c59c6268c337919fb43bb9..6508e88efdaf57f206b84307f5ad5915a2ed21f7 100644
> --- a/net/kcm/kcmsock.c
> +++ b/net/kcm/kcmsock.c
> @@ -378,8 +378,13 @@ static int kcm_parse_func_strparser(struct strparser *strp, struct sk_buff *skb)
>  {
>         struct kcm_psock *psock = container_of(strp, struct kcm_psock, strp);
>         struct bpf_prog *prog = psock->bpf_prog;
> +       int res;
>  
> -       return BPF_PROG_RUN(prog, skb);
> +       preempt_disable();
> +       res = BPF_PROG_RUN(prog, skb);
> +       preempt_enable();
> +
> +       return res;
>  }
>  
>  static int kcm_read_sock_done(struct strparser *strp, int err)

  reply	other threads:[~2019-09-24 18:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 21:15 [PATCH] kcm: use BPF_PROG_RUN Sami Tolvanen
2019-09-06  0:07 ` Yonghong Song
2019-09-06 17:06   ` Alexei Starovoitov
2019-09-23 21:31     ` Eric Dumazet
2019-09-24 18:59       ` Daniel Borkmann [this message]
2019-09-24 19:17         ` Eric Dumazet

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=20190924185908.GC5889@pc-63.home \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=tom@herbertland.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 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).