All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Cc: dev@dpdk.org, Konstantin Ananyev <konstantin.ananyev@huawei.com>,
	stable@dpdk.org, Isaac Boukris <iboukris@gmail.com>
Subject: Re: [PATCH 2/3] bfp: fix load hangs with six IPv6 addresses
Date: Thu, 27 Jun 2024 08:13:43 -0700	[thread overview]
Message-ID: <20240627081343.744b612d@hermes.local> (raw)
In-Reply-To: <20240627115531.1440-3-konstantin.v.ananyev@yandex.ru>

On Thu, 27 Jun 2024 12:55:30 +0100
Konstantin Ananyev <konstantin.v.ananyev@yandex.ru> wrote:
> From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 
> As described in: https://bugs.dpdk.org/show_bug.cgi?id=1465
> converting from following cBPF filter:
> "host 1::1 or host 1::1 or host 1::1 or host 1::1 or host 1::1 or host 1::1"
> taking too long for BPF verifier ito complete (up to 25 seconds).
> Looking at it I didn't find any actual functional bug.
> In fact, it does what is expected: goes through each possible path of
> BPF program and evaluates register/stack state for each instruction.
> The problem is that for program with a lot of conditional branches number
> of possible paths starts to grow exponentially and such walk becomes very
> excessive.
> So  to minimize number of evaluations, this patch implements heuristic
> similar to what Linux kernel does - state pruning:
> If from given instruction for given program state we explore all possible
> paths and for each of them reach bpf_exit() without any complaints and a
> valid R0 value, then for that instruction this program state can be
> marked as 'safe'. When we later arrive at the same instruction with a state
> equivalent to an earlier instruction 'safe' state, we can prune the search.
> For now, only states for JCC  targets are saved/examined.
> Plus added few extra logging for DEBUG level.
> 
> Bugzilla ID: 1465
> Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program")
> Cc: stable@dpdk.org

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

> +		struct bpf_eval_state *cur;   /*save/restore for jcc targets */

Nit: should have space after /* in this comment


  reply	other threads:[~2024-06-27 15:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 11:55 [PATCH 0/3] fix bpf load hangs with six IPv6 addresses Konstantin Ananyev
2024-06-27 11:55 ` [PATCH 1/3] bfp: fix MOV instruction evaluation Konstantin Ananyev
2024-06-27 11:55 ` [PATCH 2/3] bfp: fix load hangs with six IPv6 addresses Konstantin Ananyev
2024-06-27 15:13   ` Stephen Hemminger [this message]
2024-06-27 11:55 ` [PATCH 3/3] test/bpf: add extra test cases for bpf convert Konstantin Ananyev
2024-06-27 15:15   ` Stephen Hemminger
2024-06-27 12:41 ` [PATCH 0/3] fix bpf load hangs with six IPv6 addresses Morten Brørup
2024-06-27 18:04 ` [PATCH v2 " Konstantin Ananyev
2024-06-27 18:04   ` [PATCH v2 1/3] bfp: fix MOV instruction evaluation Konstantin Ananyev
2024-06-27 18:04   ` [PATCH v2 2/3] bfp: fix load hangs with six IPv6 addresses Konstantin Ananyev
2024-06-27 18:04   ` [PATCH v2 3/3] test/bpf: add extra test cases for bpf convert Konstantin Ananyev
2024-07-04 15:10   ` [PATCH v2 0/3] fix bpf load hangs with six IPv6 addresses David Marchand

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=20240627081343.744b612d@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=iboukris@gmail.com \
    --cc=konstantin.ananyev@huawei.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=stable@dpdk.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.