From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28597C432C2 for ; Tue, 24 Sep 2019 18:59:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07B7D214DA for ; Tue, 24 Sep 2019 18:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730498AbfIXS7O (ORCPT ); Tue, 24 Sep 2019 14:59:14 -0400 Received: from www62.your-server.de ([213.133.104.62]:51430 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbfIXS7O (ORCPT ); Tue, 24 Sep 2019 14:59:14 -0400 Received: from [178.197.248.15] (helo=localhost) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1iCq1l-0001g7-9Z; Tue, 24 Sep 2019 20:59:09 +0200 Date: Tue, 24 Sep 2019 20:59:08 +0200 From: Daniel Borkmann To: Eric Dumazet Cc: Alexei Starovoitov , Yonghong Song , Sami Tolvanen , "David S. Miller" , Tom Herbert , "netdev@vger.kernel.org" , "bpf@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] kcm: use BPF_PROG_RUN Message-ID: <20190924185908.GC5889@pc-63.home> References: <20190905211528.97828-1-samitolvanen@google.com> <0f77cc31-4df5-a74f-5b64-a1e3fc439c6d@fb.com> <048e82f4-5b31-f9f4-5bf7-82dfbf7ec8f3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <048e82f4-5b31-f9f4-5bf7-82dfbf7ec8f3@gmail.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25582/Tue Sep 24 10:20:37 2019) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org 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 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 > >> > >> Acked-by: Yonghong Song > > > > 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)