Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7170651rwl; Fri, 30 Dec 2022 04:47:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXtA8qCBRQvmSRsdzL3YAEDS6D+HEmHMrfe/4S114pPSwFLnzafrg0ZuDoPByj5T6c5TCZps X-Received: by 2002:a17:902:e2ca:b0:18e:c6b0:b2f6 with SMTP id l10-20020a170902e2ca00b0018ec6b0b2f6mr29524303plc.14.1672404430093; Fri, 30 Dec 2022 04:47:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672404430; cv=none; d=google.com; s=arc-20160816; b=zk/DMtmwxVO/26oFBGt/w47CdWYCMw664XAUK9Y4dIKro17CtnJ4y4GNkP5TwORQEp lw7jXkJdauaO5sVDTPFrZdw2qoJcn1pL0gXAiNOL1X557TQbrLlgPAMBo93Pn1arWpBK RZ6f8PKx+ZD7DzPxFHszmWqAdNMgz+URgPLM/1Ctvr/90nMBh7hmA699bpXUhNTEFiBW MVD7rMVkn7vNE9YArd0G1l4CQ9V6WtDM+YbKzwnkM19NgSe5mRL1ohDqMC4BZ8vi3S93 jiip/izmoqS/UN0HMBAeM7aNFaA4SVQv/Fcin9WyWeHeJdDaVnY8xu6foX76PSDf0ewc tgWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AmLp0HHgGWL7/8ThVO7qlzgQpdCgrc/e4BU39twwl5o=; b=fqoWNfEbf5GybZAmd4DEhk0OQsqGA1hNhs7nVX5GeLD0D01z1Q9WzT1k2YhIFfcvVp ImhZKw2xVw64xk8hfGL+9hIzQeYi/h+Ctl90fpHvThr4SivbW85RFyVVyc9/8EXgDaOU nFRr6KPzP3wNASHH5xMAV8j8Dm0a+d8/DUadPXPpPE3H+PbkN4iEKzjiK2luElPnQIrK ukWjT3rCLDsW1pYFRFl+Cs0TInvcfh2tDNrIPqvAgg7as+6Yk2Tic+w/R5eW4aM0zQ5X 1KdXVLGV70caeAZ3T8BZojge+XEgLx9oes8vDH2yhWNbCvP1P5Auy7XUt/PGSf5MCIqx g3dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YCjvDOWG; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a170902834600b00188f9534a59si19880885pln.306.2022.12.30.04.47.01; Fri, 30 Dec 2022 04:47:10 -0800 (PST) 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=@linaro.org header.s=google header.b=YCjvDOWG; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235001AbiL3M2f (ORCPT + 63 others); Fri, 30 Dec 2022 07:28:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234993AbiL3M2b (ORCPT ); Fri, 30 Dec 2022 07:28:31 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2876EE010 for ; Fri, 30 Dec 2022 04:28:30 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id n4so21755108plp.1 for ; Fri, 30 Dec 2022 04:28:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AmLp0HHgGWL7/8ThVO7qlzgQpdCgrc/e4BU39twwl5o=; b=YCjvDOWG+/INvJ696xZyzGkzht/0VZ0jxtVpzQQqvNnRKYKdrZRkmvM+arZLJjN3oA 6CF6peywcvKZG4CNg1Vis34T4Z4Q8UqXw1Wb1cANHksjiv0C/Z8ehL/4gMnmWY6FtErO NLUSTyYZSaVakZ6+d9vNq4vpRifAOg795xhpzpcQedgian7cKysiRloHIP6gtWsyDGbo GBGALstptXKLT0acl5oOw48PKIt2yqeJjDHgmG30RImLNlczZcLGtBM5JdJSQQuprlgU a7wR83FuGfHTYxcO+5qX5lcyVeZdIqwfhIfIvZOsihrdGebj1ZRp5C3d804tn66BAwPk 3feQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AmLp0HHgGWL7/8ThVO7qlzgQpdCgrc/e4BU39twwl5o=; b=w8au7blJMTg9ulCqvQetplcWBdtsstRCWGOq6b5rsSYtIDCK1jPWAwcqdOwnjLczgO 9zxS5fJ88hoGt1qKDnp9IdKbvL9kJVCsRclrSbKrSpcpJ/Lzth8ezcHgN4LDyfdxBWrp gJMKt55gfFaeAsji0M9QlJVkGSTaJASWfwcyK7i8KtiIlmbGrgPjurZp7o0DGP9qKD+f CF/lGNrNKQ+B8TZyr4GQ70N1ZTym22J6FkpRpspCKrNRymAGqeJ5WPAuCNYWPQvHSiby Lt6dNiZN2CrF4561NWDM8/5fPBMHcz8ZXVdQYj7/QYJLCBoV38gWevjvlpFHyUFhWaRA oCfg== X-Gm-Message-State: AFqh2krlyAupjQ3E9JvkwIkTaSWtLS4yQg9BbD9LJRQv93fp+ef1B0+C 48PY4n76W3JMqkyPP/6g0sqUwA== X-Received: by 2002:a17:902:c942:b0:189:c93c:e5e6 with SMTP id i2-20020a170902c94200b00189c93ce5e6mr51604676pla.33.1672403309552; Fri, 30 Dec 2022 04:28:29 -0800 (PST) Received: from leoy-yangtze.lan (n058152048149.netvigator.com. [58.152.48.149]) by smtp.gmail.com with ESMTPSA id i6-20020a170902c94600b00189651e5c26sm14844203pla.236.2022.12.30.04.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 04:28:28 -0800 (PST) Date: Fri, 30 Dec 2022 20:28:21 +0800 From: Leo Yan To: Changbin Du Cc: Andrii Nakryiko , Quentin Monnet , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Shuah Khan , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Alexander Shishkin , Namhyung Kim , Mykola Lysenko , linux-perf-users@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 1/2] libbpf: show error info about missing ".BTF" section Message-ID: References: <20221217223509.88254-1-changbin.du@gmail.com> <20221217223509.88254-2-changbin.du@gmail.com> <20221220013114.zkkxkqh7orahxbzh@mail.google.com> <20221230121020.boqhrujywruq3oi2@mail.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221230121020.boqhrujywruq3oi2@mail.google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Fri, Dec 30, 2022 at 08:10:20PM +0800, Changbin Du wrote: > On Wed, Dec 21, 2022 at 11:55:24AM +0800, Leo Yan wrote: > > On Tue, Dec 20, 2022 at 04:13:13PM -0800, Andrii Nakryiko wrote: > > > > [...] > > > > > > > > > @@ -990,6 +990,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf, > > > > > > > err = 0; > > > > > > > > > > > > > > if (!btf_data) { > > > > > > > + pr_warn("failed to find '%s' ELF section in %s\n", BTF_ELF_SEC, path); > > > > > > > err = -ENOENT; > > > > > > > > btf_parse_elf() returns -ENOENT when ELF file doesn't contain BTF > > > > section, therefore, bpftool dumps error string "No such file or > > > > directory". It's confused that actually vmlinux is existed. > > > > > > > > I am wondering if we can use error -LIBBPF_ERRNO__FORMAT (or any > > > > better choice?) to replace -ENOENT at here, this can avoid bpftool to > > > > outputs "No such file or directory" in this case. > > > > > > The only really meaningful error code would be -ESRCH, which > > > strerror() will translate to "No such process", which is also > > > completely confusing. > > > > Or maybe -ENODATA (No data available) is a better choice? > > > > Thanks, > > Leo > > > Yan, will you have a patch for this suggestion? You are welcome to send a patch, otherwise, I can cook one. Thanks, Leo