Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22890802rwd; Fri, 30 Jun 2023 14:21:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlEl2xzegTtU6riuKkf3L9Mj9maQdwBJuCSOhMjfWDWmlnBV4b8Nl3pSaZPDgPZgzmKHxOm8 X-Received: by 2002:a05:6a00:2313:b0:668:73f5:dce0 with SMTP id h19-20020a056a00231300b0066873f5dce0mr3987064pfh.29.1688160082604; Fri, 30 Jun 2023 14:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688160082; cv=none; d=google.com; s=arc-20160816; b=DurpTFYMAVgdiDaejEIAIp5zrO75PZ505cbU4XORmEwtkDzh6tte5BFWmw8RL22ctD QTyI8RAdTv03t2apIFMwd8sil2XokCVcFdBYV1MaocgB4idO2dgm2OwU+cX+BtabEyJA jPcIIKOstq0fUyb57uyDSy/IjVeqEySpBZp/I7r5DW0FXe8Vjq51y1dmfMU/r+0Jjvq1 CBkc56gBc5PVNkYkna5HuP8R+qXC9sZy1vMFjOKCrx9XeuCwPn1AReSnzcekxfx4gQRb ZpoOvP9C2hkDGDsuydFBEq+j06g0o/hZa3L0JM0NtG8bC9y11lXEjEKiIIaVOd6s9BUt Eitg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=BEH1BowktuuStjJyeH3e8YBBtNZC3SC1+Libjz6/Dj8=; fh=64iqY+JsOOWpXPR8Vl3+mxU4WXieGgWT31HVsNrBv6c=; b=cKl9LBAG8CbU3F0vS9mvoi9qI+ceGKRqSkwC21SsBcVzHNv3FPFU2ydm1KEDlIcbwC o9gnCjaEfhxOYaj62ePR5pd4131FvohweRFWmBtRe++l6gqYTo2Ng7RkqNqeEn8oEy23 3W/bK+aEL3PFFu+/gI8VsJ5XRFYcrJC2Dq+YyAv7yXSThAq76JxjJO7xkSLGTXwHAiAY ec1GFfUATeOyDYcSTcp0jWKkLkO5eswF9JiE/h/O+P/mrV0Emq6kdOFTX+pH/CXycr4M CWUlw0ptUwL2iNy4DmRUVyXnkmIfiT2p4hHqoF2e3kee5H3mP8dYUvLOEXFrAG1oXT+/ csLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@iogearbox.net header.s=default2302 header.b=lW574RdS; 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=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a634653000000b0055771146c25si3285170pgk.896.2023.06.30.14.21.08; Fri, 30 Jun 2023 14:21:22 -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=@iogearbox.net header.s=default2302 header.b=lW574RdS; 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=REJECT sp=NONE dis=NONE) header.from=iogearbox.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232673AbjF3Uwi (ORCPT + 99 others); Fri, 30 Jun 2023 16:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232666AbjF3Uwg (ORCPT ); Fri, 30 Jun 2023 16:52:36 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC6E3C2D; Fri, 30 Jun 2023 13:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=iogearbox.net; s=default2302; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=BEH1BowktuuStjJyeH3e8YBBtNZC3SC1+Libjz6/Dj8=; b=lW574RdS0doFq42rK/UIqsZuRL WnNSsLX/ZVMsZR0EKjfqfSCl2t5qiZhecH2/EYVCOjhYmRV5kQf/HAsAWQdl+zUyfZ9BcnaYwfc9C a4qRCp6E4tXR7Lbf1Ho4+PPcjhKOABHUXIfm00XXYNYdXtF/utqBBIKsRn+3XJ1br8jDTtjodV2bn jGQatFCT9w6sAUZ4UISN1Y9AJ3RZao9xc+1e0pcpc18ePEWgOtCZRYZvw+jsUxUTalrJ42Y3W2Dtz EMcELk9+K75r84r+tLvOgeB7VjiPt1xc58k8PBVGHTnLa7IvPLwZAxKZajq+ljWyP7buvDZfKUSBW 8e6ZbcMg==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qFL6P-000Gji-5a; Fri, 30 Jun 2023 22:52:25 +0200 Received: from [85.1.206.226] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFL6O-000FsX-QE; Fri, 30 Jun 2023 22:52:24 +0200 Subject: Re: [PATCH v2] btf: warn but return no error for NULL btf from __register_btf_kfunc_id_set() To: SeongJae Park Cc: 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 References: <20230630194859.100332-1-sj@kernel.org> From: Daniel Borkmann Message-ID: <75483b53-bd8e-692e-ed18-a4c87cf20a1b@iogearbox.net> Date: Fri, 30 Jun 2023 22:52:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20230630194859.100332-1-sj@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.8/26955/Fri Jun 30 09:29:09 2023) X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 6/30/23 9:48 PM, SeongJae Park wrote: > 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. Ok, sounds good, bpf tree it is then. >>> 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. Perfect, I think after your v3 respin it should be good to land. Thanks, Daniel