From: Stanislav Fomichev <sdf@google.com>
To: Quentin Monnet <quentin@isovalent.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/5] bpftool: Fix bug for long instructions in program CFG dumps
Date: Fri, 24 Mar 2023 19:54:07 -0700 [thread overview]
Message-ID: <ZB5iT1ux8YIL/Jr8@google.com> (raw)
In-Reply-To: <20230324230209.161008-3-quentin@isovalent.com>
On 03/24, Quentin Monnet wrote:
> When dumping the control flow graphs for programs using the 16-byte long
> load instruction, we need to skip the second part of this instruction
> when looking for the next instruction to process. Otherwise, we end up
> printing "BUG_ld_00" from the kernel disassembler in the CFG.
> Fixes: efcef17a6d65 ("tools: bpftool: generate .dot graph from CFG
> information")
> Signed-off-by: Quentin Monnet <quentin@isovalent.com>
> ---
> tools/bpf/bpftool/xlated_dumper.c | 7 +++++++
> 1 file changed, 7 insertions(+)
> diff --git a/tools/bpf/bpftool/xlated_dumper.c
> b/tools/bpf/bpftool/xlated_dumper.c
> index 6fe3134ae45d..3daa05d9bbb7 100644
> --- a/tools/bpf/bpftool/xlated_dumper.c
> +++ b/tools/bpf/bpftool/xlated_dumper.c
> @@ -372,8 +372,15 @@ void dump_xlated_for_graph(struct dump_data *dd,
> void *buf_start, void *buf_end,
> struct bpf_insn *insn_start = buf_start;
> struct bpf_insn *insn_end = buf_end;
> struct bpf_insn *cur = insn_start;
> + bool double_insn = false;
> for (; cur <= insn_end; cur++) {
> + if (double_insn) {
> + double_insn = false;
> + continue;
> + }
> + double_insn = cur->code == (BPF_LD | BPF_IMM | BPF_DW);
> +
> printf("% 4d: ", (int)(cur - insn_start + start_idx));
> print_bpf_insn(&cbs, cur, true);
> if (cur != insn_end)
Any reason not to do the following here instead?
if (cur->code == (BPF_LD | BPF_IMM | BPF_DW))
cur++;
> --
> 2.34.1
next prev parent reply other threads:[~2023-03-25 2:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 23:02 [PATCH bpf-next 0/5] bpftool: Add inline annotations when dumping program CFGs Quentin Monnet
2023-03-24 23:02 ` [PATCH bpf-next 1/5] bpftool: Fix documentation about line info display for prog dumps Quentin Monnet
2023-03-24 23:02 ` [PATCH bpf-next 2/5] bpftool: Fix bug for long instructions in program CFG dumps Quentin Monnet
2023-03-25 2:54 ` Stanislav Fomichev [this message]
2023-03-27 10:30 ` Quentin Monnet
2023-03-24 23:02 ` [PATCH bpf-next 3/5] bpftool: Support inline annotations when dumping the CFG of a program Quentin Monnet
2023-03-25 3:05 ` Stanislav Fomichev
2023-03-27 10:30 ` Quentin Monnet
2023-03-24 23:02 ` [PATCH bpf-next 4/5] bpftool: Support "opcodes", "linum", "visual" simultaneously Quentin Monnet
2023-03-24 23:02 ` [PATCH bpf-next 5/5] bpftool: Support printing opcodes and source file references in CFG Quentin Monnet
2023-03-25 3:05 ` [PATCH bpf-next 0/5] bpftool: Add inline annotations when dumping program CFGs Stanislav Fomichev
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=ZB5iT1ux8YIL/Jr8@google.com \
--to=sdf@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=quentin@isovalent.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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