linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] bpf: don't accept cgroup local storage with zero value size
@ 2018-10-02  2:41 Roman Gushchin
  2018-10-02 12:43 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Roman Gushchin @ 2018-10-02  2:41 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, Kernel Team, Roman Gushchin, Alexei Starovoitov,
	Daniel Borkmann

Explicitly forbid creating cgroup local storage maps with zero value
size, as it makes no sense and might even cause a panic.

Reported-by: syzbot+18628320d3b14a5c459c@syzkaller.appspotmail.com
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
---
 kernel/bpf/local_storage.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c
index 944eb297465f..9f79956bff7d 100644
--- a/kernel/bpf/local_storage.c
+++ b/kernel/bpf/local_storage.c
@@ -261,6 +261,9 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr)
 	if (attr->key_size != sizeof(struct bpf_cgroup_storage_key))
 		return ERR_PTR(-EINVAL);
 
+	if (attr->value_size == 0)
+		return ERR_PTR(-EINVAL);
+
 	if (attr->value_size > PAGE_SIZE)
 		return ERR_PTR(-E2BIG);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf] bpf: don't accept cgroup local storage with zero value size
  2018-10-02  2:41 [PATCH bpf] bpf: don't accept cgroup local storage with zero value size Roman Gushchin
@ 2018-10-02 12:43 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2018-10-02 12:43 UTC (permalink / raw)
  To: Roman Gushchin, netdev; +Cc: linux-kernel, Kernel Team, Alexei Starovoitov

On 10/02/2018 04:41 AM, Roman Gushchin wrote:
> Explicitly forbid creating cgroup local storage maps with zero value
> size, as it makes no sense and might even cause a panic.
> 
> Reported-by: syzbot+18628320d3b14a5c459c@syzkaller.appspotmail.com
> Signed-off-by: Roman Gushchin <guro@fb.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>

Applied to bpf, thanks Roman!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-02 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02  2:41 [PATCH bpf] bpf: don't accept cgroup local storage with zero value size Roman Gushchin
2018-10-02 12:43 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).