Netdev List
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alban Crequy <alban.crequy@gmail.com>, ast@kernel.org
Cc: kafai@fb.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, alban@kinvolk.io, iago@kinvolk.io
Subject: Re: [PATCH bpf v2] bpf, lpm: fix lookup bug in map_delete_elem
Date: Fri, 22 Feb 2019 16:22:51 +0100	[thread overview]
Message-ID: <3ee7ff6a-116b-efea-bf81-045b882f28d1@iogearbox.net> (raw)
In-Reply-To: <20190222131908.6207-1-alban@kinvolk.io>

On 02/22/2019 02:19 PM, Alban Crequy wrote:
> From: Alban Crequy <alban@kinvolk.io>
> 
> trie_delete_elem() was deleting an entry even though it was not matching
> if the prefixlen was correct. This patch adds a check on matchlen.
> 
> Reproducer:
> 
> $ sudo bpftool map create /sys/fs/bpf/mylpm type lpm_trie key 8 value 1 entries 128 name mylpm flags 1
> $ sudo bpftool map update pinned /sys/fs/bpf/mylpm key hex 10 00 00 00 aa bb cc dd value hex 01
> $ sudo bpftool map dump pinned /sys/fs/bpf/mylpm
> key: 10 00 00 00 aa bb cc dd  value: 01
> Found 1 element
> $ sudo bpftool map delete pinned /sys/fs/bpf/mylpm key hex 10 00 00 00 ff ff ff ff
> $ echo $?
> 0
> $ sudo bpftool map dump pinned /sys/fs/bpf/mylpm
> Found 0 elements
> 
> A similar reproducer is added in the selftests.
> 
> Without the patch:
> 
> $ sudo ./tools/testing/selftests/bpf/test_lpm_map
> test_lpm_map: test_lpm_map.c:485: test_lpm_delete: Assertion `bpf_map_delete_elem(map_fd, key) == -1 && errno == ENOENT' failed.
> Aborted
> 
> With the patch: test_lpm_map runs without errors.
> 
> Fixes: e454cf595853 ("bpf: Implement map_delete_elem for BPF_MAP_TYPE_LPM_TRIE")
> Cc: Craig Gallek <kraig@google.com>
> Signed-off-by: Alban Crequy <alban@kinvolk.io>

Applied, thanks!

      parent reply	other threads:[~2019-02-22 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 13:19 [PATCH bpf v2] bpf, lpm: fix lookup bug in map_delete_elem Alban Crequy
2019-02-22 13:38 ` Alban Crequy
2019-02-22 15:03 ` Craig Gallek
2019-02-22 15:22 ` Daniel Borkmann [this message]

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=3ee7ff6a-116b-efea-bf81-045b882f28d1@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alban.crequy@gmail.com \
    --cc=alban@kinvolk.io \
    --cc=ast@kernel.org \
    --cc=iago@kinvolk.io \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox