bpf: Add syscall lookup support for fd array and htab
authorMartin KaFai Lau <kafai@fb.com>
Wed, 28 Jun 2017 06:08:34 +0000 (23:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Jun 2017 17:13:25 +0000 (13:13 -0400)
commit14dc6f04f49dc12614d7e90928b495b8d73cd471
tree159ebddef04be2ae417c503ab46593be570c680f
parent77b0d3617738e532bae683bf9d88ea35fff223e5
bpf: Add syscall lookup support for fd array and htab

This patch allows userspace to do BPF_MAP_LOOKUP_ELEM on
BPF_MAP_TYPE_PROG_ARRAY,
BPF_MAP_TYPE_ARRAY_OF_MAPS and
BPF_MAP_TYPE_HASH_OF_MAPS.

The lookup returns a prog-id or map-id to the userspace.
The userspace can then use the BPF_PROG_GET_FD_BY_ID
or BPF_MAP_GET_FD_BY_ID to get a fd.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/bpf.h
kernel/bpf/arraymap.c
kernel/bpf/hashtab.c
kernel/bpf/map_in_map.c
kernel/bpf/map_in_map.h
kernel/bpf/syscall.c