Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp259426rdb; Fri, 5 Jan 2024 08:56:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGw/5ZCMxO5Bw6udq2ufRTpvSbQMVMcoZ/ouAsEYrWHRdNvrurnBtMdmoarIomgixTtgDxD X-Received: by 2002:a05:600c:1f88:b0:40d:5c89:9dfc with SMTP id je8-20020a05600c1f8800b0040d5c899dfcmr1516609wmb.182.1704473776905; Fri, 05 Jan 2024 08:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704473776; cv=none; d=google.com; s=arc-20160816; b=yD13Pep5fjGq7OcDH1tQ6Ph9yUF0VMqu0dspUGY4F/9Fbl0ahqpFdmgcbxhhR0022a kmr8WjER4/P01DtN6kRc/Ax/ypc6LwuKXeWcFZK2oHdLeD4jmuWeJtASOfR0wY5QtcCF xikXvuaLuIv/Ep/oFV3/rAYnh5NNsffxueKxUVMcyAslib2G0AY++7ysw7TE9X1yryJb 3BRaHoLrcQ6bLkigVQMkgHZBK/uc7K8XXZhz3CbWm2Qa4Bt/g0NbPi7vWAN+gNBncjDK P75AKU3P5jM9d/MfJ0Lz45c5D/tMPhnqJsAlokWb7YqqBlh8RoZTArVlUHEWGYd/Vjyc YsPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=QW7jt9Lu7fke8mG4lP5bYmPmDvOXPBpGzIUDBHIekTk=; fh=RiIIsUVLbJVFGoZD2A85jHoF+N8T8M8imAMpcaFPSiE=; b=eugZ9XyfVd1tfppcdFtDOydozydauRU3d2Ryfk77CZ2ODIKzRsDMrsnKXSOag6QQfW lZ7OwgL+FBtp5U6DJCaxbifMMj74KX7lSMraEjaBU3ElL6C/uc7ipWSQ/vmkwL0Vdtg4 UfgGYqay3OM1EFqvGDoa30UQAJZFOnIYVzksLVJGn/PiiaYWJ4/F5oeBmAAqdrq0RTNo id7218O401XY1DoWLFgc6rVOnrUmhO681DYu1F5NzZac/hamB/9t8+Pa1f0SQmNzVaTy vJio8+RPGsnvPlNlH1e8fQz7eSjK/9iE2YkG8d34Ff8vb1lTEW0JDg7BttMrFAopmCfp EejQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=Acz4kIcq; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=K9BYb8iT; spf=pass (google.com: domain of linux-kernel+bounces-18088-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18088-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qh20-20020a170906ecb400b00a2939eaf551si613158ejb.595.2024.01.05.08.56.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 08:56:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18088-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=Acz4kIcq; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=K9BYb8iT; spf=pass (google.com: domain of linux-kernel+bounces-18088-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18088-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A4AB91F232BF for ; Fri, 5 Jan 2024 16:56:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7ADF93219A; Fri, 5 Jan 2024 16:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b="Acz4kIcq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="K9BYb8iT" X-Original-To: linux-kernel@vger.kernel.org Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4E9A2E823; Fri, 5 Jan 2024 16:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dxuuu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dxuuu.xyz Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 643F82B002FE; Fri, 5 Jan 2024 11:55:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 05 Jan 2024 11:55:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1704473749; x=1704480949; bh=QW7jt9Lu7f ke8mG4lP5bYmPmDvOXPBpGzIUDBHIekTk=; b=Acz4kIcq6y/rMD3GdA7cQZFH/X t+UCDk8kiRTwuEzv4ajq3EDfufkIZkO8rGAkbX3sbhxHt16W2NOVO6gW2gQHxnZr G4znBN6j8ey0yPSzv+AlK6ZSJwteCnfW3d+5qDl/eg2aJTqU9Tgdw3YjZEKbWiiA xDjCkNbH8TatuNfFUavrE+ffldAtLl1v9baWSzFGVpUeiYCRlCeZGSoqIOyzPHvn QzvCgTBrCyaLUW/MlTUJL8Udfek55UMpp0KfgTZyqMYearp0x1HoJW30AG1RainQ 7jUdJb7RD7OtoMFP4EUhEya/MWTwpfUkkKqXxvWzEKPyF0P6ySZ4aWmCm73g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704473749; x=1704480949; bh=QW7jt9Lu7fke8mG4lP5bYmPmDvOX PBpGzIUDBHIekTk=; b=K9BYb8iThvNsRc3uDbU2A4HF+NqmpozLE145a0RZM6s+ HlSs93vsFRPOZ4j+D7yanP8AH1MORLgVIUDI/smsj0tgQHb1QcdzskIXumAkTdaI aYWKtH9GM5E2idjjTXJdHaRlRm+zABDB8nY9iGIO+T3ni/GGWRr3B/rAtlNxTMAa 442AnTkTIKtZDG71QbRbhfRDzlUBII9A+3MGR239UuUry3gcSCza/5J8eBt8YfDp qSaUg0ncHYhXvJ5JLZQ2x+uSxOHpqddfG6B+3/DQ4dtJ8Bvy8Eo4uJ9FwtXpOXbS lAKesJFuhuTY1UEqKamWKqMwsebhP2LexY2pyWEAjQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegledgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdfstddt tddvnecuhfhrohhmpeffrghnihgvlhcuighuuceougiguhesugiguhhuuhdrgiihiieqne cuggftrfgrthhtvghrnhepvdefkeetuddufeeigedtheefffekuedukeehudffudfffffg geeitdetgfdvhfdvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepugiguhesugiguhhuuhdrgiihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 5 Jan 2024 11:55:44 -0500 (EST) Date: Fri, 5 Jan 2024 09:55:43 -0700 From: Daniel Xu To: Jiri Olsa Cc: alexandre.torgue@foss.st.com, benjamin.tissoires@redhat.com, lizefan.x@bytedance.com, Herbert Xu , dsahern@kernel.org, hannes@cmpxchg.org, rostedt@goodmis.org, mcoquelin.stm32@gmail.com, pablo@netfilter.org, martin.lau@linux.dev, edumazet@google.com, daniel@iogearbox.net, ebiggers@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, hawk@kernel.org, steffen.klassert@secunet.com, jikos@kernel.org, kuba@kernel.org, fw@strlen.de, ast@kernel.org, song@kernel.org, pabeni@redhat.com, shuah@kernel.org, tytso@mit.edu, tj@kernel.org, kadlec@netfilter.org, davem@davemloft.net, mhiramat@kernel.org, andrii@kernel.org, alexei.starovoitov@gmail.com, quentin@isovalent.com, alan.maguire@oracle.com, memxor@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, mathieu.desnoyers@efficios.com, mykolal@fb.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, fsverity@lists.linux.dev, bpf@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF Message-ID: <4tsn6x45gh3vgdst3ozzmxori5gzylvpx6btxue6sbsmx7siok@6wajzdgwxfpa> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 05, 2024 at 04:11:33PM +0100, Jiri Olsa wrote: > On Thu, Jan 04, 2024 at 07:45:49PM -0700, Daniel Xu wrote: > > SNIP > > > diff --git a/fs/verity/measure.c b/fs/verity/measure.c > > index bf7a5f4cccaf..3969d54158d1 100644 > > --- a/fs/verity/measure.c > > +++ b/fs/verity/measure.c > > @@ -159,9 +159,9 @@ __bpf_kfunc int bpf_get_fsverity_digest(struct file *file, struct bpf_dynptr_ker > > > > __bpf_kfunc_end_defs(); > > > > -BTF_SET8_START(fsverity_set_ids) > > +BTF_KFUNCS_START(fsverity_set_ids) > > BTF_ID_FLAGS(func, bpf_get_fsverity_digest, KF_TRUSTED_ARGS) > > -BTF_SET8_END(fsverity_set_ids) > > +BTF_KFUNCS_END(fsverity_set_ids) > > > > static int bpf_get_fsverity_digest_filter(const struct bpf_prog *prog, u32 kfunc_id) > > { > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > > index 51e8b4bee0c8..8cc718f37a9d 100644 > > --- a/kernel/bpf/btf.c > > +++ b/kernel/bpf/btf.c > > @@ -7802,6 +7802,10 @@ int register_btf_kfunc_id_set(enum bpf_prog_type prog_type, > > { > > enum btf_kfunc_hook hook; > > > > + /* All kfuncs need to be tagged as such in BTF */ > > + if (WARN_ON(!(kset->set->flags & BTF_SET8_KFUNCS))) > > + return -EINVAL; > > having the warning for module with wrong set8 flags seems wrong to me, > I think we should trigger the warn only for kernel calls.. by adding > kset->owner check in the condition above Just checking: The reasoning is that =m and out-of-tree modules can and should check return code, right? And =y modules or vmlinux-based registrations do not check return code, so WARN() is necessary? If so, I'd agree. [..] Thanks, Daniel