]> asedeno.scripts.mit.edu Git - linux.git/commit
bpf: do not retain flags that are not tied to map lifetime
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 9 Apr 2019 21:20:04 +0000 (23:20 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Apr 2019 00:05:46 +0000 (17:05 -0700)
commitbe70bcd53de66e86f2726e576307cbdaebd3b1a5
treeccb4db3b335d05ccd7f494b5139f4a5c9f2112c1
parentd8eca5bbb2be9bc7546f9e733786fa2f1a594c67
bpf: do not retain flags that are not tied to map lifetime

Both BPF_F_WRONLY / BPF_F_RDONLY flags are tied to the map file
descriptor, but not to the map object itself! Meaning, at map
creation time BPF_F_RDONLY can be set to make the map read-only
from syscall side, but this holds only for the returned fd, so
any other fd either retrieved via bpf file system or via map id
for the very same underlying map object can have read-write access
instead.

Given that, keeping the two flags around in the map_flags attribute
and exposing them to user space upon map dump is misleading and
may lead to false conclusions. Since these two flags are not
tied to the map object lets also not store them as map property.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c