All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Roman Gushchin <guro@fb.com>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
	Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH v4 bpf-next 08/14] bpf: introduce the bpf_get_local_storage() helper function
Date: Wed, 1 Aug 2018 00:50:16 +0200	[thread overview]
Message-ID: <ad6c58e3-08a8-aa9c-2d69-528007fe126e@iogearbox.net> (raw)
In-Reply-To: <20180727215243.3850-9-guro@fb.com>

On 07/27/2018 11:52 PM, Roman Gushchin wrote:
[...]
> @@ -2533,6 +2541,16 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
>  	}
>  
>  	regs = cur_regs(env);
> +
> +	/* check that flags argument in get_local_storage(map, flags) is 0,
> +	 * this is required because get_local_storage() can't return an error.
> +	 */
> +	if (func_id == BPF_FUNC_get_local_storage &&
> +	    !tnum_equals_const(regs[BPF_REG_2].var_off, 0)) {
> +		verbose(env, "get_local_storage() doesn't support non-zero flags\n");
> +		return -EINVAL;
> +	}

Hmm, this check is actually not correct. You will still be able to pass non-zero
values in there. arg2_type from the helper is ARG_ANYTHING, so the register type
could for example be one of the pointer types and it will still pass the verifier.
The correct way to check would be to use register_is_null().

> +
>  	/* reset caller saved regs */
>  	for (i = 0; i < CALLER_SAVED_REGS; i++) {
>  		mark_reg_not_init(env, regs, caller_saved[i]);

  parent reply	other threads:[~2018-07-31 22:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 21:52 [PATCH v4 bpf-next 00/14] bpf: cgroup local storage Roman Gushchin
2018-07-27 21:52 ` Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 01/14] bpf: add ability to charge bpf maps memory dynamically Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 02/14] bpf: introduce cgroup storage maps Roman Gushchin
2018-07-27 21:52   ` Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 03/14] bpf: pass a pointer to a cgroup storage using pcpu variable Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 04/14] bpf: allocate cgroup storage entries on attaching bpf programs Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 05/14] bpf: extend bpf_prog_array to store pointers to the cgroup storage Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 06/14] bpf/verifier: introduce BPF_PTR_TO_MAP_VALUE Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 07/14] bpf: don't allow create maps of cgroup local storages Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 08/14] bpf: introduce the bpf_get_local_storage() helper function Roman Gushchin
2018-07-31 10:34   ` Daniel Borkmann
2018-07-31 17:24     ` Roman Gushchin
2018-07-31 22:50   ` Daniel Borkmann [this message]
2018-08-01  0:28     ` Roman Gushchin
2018-08-01 20:15       ` Daniel Borkmann
2018-07-27 21:52 ` [PATCH v4 bpf-next 09/14] bpf: sync bpf.h to tools/ Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 10/14] bpftool: add support for CGROUP_STORAGE maps Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 11/14] bpf/test_run: support cgroup local storage Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 12/14] selftests/bpf: add verifier cgroup storage tests Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 13/14] selftests/bpf: add a cgroup storage test Roman Gushchin
2018-07-27 21:52 ` [PATCH v4 bpf-next 14/14] samples/bpf: extend test_cgrp2_attach2 test to use cgroup storage Roman Gushchin

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=ad6c58e3-08a8-aa9c-2d69-528007fe126e@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=guro@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.