netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: davem@davemloft.net, Alexei Starovoitov <ast@kernel.org>,
	netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>,
	Kostya Serebryany <kcc@google.com>,
	Alexander Potapenko <glider@google.com>,
	Eric Dumazet <edumazet@google.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: Re: [PATCH net] bpf: fix allocation warnings in bpf maps and integer overflow
Date: Mon, 30 Nov 2015 15:30:34 -0800	[thread overview]
Message-ID: <20151130233033.GA67392@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <565CCACE.8020406@iogearbox.net>

On Mon, Nov 30, 2015 at 11:16:46PM +0100, Daniel Borkmann wrote:
> 
> So, when creating a sufficiently large map where map->key_size + map->value_size
> would be > MAX_BPF_STACK (but map->key_size still <= MAX_BPF_STACK), we can only
> read the map from an eBPF program, but not update it. In such cases, updates could
> only happen from user space application.

yes and no.
If both key_size + value_size > MAX_BPF_STACK, the program cannot technically
call bpf_map_update_elem() helper, but the user space can still populate large map
elements and the program can update it, since it can have a pointer via
bpf_map_lookup_elem(). So depends on definition of 'update'.

btw, the large-ish key support is actually needed too, since on tracing side
we need to be able to do map[kernel_stack_and_user_stack]++ and key is multipage long.
On userspace side it will be consumed by flamegraphs.

  reply	other threads:[~2015-11-30 23:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-29 13:18 user-controllable kmalloc size in bpf syscall Dmitry Vyukov
2015-11-29 18:21 ` Alexei Starovoitov
2015-11-30  0:59 ` [PATCH net] bpf: fix allocation warnings in bpf maps and integer overflow Alexei Starovoitov
2015-11-30 13:52   ` Daniel Borkmann
2015-11-30 13:57     ` Dmitry Vyukov
2015-11-30 14:13       ` Daniel Borkmann
2015-11-30 14:16         ` Dmitry Vyukov
2015-11-30 14:34     ` Daniel Borkmann
2015-11-30 18:13       ` Alexei Starovoitov
2015-11-30 22:16         ` Daniel Borkmann
2015-11-30 23:30           ` Alexei Starovoitov [this message]
2015-12-03  4:36   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151130233033.GA67392@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).