[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzbt0hmhJVYGwc4wp+jp209ed75oUQcTXg-NTX5ABzFBzw@mail.gmail.com>
Date: Thu, 15 Apr 2021 16:11:35 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Florent Revest <revest@...omium.org>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Yonghong Song <yhs@...com>, KP Singh <kpsingh@...nel.org>,
Brendan Jackman <jackmanb@...omium.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v4 3/6] bpf: Add a bpf_snprintf helper
On Wed, Apr 14, 2021 at 11:54 AM Florent Revest <revest@...omium.org> wrote:
>
> The implementation takes inspiration from the existing bpf_trace_printk
> helper but there are a few differences:
>
> To allow for a large number of format-specifiers, parameters are
> provided in an array, like in bpf_seq_printf.
>
> Because the output string takes two arguments and the array of
> parameters also takes two arguments, the format string needs to fit in
> one argument. Thankfully, ARG_PTR_TO_CONST_STR is guaranteed to point to
> a zero-terminated read-only map so we don't need a format string length
> arg.
>
> Because the format-string is known at verification time, we also do
> a first pass of format string validation in the verifier logic. This
> makes debugging easier.
>
> Signed-off-by: Florent Revest <revest@...omium.org>
> ---
LGTM.
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> include/linux/bpf.h | 1 +
> include/uapi/linux/bpf.h | 28 +++++++++++++++++++
> kernel/bpf/helpers.c | 50 ++++++++++++++++++++++++++++++++++
> kernel/bpf/verifier.c | 41 ++++++++++++++++++++++++++++
> kernel/trace/bpf_trace.c | 2 ++
> tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++
> 6 files changed, 150 insertions(+)
>
[...]
Powered by blists - more mailing lists