Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22804619rwd; Fri, 30 Jun 2023 12:58:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlFoN1vGbh9GPILbQZFG9/jZwQL0FUu+jjhtnRjiDUpEQTP2eYtixJDLKS2tG0JCY1F63zqD X-Received: by 2002:a05:6a00:1506:b0:668:97bf:5ed7 with SMTP id q6-20020a056a00150600b0066897bf5ed7mr5337844pfu.22.1688155110002; Fri, 30 Jun 2023 12:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688155109; cv=none; d=google.com; s=arc-20160816; b=OGCw4CS6qWp4GSOvwJBpJIxmYxq+/FmQnSjM3fYddFFJ8y30lDKCEI2VElPB0UBat4 H+vRTtP9jZ/lkcqrUhwlTzENWQzFYVri9MO3qbmlqBColRwO+GFnaOE4D0uod8tlokN2 mD3lpbWcFQkkUTIrWSlDF9jjRrHmWDbyu/FclPBlUDrvIDs/XpKtZTs7lpRsDoKgCGyK SK+aHD3k66uBYxPRb6GYmIEYIOtheHMAejQ124niMrgPjjIyOAUJkON18fqjiKmA6Dk0 gKRQkIkKKyjZVuRxdh4R8rva8n9nwi37cF7GvozAnPQdc7puLBYv71iXsnBX9Nw3aqc0 DFPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vzttVY1Ypwi2v7YjsH7h/RguqvD9T+rKkKCl+N1AMno=; fh=97oduAXuK+SUxNr2rzgPrxwrm3hNOZRAH1piO46Q9Os=; b=j53w2kUmySMQiJOmNcsuMLLxtt2+91VJGGfQWdyQQrXSDJrbul3ROV0BM2CjsvTaf8 FNwefQWLWQNUQQBebScsQhBffcG4ed2uhHDjOY1LaFZaTiONaNs75wdlfRm6ZIfv6G67 Jw5x9sIEAWmxKshS3M2nRBKstSKeouM3c+a9rsp1M65B5LJD1+PT9iXP9iHPRtINmg5y 87Pzckp9+0H/z8Xd6R2FdJ7kg1W9yhN5v4Ufe8cp+qZhIPTFriSnHNDWkmqz4SQJbgw5 IykqQmSdUFPG8edEANGyLVvLl8ecQ+rd4FWB3zwQGf0NkL1jE/KcA6w26RIpSOc0vC8g SulQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NonKhG++; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b0054ffea27c23si12891309pgd.285.2023.06.30.12.58.16; Fri, 30 Jun 2023 12:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NonKhG++; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbjF3Tte (ORCPT + 99 others); Fri, 30 Jun 2023 15:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbjF3Ttd (ORCPT ); Fri, 30 Jun 2023 15:49:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE874207; Fri, 30 Jun 2023 12:49:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 173D061773; Fri, 30 Jun 2023 19:49:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C58C433C0; Fri, 30 Jun 2023 19:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688154545; bh=MD2mmXn2BujHwGbkA0SwDFCzRe/pV64eJwW6B6myHxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NonKhG++5Jskw1vqZPUeTHrSPkfvV66bSppuC5D+VpCluvpx3r3qFkipS1Mo0edXY 28aKcDGmxguDDRrMohdL00+fXIbKdijJGQVLoC3C5Ye6b4iGDimjYLkkpXEEtTsgxn rnuUstrm8uYdvWsP6ttxjuUbguwu0m9jzfCTjmVJZidMz49qdkK7UncFSKhET51C+v /GblbXWWzHFIV3m4/PX3R280ioslG+jZhcG1ei5M+pAU7ofwIufMoVOuu5or3Psn7N +jXpTzRVOG5SOIzHRJ5P9Fylkz5HNiSs3IjB3lmEzokB5CqfhfNl3LYRj9d1NDnipd sTcSw6OYMgWjQ== From: SeongJae Park To: Daniel Borkmann Cc: SeongJae Park , martin.lau@linux.dev, Alexander.Egorenkov@ibm.com, ast@kernel.org, memxor@gmail.com, olsajiri@gmail.com, bpf@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Olsa Subject: Re: [PATCH v2] btf: warn but return no error for NULL btf from __register_btf_kfunc_id_set() Date: Fri, 30 Jun 2023 19:48:59 +0000 Message-Id: <20230630194859.100332-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Fri, 30 Jun 2023 16:53:38 +0200 Daniel Borkmann wrote: > On 6/28/23 6:46 PM, SeongJae Park wrote: > > __register_btf_kfunc_id_set() assumes .BTF to be part of the module's > > .ko file if CONFIG_DEBUG_INFO_BTF is enabled. If that's not the case, > > the function prints an error message and return an error. As a result, > > such modules cannot be loaded. > > > > However, the section could be stripped out during a build process. It > > would be better to let the modules loaded, because their basic > > functionalities have no problem[1], though the BTF functionalities will > > not be supported. Make the function to lower the level of the message > > from error to warn, and return no error. > > > > [1] https://lore.kernel.org/bpf/20220219082037.ow2kbq5brktf4f2u@apollo.legion/ > > > > Reported-by: Alexander Egorenkov > > Link: https://lore.kernel.org/bpf/87y228q66f.fsf@oc8242746057.ibm.com/ > > Suggested-by: Kumar Kartikeya Dwivedi > > Link: https://lore.kernel.org/bpf/20220219082037.ow2kbq5brktf4f2u@apollo.legion/ > > Fixes: c446fdacb10d ("bpf: fix register_btf_kfunc_id_set for !CONFIG_DEBUG_INFO_BTF") > > Cc: # 5.18.x > > Signed-off-by: SeongJae Park > > Acked-by: Jiri Olsa > > I presume this one is targeted at bpf (rather than bpf-next) tree, right? You're correct. It's not urgent for us, but I would prefer it to be merged into all affected kernels as early as possible. > > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > > index 6b682b8e4b50..d683f034996f 100644 > > --- a/kernel/bpf/btf.c > > +++ b/kernel/bpf/btf.c > > @@ -7848,14 +7848,10 @@ static int __register_btf_kfunc_id_set(enum btf_kfunc_hook hook, > > > > btf = btf_get_module_btf(kset->owner); > > if (!btf) { > > - if (!kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) { > > - pr_err("missing vmlinux BTF, cannot register kfuncs\n"); > > - return -ENOENT; > > - } > > Why the above one needs to be changed? Do you also run into this case? vmlinux BTF > should be built-in in this case. I understand it's rather the one below for BTF + > modules instead, no? Again, you're correct. This change is not really needed. I was interpreting Kumar's suggestion merely into code without thinking about his real meaning, sorry. I will restore this in the next spin. Thanks, SJ > > > - if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) { > > - pr_err("missing module BTF, cannot register kfuncs\n"); > > - return -ENOENT; > > - } > > + if (!kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) > > + pr_warn("missing vmlinux BTF, cannot register kfuncs\n"); > > + if (kset->owner && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES)) > > + pr_warn("missing module BTF, cannot register kfuncs\n"); > > return 0; > > } > > if (IS_ERR(btf)) > > > >