Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp835227rdb; Sat, 6 Jan 2024 11:10:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGovgp6o7otuItwvgVCEiJz6j9kucvT2+4CEYFYGFHyFRUofuXCq/QFqIBsA1ZNPK0/A2BU X-Received: by 2002:ac8:7f8a:0:b0:429:7aa2:66b5 with SMTP id z10-20020ac87f8a000000b004297aa266b5mr1863406qtj.1.1704568250058; Sat, 06 Jan 2024 11:10:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704568250; cv=none; d=google.com; s=arc-20160816; b=VN+Z4rQKQUJVVsi72AMbThg++vyCDwGZdqkwN2xDqnRaD+MSkGXghHgRHvqHD2nseE 3F+PVIQLivhztJ+dRcNhUfdafdFpO92PgZ3yFaNiS9ONgshYSdX0fwIkXt31zuDJ9DRB bXv7JdTBbPf5HO/TbPiPPIoCnkFZjOh79ET++RkoMbeM8/tzw974zKZ1N13wuFA38trj xvHj1ThypHKrCRiwNffN8KT0nEPn33Ji1ZYOpb2NcQW9fjxOeHGb2XZG7oRSYoj63XZ5 0SDoK1MTeN2HhzxNTINLCPMcDJBHXE3AZXMn6PaBb46MwAjEQ7u7t4GoBYH6FJnPdYVb scQQ== 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:date:from:dkim-signature; bh=XN11DcyrjCYH4UjdpvhQMOODqptexpORHaHrc+DxqLo=; fh=dk+TymJu8V6ttXTPEQeETTDoi2PA1o3OUuCCjWwWtag=; b=z34raPFldcdmxfm7pNiykGTY7VzMT/jq8tsF8r5kxhi7vPldLZL+zahcIYw9CTh71J MExq1c+d+Mjp/W2+IEE35DfvZt+uOuyt1pgGf1lf5ETy2Mj4b9DjJKP57nVguTPrKxSt b2X+ZrF1+/OMBg8VITFk9ln9MI8EhNlW5QD3elwm7CTluVDSr9dlDOrQjo+qWVYI5Zyz M7fZakyTmhsJ7Ub3eXLMwC4SQ6pa8z8ZmMU5A4Sj04U+e1xA2lC2+ngeD+A7+og7CHnq 5EOdQeTmS/rwe6e+O5liXqAbm8pm/yDETgHao98iC/wkjG5m4rCImyu4RKaR2/agsNmB NHKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ad7qaAEI; spf=pass (google.com: domain of linux-kernel+bounces-18698-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o4-20020ac85a44000000b0042831bea150si4446552qta.534.2024.01.06.11.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 11:10:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18698-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ad7qaAEI; spf=pass (google.com: domain of linux-kernel+bounces-18698-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18698-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CD8301C216A8 for ; Sat, 6 Jan 2024 19:10:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99B52F9C1; Sat, 6 Jan 2024 19:10:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ad7qaAEI" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4210E579; Sat, 6 Jan 2024 19:10:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40d5f40ce04so7355135e9.2; Sat, 06 Jan 2024 11:10:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704568226; x=1705173026; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=XN11DcyrjCYH4UjdpvhQMOODqptexpORHaHrc+DxqLo=; b=Ad7qaAEIu6rGtZu7FRJNbkn/W6Vn0yExBQDyDxWsA+UFC49sTYp7oIFJX8nR5V6GBn 5R3s8qOuwIKLXPU8ONFpzaDy10ePgoIDF/uhh80AfGrQ8lQnlCVMgHZkZAq/lsdtkOr8 m11Aljor9AIO0kwn6Ol6JDH3sms+RlQWTmolCOzWdmf3IwNw4oIt30qIhUvMfwQkdTwV +gS5AbmZFF+7an834PGr3dELKytMDxOaCLfVhpMUBbB+EdJBVlZu6BmbKGDP5UiNnL3/ UoGNlsDH2ktnRiAPGEPSHKe8E0jdQUJ1up1w8kD7cl7wvGepRjrTwaH965kBnUhLTDQU qgkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704568226; x=1705173026; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XN11DcyrjCYH4UjdpvhQMOODqptexpORHaHrc+DxqLo=; b=aLqBWsMWNuc+04ABplB8ptm02CAdcSJR47Lsjq1KbtJjCUA4THw57RSoGnXTg5gp0f mwd3zarmz7zvMxLBWjTy1L2Cbb5g74IhWyMf08p+03Qs2Sp92E+dvHrM3W43cB4c/ZCl pbtb1DcHOnumPQUJODBtAIvOL/WoE3/AYAnG7OekLlJYXl5UA2Cc3QSEkMhRYVS1tpZP 9mAUwn9Cr7x83e8nN6kng96gpLNa3zJkAZG+cUFTu3ngBLt0AIZvQ7MLjH9nXTWeJfCk THekz0y/sSqBlEGXoBB2KTJegiOUyBzZGJNU/AgigY8ryyugCsqDsj59Nj4Cffzs2Jxz noAw== X-Gm-Message-State: AOJu0YxFuTtdl0r+WObK0+BPRSxQvC91Bt7zeh0QsNQrlomBPfKW09cL 53wCXPuESoNnhT46/yxLmGY= X-Received: by 2002:a05:600c:1e01:b0:40d:871c:558d with SMTP id ay1-20020a05600c1e0100b0040d871c558dmr730414wmb.32.1704568225771; Sat, 06 Jan 2024 11:10:25 -0800 (PST) Received: from krava ([83.240.62.111]) by smtp.gmail.com with ESMTPSA id h17-20020a05600c351100b0040d5f466deesm5459251wmq.38.2024.01.06.11.10.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 11:10:25 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Sat, 6 Jan 2024 20:10:23 +0100 To: Daniel Xu Cc: Jiri Olsa , 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: References: <4tsn6x45gh3vgdst3ozzmxori5gzylvpx6btxue6sbsmx7siok@6wajzdgwxfpa> 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: <4tsn6x45gh3vgdst3ozzmxori5gzylvpx6btxue6sbsmx7siok@6wajzdgwxfpa> On Fri, Jan 05, 2024 at 09:55:43AM -0700, Daniel Xu wrote: > 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. right, I was also concerned we could flood console with loading module that just uses wrong set8.. perhaps we could just use WARN_ON_ONCE with no additional checks jirka