bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf] libbpf: Fix segfault in light skeleton for objects without BTF
Date: Fri, 1 Oct 2021 00:54:13 +0200	[thread overview]
Message-ID: <deb765c7-346d-de67-e249-23306996f216@iogearbox.net> (raw)
In-Reply-To: <20210930061634.1840768-1-memxor@gmail.com>

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) */
> 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 <memxor@gmail.com>

Looks like patchwork-bot is on vacation right now, this was applied thanks!

      reply	other threads:[~2021-09-30 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30  6:16 [PATCH bpf] libbpf: Fix segfault in light skeleton for objects without BTF Kumar Kartikeya Dwivedi
2021-09-30 22:54 ` Daniel Borkmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=deb765c7-346d-de67-e249-23306996f216@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=bpf@vger.kernel.org \
    --cc=memxor@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).