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: <CAP_z_CgAAAaAPGfYY2DErT_V2-E2e8E+fDHcGPVSaOq+_D9EeQ@mail.gmail.com>
Date: Tue, 3 Jun 2025 08:39:20 -0700
From: Blake Jones <blakejones@...gle.com>
To: Jiri Olsa <olsajiri@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, 
	Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, 
	Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>, 
	Ihor Solodrai <ihor.solodrai@...ux.dev>, Namhyung Kim <namhyung@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, bpf@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 1/2] libbpf: add support for printing BTF character
 arrays as strings

On Tue, Jun 3, 2025 at 6:18 AM Jiri Olsa <olsajiri@...il.com> wrote:
> > +static int btf_dump_string_data(struct btf_dump *d,
> > +                             const struct btf_type *t,
> > +                             __u32 id,
> > +                             const void *data)
> > +{
> > +     const struct btf_array *array = btf_array(t);
> > +     __u32 i;
> > +
> > +     btf_dump_data_pfx(d);
> > +     btf_dump_printf(d, "\"");
> > +
> > +     for (i = 0; i < array->nelems; i++, data++) {
> > +             char c;
> > +
> > +             if (data >= d->typed_dump->data_end)
> > +                     return -E2BIG;
>
> curious, is this just string array without null terminating byte?
> should we just print " and return 0 instead of E2BIG error ?

Good question. That E2BIG error would happen, for example, if we tried
to print the array "{ 'a', 'b', 'c' }" when the type was "char[4]".
I'd say your proposed behavior would be consistent with the semantic of
".emit_strings should display strings in an intuitively useful way",
and I'd be in favor of doing that (replacing "return -E2BIG" with "break").
If others agree (specifically Andrii, who had comments about the semantics
yesterday), I'll make that change.

Blake

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ