netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii@kernel.org>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>, <ast@fb.com>, <daniel@iogearbox.net>
Cc: <kernel-team@fb.com>, Dmitrii Banshchikov <dbanschikov@fb.com>
Subject: Re: [PATCH bpf] libbpf: don't attempt to load unused subprog as an entry-point BPF program
Date: Sun, 8 Nov 2020 22:13:52 -0800	[thread overview]
Message-ID: <67fdbee5-14ba-360b-269f-d7030bd7062a@fb.com> (raw)
In-Reply-To: <20201107000251.256821-1-andrii@kernel.org>



On 11/6/20 4:02 PM, Andrii Nakryiko wrote:
> If BPF code contains unused BPF subprogram and there are no other subprogram
> calls (which can realistically happen in real-world applications given
> sufficiently smart Clang code optimizations), libbpf will erroneously assume
> that subprograms are entry-point programs and will attempt to load them with
> UNSPEC program type.
> 
> Fix by not relying on subcall instructions and rather detect it based on the
> structure of BPF object's sections.
> 
> Reported-by: Dmitrii Banshchikov <dbanschikov@fb.com>
> Fixes: 9a94f277c4fb ("tools: libbpf: restore the ability to load programs from .text section")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Acked-by: Yonghong Song <yhs@fb.com>

  reply	other threads:[~2020-11-09  6:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-07  0:02 [PATCH bpf] libbpf: don't attempt to load unused subprog as an entry-point BPF program Andrii Nakryiko
2020-11-09  6:13 ` Yonghong Song [this message]
2020-11-09 21:19 ` John Fastabend

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=67fdbee5-14ba-360b-269f-d7030bd7062a@fb.com \
    --to=yhs@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dbanschikov@fb.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).