From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass (mailfrom) smtp.mailfrom=linux.dev (client-ip=2001:41d0:1004:224b::5e; helo=out-94.mta0.migadu.com; envelope-from=martin.lau@linux.dev; receiver=) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=W1nKyLs2 Received: from out-94.mta0.migadu.com (out-94.mta0.migadu.com [IPv6:2001:41d0:1004:224b::5e]) by mail.toke.dk (Postfix) with ESMTPS id 971759D3B9D for ; Fri, 23 Dec 2022 01:31:33 +0100 (CET) Message-ID: <00810419-c76c-32da-16a6-27c1029e3a60@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1671755491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DsSPlAwNaybOVBoScG6VFYhJRF2PMNYvefdoExcTLGI=; b=W1nKyLs2CSWdZ6dsxbZULAhv0FLIMyKJgzF2nJ9IIprXuQqcXw0hHCa710dwgDA1q5rNAc zOZaiCyMuBRmOdZ+ZUsBcsiXzrtE5Df4BRLra/nEatXPZXoGgejJ/007+Rq49MaBQTyLZB mBUSEF2mUi2volOO8byvoqiuxeA77kQ= Date: Thu, 22 Dec 2022 16:31:26 -0800 MIME-Version: 1.0 Content-Language: en-US To: Stanislav Fomichev References: <20221220222043.3348718-1-sdf@google.com> <20221220222043.3348718-8-sdf@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20221220222043.3348718-8-sdf@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Message-ID-Hash: ESUAGANQ4FCTQ4FGYF3QCIXFFDPZYWDH X-Message-ID-Hash: ESUAGANQ4FCTQ4FGYF3QCIXFFDPZYWDH X-MailFrom: martin.lau@linux.dev X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Jesper Dangaard Brouer , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, bpf@vger.kernel.org X-Mailman-Version: 3.3.7 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v5 07/17] bpf: XDP metadata RX kfuncs List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 12/20/22 2:20 PM, Stanislav Fomichev wrote: > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c > index bafcb7a3ae6f..6d81b14361e3 100644 > --- a/kernel/bpf/core.c > +++ b/kernel/bpf/core.c > @@ -2097,6 +2097,14 @@ bool bpf_prog_map_compatible(struct bpf_map *map, > if (fp->kprobe_override) > return false; > > + /* XDP programs inserted into maps are not guaranteed to run on > + * a particular netdev (and can run outside driver context entirely > + * in the case of devmap and cpumap). Until device checks > + * are implemented, prohibit adding dev-bound programs to program maps. > + */ > + if (bpf_prog_is_dev_bound(fp->aux)) > + return false; > + There is a recent change in the same function in the bpf tree, commit 1c123c567fb1. fyi. [ ... ] > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index fdfdcab4a59d..320451a0be3e 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -2081,6 +2081,22 @@ static struct btf *find_kfunc_desc_btf(struct bpf_verifier_env *env, s16 offset) > return btf_vmlinux ?: ERR_PTR(-ENOENT); > } > > +int bpf_dev_bound_kfunc_check(struct bpf_verifier_env *env, > + struct bpf_prog_aux *prog_aux) nit. Move the dev bound related function to offload.c. &env->log can be passed instead of env and then use bpf_log(). Others lgtm.