[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180227042525.gbfn3ul4baghipcv@ast-mbp>
Date: Mon, 26 Feb 2018 20:25:27 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: daniel@...earbox.net, netdev@...r.kernel.org,
oss-drivers@...ronome.com, Jiong Wang <jiong.wang@...ronome.com>
Subject: Re: [PATCH bpf-next 3/8] tools: bpftool: detect sub-programs from
the eBPF sequence
On Mon, Feb 26, 2018 at 08:12:49PM -0800, Jakub Kicinski wrote:
> From: Jiong Wang <jiong.wang@...ronome.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@...ronome.com>
> Acked-by: Jakub Kicinski <jakub.kicinski@...ronome.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.
Powered by blists - more mailing lists