From: Konstantin Ananyev <konstantin.ananyev@intel.com> To: dev@dpdk.org Cc: stephen@networkplumber.org, jerinj@marvell.com, Konstantin Ananyev <konstantin.ananyev@intel.com>, stable@dpdk.org Subject: [dpdk-stable] [PATCH 2/5] bpf: fix add/sub min/max estimations Date: Mon, 18 May 2020 16:52:42 +0100 Message-ID: <20200518155245.11380-3-konstantin.ananyev@intel.com> (raw) In-Reply-To: <20200518155245.11380-1-konstantin.ananyev@intel.com> eval_add()/eval_sub() not always correctly estimate minimum and maximum possible values of add/sub operations. Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- lib/librte_bpf/bpf_validate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_bpf/bpf_validate.c b/lib/librte_bpf/bpf_validate.c index 6bd6f78e9..80d21fabb 100644 --- a/lib/librte_bpf/bpf_validate.c +++ b/lib/librte_bpf/bpf_validate.c @@ -226,7 +226,7 @@ eval_add(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, uint64_t msk) struct bpf_reg_val rv; rv.u.min = (rd->u.min + rs->u.min) & msk; - rv.u.max = (rd->u.min + rs->u.max) & msk; + rv.u.max = (rd->u.max + rs->u.max) & msk; rv.s.min = (rd->s.min + rs->s.min) & msk; rv.s.max = (rd->s.max + rs->s.max) & msk; @@ -254,10 +254,10 @@ eval_sub(struct bpf_reg_val *rd, const struct bpf_reg_val *rs, uint64_t msk) { struct bpf_reg_val rv; - rv.u.min = (rd->u.min - rs->u.min) & msk; - rv.u.max = (rd->u.min - rs->u.max) & msk; - rv.s.min = (rd->s.min - rs->s.min) & msk; - rv.s.max = (rd->s.max - rs->s.max) & msk; + rv.u.min = (rd->u.min - rs->u.max) & msk; + rv.u.max = (rd->u.max - rs->u.min) & msk; + rv.s.min = (rd->s.min - rs->s.max) & msk; + rv.s.max = (rd->s.max - rs->s.min) & msk; /* * if at least one of the operands is not constant, -- 2.17.1
next prev parent reply other threads:[~2020-05-18 15:53 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20200518155245.11380-1-konstantin.ananyev@intel.com> 2020-05-18 15:52 ` [dpdk-stable] [PATCH 1/5] test/bpf: fix few small issues Konstantin Ananyev 2020-06-24 21:33 ` Thomas Monjalon 2020-05-18 15:52 ` Konstantin Ananyev [this message] [not found] ` <20200527141653.15576-1-konstantin.ananyev@intel.com> 2020-05-27 14:16 ` [dpdk-stable] [PATCH v2 " Konstantin Ananyev 2020-05-27 14:16 ` [dpdk-stable] [PATCH v2 2/5] bpf: fix add/sub min/max estimations Konstantin Ananyev
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=20200518155245.11380-3-konstantin.ananyev@intel.com \ --to=konstantin.ananyev@intel.com \ --cc=dev@dpdk.org \ --cc=jerinj@marvell.com \ --cc=stable@dpdk.org \ --cc=stephen@networkplumber.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
patches for DPDK stable branches This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \ stable@dpdk.org public-inbox-index stable Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.stable AGPL code for this site: git clone https://public-inbox.org/public-inbox.git