bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: <bpf@vger.kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>, <kernel-team@fb.com>
Subject: [PATCH bpf-next v2 07/11] selftests/bpf: change NAME_NTH/IS_NAME_NTH for BTF_KIND_TAG format
Date: Mon, 13 Sep 2021 08:52:00 -0700	[thread overview]
Message-ID: <20210913155200.3728013-1-yhs@fb.com> (raw)
In-Reply-To: <20210913155122.3722704-1-yhs@fb.com>

BTF_KIND_TAG ELF format has a component_idx which might have value -1.
test_btf may confuse it with common_type.name as NAME_NTH checkes
high 16bit to be 0xffff. Change NAME_NTH high 16bit check to be
0xfffe so it won't confuse with component_idx.

Signed-off-by: Yonghong Song <yhs@fb.com>
---
 tools/testing/selftests/bpf/prog_tests/btf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
index 649f87382c8d..ad39f4d588d0 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf.c
@@ -39,8 +39,8 @@ static bool always_log;
 #define BTF_END_RAW 0xdeadbeef
 #define NAME_TBD 0xdeadb33f
 
-#define NAME_NTH(N) (0xffff0000 | N)
-#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xffff0000)
+#define NAME_NTH(N) (0xfffe0000 | N)
+#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xfffe0000)
 #define GET_NAME_NTH_IDX(X) (X & 0x0000ffff)
 
 #define MAX_NR_RAW_U32 1024
-- 
2.30.2


  parent reply	other threads:[~2021-09-13 15:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 15:51 [PATCH bpf-next v2 00/11] bpf: add support for new btf kind BTF_KIND_TAG Yonghong Song
2021-09-13 15:51 ` [PATCH bpf-next v2 01/11] btf: change BTF_KIND_* macros to enums Yonghong Song
2021-09-14  4:59   ` Andrii Nakryiko
2021-09-14 15:53     ` Yonghong Song
2021-09-13 15:51 ` [PATCH bpf-next v2 02/11] bpf: support for new btf kind BTF_KIND_TAG Yonghong Song
2021-09-14  5:08   ` Andrii Nakryiko
2021-09-14 15:59     ` Yonghong Song
2021-09-14 23:30       ` Andrii Nakryiko
2021-09-13 15:51 ` [PATCH bpf-next v2 03/11] libbpf: rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag Yonghong Song
2021-09-13 15:51 ` [PATCH bpf-next v2 04/11] libbpf: add support for BTF_KIND_TAG Yonghong Song
2021-09-14  5:15   ` Andrii Nakryiko
2021-09-14 16:42     ` Yonghong Song
2021-09-13 15:51 ` [PATCH bpf-next v2 05/11] bpftool: " Yonghong Song
2021-09-14  5:16   ` Andrii Nakryiko
2021-09-13 15:51 ` [PATCH bpf-next v2 06/11] selftests/bpf: test libbpf API function btf__add_tag() Yonghong Song
2021-09-14  5:18   ` Andrii Nakryiko
2021-09-13 15:52 ` Yonghong Song [this message]
2021-09-14  5:23   ` [PATCH bpf-next v2 07/11] selftests/bpf: change NAME_NTH/IS_NAME_NTH for BTF_KIND_TAG format Andrii Nakryiko
2021-09-13 15:52 ` [PATCH bpf-next v2 08/11] selftests/bpf: add BTF_KIND_TAG unit tests Yonghong Song
2021-09-14  5:31   ` Andrii Nakryiko
2021-09-14 17:00     ` Yonghong Song
2021-09-13 15:52 ` [PATCH bpf-next v2 09/11] selftests/bpf: test BTF_KIND_TAG for deduplication Yonghong Song
2021-09-14  5:38   ` Andrii Nakryiko
2021-09-14 17:15     ` Yonghong Song
2021-09-14 19:39     ` Yonghong Song
2021-09-14 23:31       ` Andrii Nakryiko
2021-09-13 15:52 ` [PATCH bpf-next v2 10/11] selftests/bpf: add a test with a bpf program with btf_tag attributes Yonghong Song
2021-09-13 15:52 ` [PATCH bpf-next v2 11/11] docs/bpf: add documentation for BTF_KIND_TAG Yonghong Song
2021-09-14  5:40   ` Andrii Nakryiko
2021-09-13 16:08 ` [PATCH bpf-next v2 00/11] bpf: add support for new btf kind BTF_KIND_TAG Yonghong Song
2021-09-13 16:40   ` Jose E. Marchesi
2021-12-16 21:52     ` Yonghong Song
2021-12-17 10:40       ` Jose E. Marchesi
2021-12-18  1:44         ` Alexei Starovoitov
2021-12-18 20:15           ` Yonghong Song
2021-12-20  9:49             ` Jose E. Marchesi
2021-12-20 15:52               ` Yonghong Song
2022-01-25  3:58               ` Yonghong Song
2022-01-27 15:38                 ` Jose E. Marchesi
2022-01-27 16:42                   ` Yonghong Song
2022-02-17 13:20                     ` Jose E. Marchesi
2022-02-17 15:28                       ` Alexei Starovoitov
2022-02-17 16:41                         ` Jose E. Marchesi

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=20210913155200.3728013-1-yhs@fb.com \
    --to=yhs@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).