OSDN Git Service

bpf: introduce cgroup storage maps
authorRoman Gushchin <guro@fb.com>
Thu, 2 Aug 2018 21:27:18 +0000 (14:27 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 2 Aug 2018 22:47:32 +0000 (00:47 +0200)
commitde9cbbaadba5adf88a19e46df61f7054000838f6
tree6cfafffa94b145c7d4e0e986a75178262c843385
parent0a4c58f5702858822621fa1177c7d3475f181ccb
bpf: introduce cgroup storage maps

This commit introduces BPF_MAP_TYPE_CGROUP_STORAGE maps:
a special type of maps which are implementing the cgroup storage.

>From the userspace point of view it's almost a generic
hash map with the (cgroup inode id, attachment type) pair
used as a key.

The only difference is that some operations are restricted:
  1) a user can't create new entries,
  2) a user can't remove existing entries.

The lookup from userspace is o(log(n)).

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>
include/linux/bpf-cgroup.h
include/linux/bpf.h
include/linux/bpf_types.h
include/uapi/linux/bpf.h
kernel/bpf/Makefile
kernel/bpf/local_storage.c [new file with mode: 0644]
kernel/bpf/syscall.c
kernel/bpf/verifier.c