From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 095A6C433F5 for ; Thu, 30 Sep 2021 22:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC51D61882 for ; Thu, 30 Sep 2021 22:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230136AbhI3Wz7 (ORCPT ); Thu, 30 Sep 2021 18:55:59 -0400 Received: from www62.your-server.de ([213.133.104.62]:41696 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbhI3Wz6 (ORCPT ); Thu, 30 Sep 2021 18:55:58 -0400 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mW4wQ-0006Bk-HC; Fri, 01 Oct 2021 00:54:14 +0200 Received: from [85.1.206.226] (helo=linux.home) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mW4wQ-000NMQ-Ar; Fri, 01 Oct 2021 00:54:14 +0200 Subject: Re: [PATCH bpf] libbpf: Fix segfault in light skeleton for objects without BTF To: Kumar Kartikeya Dwivedi , bpf@vger.kernel.org References: <20210930061634.1840768-1-memxor@gmail.com> From: Daniel Borkmann Message-ID: Date: Fri, 1 Oct 2021 00:54:13 +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: <20210930061634.1840768-1-memxor@gmail.com> 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.3/26308/Thu Sep 30 11:04:45 2021) Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 9/30/21 8:16 AM, Kumar Kartikeya Dwivedi wrote: > When fed an empty BPF object, bpftool gen skeleton -L crashes at > btf__set_fd since it assumes presence of obj->btf, however for the > sequence below clang adds no .BTF section (hence no BTF). > > Reproducer: > $ touch a.bpf.c > $ clang -O2 -g -target bpf -c a.bpf.c > $ bpftool gen skeleton -L a.bpf.o > /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ > /* THIS FILE IS AUTOGENERATED! */ > > struct a_bpf { > struct bpf_loader_ctx ctx; > Segmentation fault (core dumped) > > The same occurs for files compiled without BTF info, i.e. without > clang's -g flag. > > Fixes: 67234743736a (libbpf: Generate loader program out of BPF ELF file.) > Signed-off-by: Kumar Kartikeya Dwivedi Looks like patchwork-bot is on vacation right now, this was applied thanks!