public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: Alexei Starovoitov <ast@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Cc: "daniel@iogearbox.net" <daniel@iogearbox.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"Kernel Team" <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next] bpf: Enforce 'return 0' in BTF-enabled raw_tp programs
Date: Tue, 29 Oct 2019 04:32:22 +0000	[thread overview]
Message-ID: <7493d20b-9056-3a2a-5f89-5bb9b2b933cf@fb.com> (raw)
In-Reply-To: <20191029032426.1206762-1-ast@kernel.org>

On 10/28/19 8:24 PM, Alexei Starovoitov wrote:
> The return value of raw_tp programs is ignored by __bpf_trace_run()
> that calls them. The verifier also allows any value to be returned.
> For BTF-enabled raw_tp lets enforce 'return 0', so that return value
> can be used for something in the future.
> 
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---

Looks good, if the return value is ignored, no need to specify anything 
but 0 for now.

Acked-by: Andrii Nakryiko <andriin@fb.com>

>   kernel/bpf/verifier.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index c59778c0fc4d..6b0de04f8b91 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -6279,6 +6279,11 @@ static int check_return_code(struct bpf_verifier_env *env)
>   	case BPF_PROG_TYPE_CGROUP_SYSCTL:
>   	case BPF_PROG_TYPE_CGROUP_SOCKOPT:
>   		break;
> +	case BPF_PROG_TYPE_RAW_TRACEPOINT:
> +		if (!env->prog->aux->attach_btf_id)
> +			return 0;
> +		range = tnum_const(0);
> +		break;
>   	default:
>   		return 0;
>   	}
> 


  reply	other threads:[~2019-10-29  4:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  3:24 [PATCH bpf-next] bpf: Enforce 'return 0' in BTF-enabled raw_tp programs Alexei Starovoitov
2019-10-29  4:32 ` Andrii Nakryiko [this message]
2019-10-30 15:53 ` Daniel Borkmann

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=7493d20b-9056-3a2a-5f89-5bb9b2b933cf@fb.com \
    --to=andriin@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox