[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+UOoDXYKyrw0FoSajeVOXO+2LAFv9Ouu5VPtMeF6vVuA@mail.gmail.com>
Date: Tue, 7 Mar 2023 07:53:06 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, bpf <bpf@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <llvm@...ts.linux.dev>, patches@...ts.linux.dev
Subject: Re: [PATCH bpf-next] bpf: Increase size of BTF_ID_LIST without
CONFIG_DEBUG_INFO_BTF again
On Tue, Mar 7, 2023 at 7:14 AM Nathan Chancellor <nathan@...nel.org> wrote:
>
> After commit 66e3a13e7c2c ("bpf: Add bpf_dynptr_slice and
> bpf_dynptr_slice_rdwr"), clang builds without CONFIG_DEBUG_INFO_BTF
please don't break commit subj into multiple lines.
I've fixed it manually this time while applying.
> warn:
>
> kernel/bpf/verifier.c:10298:24: warning: array index 16 is past the end of the array (that has type 'u32[16]' (aka 'unsigned int[16]')) [-Warray-bounds]
> meta.func_id == special_kfunc_list[KF_bpf_dynptr_slice_rdwr]) {
> ^ ~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/verifier.c:9150:1: note: array 'special_kfunc_list' declared here
> BTF_ID_LIST(special_kfunc_list)
> ^
> include/linux/btf_ids.h:207:27: note: expanded from macro 'BTF_ID_LIST'
> #define BTF_ID_LIST(name) static u32 __maybe_unused name[16];
> ^
> 1 warning generated.
>
> A warning of this nature was previously addressed by
> commit beb3d47d1d3d ("bpf: Fix a BTF_ID_LIST bug with
> CONFIG_DEBUG_INFO_BTF not set") but there have been new kfuncs added
and here.
> since then.
>
> Quadruple the size of the CONFIG_DEBUG_INFO_BTF=n definition so that
> this problem is unlikely to show up for some time.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1810
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
> ---
> include/linux/btf_ids.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
> index 3a4f7cd882ca..00950cc03bff 100644
> --- a/include/linux/btf_ids.h
> +++ b/include/linux/btf_ids.h
> @@ -204,7 +204,7 @@ extern struct btf_id_set8 name;
>
> #else
>
> -#define BTF_ID_LIST(name) static u32 __maybe_unused name[16];
> +#define BTF_ID_LIST(name) static u32 __maybe_unused name[64];
> #define BTF_ID(prefix, name)
> #define BTF_ID_FLAGS(prefix, name, ...)
> #define BTF_ID_UNUSED
>
> ---
> base-commit: 36e5e391a25af28dc1f4586f95d577b38ff4ed72
> change-id: 20230307-bpf-kfuncs-warray-bounds-c2040e8ee7ee
>
> Best regards,
> --
> Nathan Chancellor <nathan@...nel.org>
>
Powered by blists - more mailing lists