From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: daniel@iogearbox.net, netdev@vger.kernel.org,
oss-drivers@netronome.com, Jiong Wang <jiong.wang@netronome.com>
Subject: Re: [PATCH bpf-next 3/8] tools: bpftool: detect sub-programs from the eBPF sequence
Date: Mon, 26 Feb 2018 20:25:27 -0800 [thread overview]
Message-ID: <20180227042525.gbfn3ul4baghipcv@ast-mbp> (raw)
In-Reply-To: <20180227041254.32442-4-jakub.kicinski@netronome.com>
On Mon, Feb 26, 2018 at 08:12:49PM -0800, Jakub Kicinski wrote:
> From: Jiong Wang <jiong.wang@netronome.com>
>
> This patch detect all sub-programs from the eBPF sequence and keep the
> information in the new CFG data structure.
>
> The detection algorithm is basically the same as the one in verifier except
> we need to use insn->off instead of insn->imm to get the pc-relative call
> offset. Because verifier has modified insn->off/insn->imm during finishing
> the verification.
>
> Also, we don't need to do some sanity checks as verifier has done them.
>
> Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
overall idea looks good to me.
One step towards proper decompiler ;)
> diff --git a/tools/bpf/bpftool/cfg.c b/tools/bpf/bpftool/cfg.c
> new file mode 100644
> index 000000000000..42a0d4c4271c
> --- /dev/null
> +++ b/tools/bpf/bpftool/cfg.c
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright (C) 2018 Netronome Systems, Inc.
> + *
> + * This software is dual licensed under the GNU General License Version 2,
> + * June 1991 as shown in the file COPYING in the top-level directory of this
> + * source tree or the BSD 2-Clause License provided below. You have the
> + * option to license this software under the complete terms of either license.
please use SPDX instead.
next prev parent reply other threads:[~2018-02-27 4:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 4:12 [PATCH bpf-next 0/8] tools: bpftool: visualization support for eBPF program Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 1/8] tools: bpftool: remove unnecessary 'if' to reduce indentation Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 2/8] tools: bpftool: factor out xlated dump related code into separate file Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 3/8] tools: bpftool: detect sub-programs from the eBPF sequence Jakub Kicinski
2018-02-27 4:25 ` Alexei Starovoitov [this message]
2018-02-27 4:12 ` [PATCH bpf-next 4/8] tools: bpftool: partition basic-block for each function in the CFG Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 5/8] tools: bpftool: add out edges for each basic-block Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 6/8] tools: bpftool: generate .dot graph from CFG information Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 7/8] tools: bpftool: new command-line option and documentation for 'visual' Jakub Kicinski
2018-02-27 4:12 ` [PATCH bpf-next 8/8] tools: bpftool: add bash completion for CFG dump Jakub Kicinski
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=20180227042525.gbfn3ul4baghipcv@ast-mbp \
--to=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=jakub.kicinski@netronome.com \
--cc=jiong.wang@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/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