[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d1eb8e9b-3deb-c62b-c653-90109a482afb@fb.com>
Date: Wed, 17 Oct 2018 03:22:31 +0000
From: Yonghong Song <yhs@...com>
To: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...com>, Martin Lau <kafai@...com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH bpf-next 02/13] bpf: btf: Add BTF_KIND_FUNC and
BTF_KIND_FUNC_PROTO
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:
Powered by blists - more mailing lists