[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7O=ScckAzDJCxgokR=VnwtQJayr8_0+PMQAbMJLKRNBQ@mail.gmail.com>
Date: Mon, 27 Jul 2020 14:19:54 -0700
From: Song Liu <song@...nel.org>
To: Quentin Monnet <quentin@...valent.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Paul Chaignon <paul@...ium.io>
Subject: Re: [PATCH bpf-next 1/2] tools: bpftool: skip type probe if name is
not found
On Fri, Jul 24, 2020 at 2:07 AM Quentin Monnet <quentin@...valent.com> wrote:
>
> For probing program and map types, bpftool loops on type values and uses
> the relevant type name in prog_type_name[] or map_type_name[]. To ensure
> the name exists, we exit from the loop if we go over the size of the
> array.
>
> However, this is not enough in the case where the arrays have "holes" in
> them, program or map types for which they have no name, but not at the
> end of the list. This is currently the case for BPF_PROG_TYPE_LSM, not
> known to bpftool and which name is a null string. When probing for
> features, bpftool attempts to strlen() that name and segfaults.
>
> Let's fix it by skipping probes for "unknown" program and map types,
> with an informational message giving the numeral value in that case.
>
> Fixes: 93a3545d812a ("tools/bpftool: Add name mappings for SK_LOOKUP prog and attach type")
> Reported-by: Paul Chaignon <paul@...ium.io>
> Signed-off-by: Quentin Monnet <quentin@...valent.com>
Acked-by: Song Liu <songliubraving@...com>
Powered by blists - more mailing lists