summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorLorenz Bauer <lmb@cloudflare.com>2020-08-21 11:29:46 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-08-21 15:16:11 -0700
commit912f442cfb1fc695510e055bdae5f4a88e4de6b8 (patch)
tree4b5729a9ac1a0edc42fdcb1f9a9eef7438265ca6 /net/core
parent13b79d3ffbb8add9e2a6d604db2b49f241b97303 (diff)
downloadlinux-912f442cfb1fc695510e055bdae5f4a88e4de6b8.tar.gz
linux-912f442cfb1fc695510e055bdae5f4a88e4de6b8.tar.bz2
linux-912f442cfb1fc695510e055bdae5f4a88e4de6b8.zip
bpf: Override the meaning of ARG_PTR_TO_MAP_VALUE for sockmap and sockhash
The verifier assumes that map values are simple blobs of memory, and therefore treats ARG_PTR_TO_MAP_VALUE, etc. as such. However, there are map types where this isn't true. For example, sockmap and sockhash store sockets. In general this isn't a big problem: we can just write helpers that explicitly requests PTR_TO_SOCKET instead of ARG_PTR_TO_MAP_VALUE. The one exception are the standard map helpers like map_update_elem, map_lookup_elem, etc. Here it would be nice we could overload the function prototype for different kinds of maps. Unfortunately, this isn't entirely straight forward: We only know the type of the map once we have resolved meta->map_ptr in check_func_arg. This means we can't swap out the prototype in check_helper_call until we're half way through the function. Instead, modify check_func_arg to treat ARG_PTR_TO_MAP_VALUE to mean "the native type for the map" instead of "pointer to memory" for sockmap and sockhash. This means we don't have to modify the function prototype at all Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20200821102948.21918-5-lmb@cloudflare.com
Diffstat (limited to 'net/core')
0 files changed, 0 insertions, 0 deletions