lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7yDZCC+34L38HcjOXofM6_U_8tMpkgTxR3gZffCakoBQ@mail.gmail.com>
Date:   Mon, 17 May 2021 10:54:28 -0700
From:   Song Liu <song@...nel.org>
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>,
        KP Singh <kpsingh@...nel.org>, jackmanb@...gle.com,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf 1/2] bpf: Clarify a bpf_bprintf_prepare macro

On Mon, May 17, 2021 at 2:29 AM Florent Revest <revest@...omium.org> wrote:
>
> The per-cpu buffers contain bprintf data rather than printf arguments.
> The macro name and comment were a bit confusing, this rewords them in a
> clearer way.
>
> Signed-off-by: Florent Revest <revest@...omium.org>

Acked-by: Song Liu <song@...nel.org>

> ---
>  kernel/bpf/helpers.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index ef658a9ea5c9..3a5ab614cbb0 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -692,13 +692,14 @@ static int bpf_trace_copy_string(char *buf, void *unsafe_ptr, char fmt_ptype,
>         return -EINVAL;
>  }
>
> -/* Per-cpu temp buffers which can be used by printf-like helpers for %s or %p
> +/* Per-cpu temp buffers used by printf-like helpers to store the bprintf binary
> + * arguments representation.
>   */
> -#define MAX_PRINTF_BUF_LEN     512
> +#define MAX_BPRINTF_BUF_LEN    512
>
>  /* Support executing three nested bprintf helper calls on a given CPU */
>  struct bpf_bprintf_buffers {
> -       char tmp_bufs[3][MAX_PRINTF_BUF_LEN];
> +       char tmp_bufs[3][MAX_BPRINTF_BUF_LEN];
>  };
>  static DEFINE_PER_CPU(struct bpf_bprintf_buffers, bpf_bprintf_bufs);
>  static DEFINE_PER_CPU(int, bpf_bprintf_nest_level);
> @@ -761,7 +762,7 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args,
>                 if (num_args && try_get_fmt_tmp_buf(&tmp_buf))
>                         return -EBUSY;
>
> -               tmp_buf_end = tmp_buf + MAX_PRINTF_BUF_LEN;
> +               tmp_buf_end = tmp_buf + MAX_BPRINTF_BUF_LEN;
>                 *bin_args = (u32 *)tmp_buf;
>         }
>
> --
> 2.31.1.751.gd2f1c929bd-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ