bpf: allow . char as part of the object name
Trivial addition to allow '.' aside from '_' as "special" characters in the object name. Used to allow for substrings in maps from loader side such as ".bss", ".data", ".rodata", but could also be useful for other purposes. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Родитель
87df15de44
Коммит
3e0ddc4f3f
|
@ -474,10 +474,10 @@ static int bpf_obj_name_cpy(char *dst, const char *src)
|
||||||
const char *end = src + BPF_OBJ_NAME_LEN;
|
const char *end = src + BPF_OBJ_NAME_LEN;
|
||||||
|
|
||||||
memset(dst, 0, BPF_OBJ_NAME_LEN);
|
memset(dst, 0, BPF_OBJ_NAME_LEN);
|
||||||
|
/* Copy all isalnum(), '_' and '.' chars. */
|
||||||
/* Copy all isalnum() and '_' char */
|
|
||||||
while (src < end && *src) {
|
while (src < end && *src) {
|
||||||
if (!isalnum(*src) && *src != '_')
|
if (!isalnum(*src) &&
|
||||||
|
*src != '_' && *src != '.')
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче