[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181127212330.862950-1-yhs@fb.com>
Date: Tue, 27 Nov 2018 13:23:26 -0800
From: Yonghong Song <yhs@...com>
To: <ast@...com>, <daniel@...earbox.net>, <netdev@...r.kernel.org>,
<kafai@...com>
CC: <kernel-team@...com>
Subject: [PATCH bpf v2 0/4] bpf: btf: check name validity for various types
This patch set added name checking for PTR, ARRAY, VOLATILE, TYPEDEF,
CONST, RESTRICT, STRUCT, UNION, ENUM and FWD types. Such a strict
name checking makes BTF more sound in the kernel and future
BTF-to-header-file converesion ([1]) less fragile.
Patch #1 implemented btf_name_valid_identifier() for name checking
which will be used in Patch #2.
Patch #2 checked name validity for the above mentioned types.
Patch #3 fixed two existing test_btf unit tests exposed by the strict
name checking.
Patch #4 added additional test cases.
This patch set is against bpf tree.
Patch #1 has been implemented in bpf-next commit
Commit 2667a2626f4d ("bpf: btf: Add BTF_KIND_FUNC
and BTF_KIND_FUNC_PROTO"), so there is no need to apply this
patch to bpf-next. In case this patch is applied to bpf-next,
there will be a minor conflict like
diff --cc kernel/bpf/btf.c
index a09b2f94ab25,93c233ab2db6..000000000000
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@@ -474,7 -451,7 +474,11 @@@ static bool btf_name_valid_identifier(c
return !*src;
}
++<<<<<<< HEAD
+const char *btf_name_by_offset(const struct btf *btf, u32 offset)
++=======
+ static const char *btf_name_by_offset(const struct btf *btf, u32 offset)
++>>>>>>> fa9566b0847d... bpf: btf: implement btf_name_valid_identifier()
{
if (!offset)
return "(anon)";
Just resolve the conflict by taking the "const char ..." line.
Patches #2, #3 and #4 can be applied to bpf-next without conflict.
[1]: http://vger.kernel.org/lpc-bpf2018.html#session-2
Yonghong Song (4):
bpf: btf: implement btf_name_valid_identifier()
bpf: btf: check name validity for various types
tools/bpf: fix two test_btf unit test cases
tools/bpf: add addition type tests to test_btf
kernel/bpf/btf.c | 82 ++++++
tools/testing/selftests/bpf/test_btf.c | 375 ++++++++++++++++++++++++-
2 files changed, 450 insertions(+), 7 deletions(-)
--
2.17.1
Powered by blists - more mailing lists