diff options
author | Roman Gushchin <guroan@gmail.com> | 2018-12-10 18:43:00 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-12-12 18:33:33 -0500 |
commit | 1b2b234b1318afb3775d4c6624fd5a96558f19df (patch) | |
tree | b473e992413a2c8c60195ae7c2606fb172012569 /kernel/bpf/syscall.c | |
parent | a0517a0f7ef23550b4484c37e2b9c2d32abebf64 (diff) |
bpf: pass struct btf pointer to the map_check_btf() callback
If key_type or value_type are of non-trivial data types
(e.g. structure or typedef), it's not possible to check them without
the additional information, which can't be obtained without a pointer
to the btf structure.
So, let's pass btf pointer to the map_check_btf() callbacks.
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 5745c7837621..70fb11106fc2 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -456,6 +456,7 @@ static int bpf_obj_name_cpy(char *dst, const char *src) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | int map_check_no_btf(const struct bpf_map *map, | 458 | int map_check_no_btf(const struct bpf_map *map, |
459 | const struct btf *btf, | ||
459 | const struct btf_type *key_type, | 460 | const struct btf_type *key_type, |
460 | const struct btf_type *value_type) | 461 | const struct btf_type *value_type) |
461 | { | 462 | { |
@@ -478,7 +479,7 @@ static int map_check_btf(const struct bpf_map *map, const struct btf *btf, | |||
478 | return -EINVAL; | 479 | return -EINVAL; |
479 | 480 | ||
480 | if (map->ops->map_check_btf) | 481 | if (map->ops->map_check_btf) |
481 | ret = map->ops->map_check_btf(map, key_type, value_type); | 482 | ret = map->ops->map_check_btf(map, btf, key_type, value_type); |
482 | 483 | ||
483 | return ret; | 484 | return ret; |
484 | } | 485 | } |