From: Byeonguk Jeong <jungbu2855@gmail.com>
To: Hou Tao <houtao@huaweicloud.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Yonghong Song <yonghong.song@linux.dev>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpf: Fix out-of-bounds write in trie_get_next_key()
Date: Thu, 24 Oct 2024 10:48:21 +0900 [thread overview]
Message-ID: <ZxmnZWjSRVHgtbGZ@localhost.localdomain> (raw)
In-Reply-To: <da89a4cb-1824-2228-31ef-ad33ad6099cd@huaweicloud.com>
Hi,
On Wed, Oct 23, 2024 at 05:59:53PM +0800, Hou Tao wrote:
> Alexei suggested adding a bpf self-test for the patch. I think you
> could reference the code in lpm_trie_map_batch_ops.c [1] or similar and
> add a new file that uses bpf_map_get_next_key to demonstrate the
> out-of-bound problem. The test can be run by ./test_maps. There is some
> document for the procedure in [2].
>
> [1]: tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c
> [2]:
> https://github.com/torvalds/linux/blob/master/Documentation/bpf/bpf_devel_QA.rst
Okay, I will add a new test. Thanks for the detailed guideline.
> Which procedure will return -ENOENT ? I think the element with
> prefixlen=0 could still be found through the key with prefixlen = 0.
I mean, BPF_MAP_GET_NEXT_KEY with .prefixlen = 0 would give us -ENOENT,
as it follows postorder. BPF_MAP_LOOKUP_ELEM still find the element
with prefixlen 0 through the key with prefixlen 0 as you said.
next prev parent reply other threads:[~2024-10-24 1:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 1:45 [PATCH] bpf: Fix out-of-bounds write in trie_get_next_key() Byeonguk Jeong
2024-10-22 9:43 ` Toke Høiland-Jørgensen
2024-10-22 19:51 ` Alexei Starovoitov
2024-10-23 1:29 ` Byeonguk Jeong
2024-10-23 8:44 ` Byeonguk Jeong
2024-10-23 2:03 ` Hou Tao
2024-10-23 7:30 ` Byeonguk Jeong
2024-10-23 9:59 ` Hou Tao
2024-10-24 1:48 ` Byeonguk Jeong [this message]
2024-10-24 3:19 ` Hou Tao
2024-10-24 9:08 ` [PATCH] selftests/bpf: Add test for trie_get_next_key() Byeonguk Jeong
2024-10-24 9:41 ` Daniel Borkmann
2024-10-24 22:26 ` Byeonguk Jeong
2024-10-25 11:54 ` Hou Tao
2024-10-25 12:03 ` Daniel Borkmann
2024-10-25 11:53 ` Hou Tao
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=ZxmnZWjSRVHgtbGZ@localhost.localdomain \
--to=jungbu2855@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=houtao@huaweicloud.com \
--cc=linux-kernel@vger.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 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.