public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Yonghong Song <yonghong.song@linux.dev>
Cc: bpf@vger.kernel.org,  Alexei Starovoitov <ast@kernel.org>,
	 Andrii Nakryiko <andrii@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com,  Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH bpf-next v3 1/2] bpf: Do not include stack ptr register in precision backtracking bookkeeping
Date: Wed, 21 May 2025 14:59:15 -0700	[thread overview]
Message-ID: <m2zff5bp70.fsf@gmail.com> (raw)
In-Reply-To: <6885590a-266e-4230-9eeb-4fbfd7e2f3f4@linux.dev> (Yonghong Song's message of "Wed, 21 May 2025 14:35:48 -0700")

Yonghong Song <yonghong.song@linux.dev> writes:

[...]

> Let us say that we remove the code
>
> +    if (!src_reg) {
> +        if (linked_regs)
> +            return push_insn_history(env, state, 0, linked_regs);
> +        return 0;
> +    }
>
> The code should still work. But we might end up with more unnecessary
> jump history entries. For example,
>    dreg->type == PTR_TO_STACK, sreg is faked (i.e., BPF_SRC(insn->code) == BPF_K)
>    and linked_regs = 0
>
> In this particular, we will still generate a jump table entry which
> is not used in backtrack_insn().

If linked_regs set is not empty the push_insn_history() is necessary
even if src_reg is fake. Linked registers are handled at entry and at
exit from backtrack_insn() outside of instruction pattern match if-else
block.

  reply	other threads:[~2025-05-21 21:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21 17:04 [PATCH bpf-next v3 1/2] bpf: Do not include stack ptr register in precision backtracking bookkeeping Yonghong Song
2025-05-21 17:04 ` [PATCH bpf-next v3 2/2] selftests/bpf: Add tests with stack ptr register in conditional jmp Yonghong Song
2025-05-21 19:02   ` Eduard Zingerman
2025-05-21 20:57     ` Yonghong Song
2025-05-21 21:03       ` Eduard Zingerman
2025-05-21 18:55 ` [PATCH bpf-next v3 1/2] bpf: Do not include stack ptr register in precision backtracking bookkeeping Eduard Zingerman
2025-05-21 20:34   ` Yonghong Song
2025-05-21 20:58     ` Eduard Zingerman
2025-05-21 21:35       ` Yonghong Song
2025-05-21 21:59         ` Eduard Zingerman [this message]
2025-05-21 22:04           ` Eduard Zingerman
2025-05-21 22:38     ` Andrii Nakryiko
2025-05-21 22:49       ` Eduard Zingerman
2025-05-22  2:53         ` Yonghong Song
2025-05-22 20:05         ` Andrii Nakryiko

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=m2zff5bp70.fsf@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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