From: Andrii Nakryiko <andriin@fb.com>
To: <andrii.nakryiko@gmail.com>, <kernel-team@fb.com>, <ast@fb.com>,
<acme@kernel.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>, <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andriin@fb.com>
Subject: [PATCH bpf-next 1/5] selftests/bpf: fix btf_dedup testing code
Date: Wed, 27 Feb 2019 14:46:37 -0800 [thread overview]
Message-ID: <20190227224642.1069138-2-andriin@fb.com> (raw)
In-Reply-To: <20190227224642.1069138-1-andriin@fb.com>
btf_dedup testing code doesn't account for length of struct btf_header
when calculating the start of a string section. This patch fixes this
problem.
Fixes: 49b57e0d01db ("tools/bpf: remove btf__get_strings() superseded by raw data API")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/testing/selftests/bpf/.gitignore | 1 +
tools/testing/selftests/bpf/test_btf.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index e47168d1257d..3b74d23fffab 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -14,6 +14,7 @@ feature
test_libbpf_open
test_sock
test_sock_addr
+test_sock_fields
urandom_read
test_btf
test_sockmap
diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
index 02d314383a9c..1426c0a905c8 100644
--- a/tools/testing/selftests/bpf/test_btf.c
+++ b/tools/testing/selftests/bpf/test_btf.c
@@ -5936,9 +5936,9 @@ static int do_test_dedup(unsigned int test_num)
}
test_hdr = test_btf_data;
- test_strs = test_btf_data + test_hdr->str_off;
+ test_strs = test_btf_data + sizeof(*test_hdr) + test_hdr->str_off;
expect_hdr = expect_btf_data;
- expect_strs = expect_btf_data + expect_hdr->str_off;
+ expect_strs = expect_btf_data + sizeof(*test_hdr) + expect_hdr->str_off;
if (CHECK(test_hdr->str_len != expect_hdr->str_len,
"test_hdr->str_len:%u != expect_hdr->str_len:%u",
test_hdr->str_len, expect_hdr->str_len)) {
--
2.17.1
next prev parent reply other threads:[~2019-02-27 22:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 22:46 [PATCH bpf-next 0/5] btf_dedup algorithm and test fixes Andrii Nakryiko
2019-02-27 22:46 ` Andrii Nakryiko [this message]
2019-02-28 18:17 ` [PATCH bpf-next 1/5] selftests/bpf: fix btf_dedup testing code Song Liu
2019-02-28 18:19 ` Yonghong Song
2019-02-28 18:52 ` Arnaldo Carvalho de Melo
2019-02-28 19:19 ` Andrii Nakryiko
2019-02-27 22:46 ` [PATCH bpf-next 2/5] libbpf: fix formatting for btf_ext__get_raw_data Andrii Nakryiko
2019-02-28 18:17 ` Song Liu
2019-02-28 18:53 ` Arnaldo Carvalho de Melo
2019-02-28 19:20 ` Andrii Nakryiko
2019-02-27 22:46 ` [PATCH bpf-next 3/5] btf: allow to customize dedup hash table size Andrii Nakryiko
2019-02-28 18:27 ` Song Liu
2019-02-28 18:51 ` Andrii Nakryiko
2019-02-28 19:02 ` Song Liu
2019-02-28 19:40 ` Andrii Nakryiko
2019-02-28 19:56 ` Song Liu
2019-02-28 18:57 ` Arnaldo Carvalho de Melo
2019-02-28 20:08 ` Andrii Nakryiko
2019-02-27 22:46 ` [PATCH bpf-next 4/5] btf: fix bug with resolving STRUCT/UNION into corresponding FWD Andrii Nakryiko
2019-02-28 18:18 ` Yonghong Song
2019-02-28 19:07 ` Andrii Nakryiko
2019-02-28 19:41 ` Yonghong Song
2019-02-28 20:26 ` Andrii Nakryiko
2019-02-28 18:29 ` Song Liu
2019-02-27 22:46 ` [PATCH bpf-next 5/5] selftests/bpf: add btf_dedup test of FWD/STRUCT resolution Andrii Nakryiko
2019-02-28 18:29 ` Song Liu
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=20190227224642.1069138-2-andriin@fb.com \
--to=andriin@fb.com \
--cc=acme@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--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 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.