Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1763086ybn; Thu, 26 Sep 2019 01:42:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdrvdegMkzP9ZCHxNN963cSfAbbpKmZGI89t0HdCPCdxXqNT8X+8RC5Dz/LRhoDNlCAG88 X-Received: by 2002:a50:ab49:: with SMTP id t9mr2231681edc.301.1569487355730; Thu, 26 Sep 2019 01:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569487355; cv=none; d=google.com; s=arc-20160816; b=CWnTXJ1ARTk59Hy3xie+rMFlcefrmwbceRlCoxm2D4Q07Nviz0YsmebKnbeqmSSBWn kSoMAe7WTTSlsKZwBEcXC0c+8co0SvP7CWKp4MvZocHpTaIxh4gTQUC59jKSYlwfXPAJ QlAlmr0uC9VNVvoLB85ooqpt8DIR8FDOwF6HBVUIOWa22H16LpXYHgoyuieZODnhXdEy aaeqLSWMJaiYiRrVNBHVwX5xyw17VRNOmPNgHhHBKrTn5tIn8vymz86nkeIudpWtEJ6w 05XsVyo4oMJPacWPuhrM8kfiz6Wrnp7oJYWYgtzAAkw54ox7GcMItkHQByeVhcTHM8P1 qPvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vYVuo5Jv/XdzYhR5KGi2SmHiiKPATeUZnN+1b5+w1YE=; b=u/RqncChCt5aRlmWw1RAgRrG0VEFJ4R4wOIdCr5/hdRqU0biK77pe9mngGicu7aW+r SHdOU17eBoXOBLiXaHgYisxRtsAGDcpGoZXzM21rUwqWNy+jhvkFkBCgUTx/HFmins3K pOPEbi/KCghbRRf0qufGGQxYNvf6r4ugpYGH8z5ZQyxLAzAGB9yWI7kgbtCgtX0M6Znj j0xvR7Npr2lXw/VmuA3hQMOSJvJkBQIaBUggcUNFwlizyv5j30leZCg7fzoLrGwS7GzP 6XwFTCPuiYzAPZ+7PE3gIMlKw54cUJCz4K1EfvmmiP64SwHfDkXw2k4iqG9zkHycay29 c/wQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x51si871397eda.272.2019.09.26.01.42.12; Thu, 26 Sep 2019 01:42:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730724AbfIXS7O (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)