From: Yonghong Song <yhs@fb.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@fb.com>, Martin Lau <kafai@fb.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
Date: Wed, 17 Oct 2018 03:22:31 +0000 [thread overview]
Message-ID: <d1eb8e9b-3deb-c62b-c653-90109a482afb@fb.com> (raw)
In-Reply-To: <0f3f22dd-1f31-ac13-7bde-31d727ca523d@iogearbox.net>
On 10/15/18 3:36 PM, Daniel Borkmann wrote:
> On 10/12/2018 08:54 PM, Yonghong Song wrote:
> [...]
>> +static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
>> +{
>> + /* offset must be valid */
>> + const char *src = &btf->strings[offset];
>> +
>> + if (!isalpha(*src) && *src != '_')
>> + return false;
>> +
>> + src++;
>> + while (*src) {
>> + if (!isalnum(*src) && *src != '_')
>> + return false;
>> + src++;
>> + }
>> +
>> + return true;
>> +}
>
> Should there be an upper name length limit like KSYM_NAME_LEN? (Is it implied
> by the kvmalloc() limit?)
KSYM_NAME_LEN is good choice. Here, we check function names and
struct/union member names. In C, based on
https://stackoverflow.com/questions/2352209/max-identifier-length,
the identifier max length is 63. Some compiler implementation may vary.
KSYM_NAME_LEN is 128.
>
>> static const char *btf_name_by_offset(const struct btf *btf, u32 offset)
>> {
>> if (!offset)
>> @@ -747,7 +782,9 @@ static bool env_type_is_resolve_sink(const struct btf_verifier_env *env,
>> /* int, enum or void is a sink */
>> return !btf_type_needs_resolve(next_type);
>> case RESOLVE_PTR:
>> - /* int, enum, void, struct or array is a sink for ptr */
>> + /* int, enum, void, struct, array or func_ptoto is a sink
>> + * for ptr
>> + */
>> return !btf_type_is_modifier(next_type) &&
>> !btf_type_is_ptr(next_type);
>> case RESOLVE_STRUCT_OR_ARRAY:
next prev parent reply other threads:[~2018-10-17 11:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 18:54 [PATCH bpf-next 00/13] bpf: add btf func info support Yonghong Song
2018-10-12 18:54 ` [PATCH bpf-next 01/13] bpf: btf: Break up btf_type_is_void() Yonghong Song
2018-10-15 21:50 ` Daniel Borkmann
2018-10-12 18:54 ` [PATCH bpf-next 02/13] bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO Yonghong Song
2018-10-15 22:30 ` Daniel Borkmann
2018-10-17 3:11 ` Yonghong Song
2018-10-15 22:36 ` Daniel Borkmann
2018-10-17 3:22 ` Yonghong Song [this message]
2018-10-12 18:54 ` [PATCH bpf-next 03/13] tools/bpf: sync kernel btf.h header Yonghong Song
2018-10-12 18:54 ` [PATCH bpf-next 04/13] tools/bpf: add btf func/func_proto unit tests in selftest test_btf Yonghong Song
2018-10-16 18:27 ` [PATCH bpf-next 00/13] bpf: add btf func info support Alexei Starovoitov
2018-10-17 3:25 ` Yonghong Song
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=d1eb8e9b-3deb-c62b-c653-90109a482afb@fb.com \
--to=yhs@fb.com \
--cc=Kernel-team@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kafai@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox