Re: [PATCH] bpf: increase frame warning limit in verifier when using KASAN or KCSAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2024 at 7:19 PM <flyingpenghao@xxxxxxxxx> wrote:
>
> From: Peng Hao <flyingpeng@xxxxxxxxxxx>
>
> When building kernel with clang, which will typically
> have sanitizers enabled, there is a warning about a large stack frame.
>
> kernel/bpf/verifier.c:21163:5: error: stack frame size (2392) exceeds
> limit (2048) in 'bpf_check' [-Werror,-Wframe-larger-than]
> int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,
> __u32 uattr_size)
>     ^
> 632/2392 (26.42%) spills, 1760/2392 (73.58%) variables
> so increase the limit for configurations that have KASAN or KCSAN enabled for not
> breaking the majority of builds.
>
> Signed-off-by: Peng Hao <flyingpeng@xxxxxxxxxxx>
> ---
>  kernel/bpf/Makefile | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index e497011261b8..07ed1e81aa62 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -6,6 +6,12 @@ cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
>  endif
>  CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
>
> +ifneq ($(CONFIG_FRAME_WARN),0)
> +ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
> +CFLAGS_verifier.o = -Wframe-larger-than=2392

that's very compiler specific.
version +-1 will have different results.
Please investigate what is causing the large stack size instead.
pw-bot: cr





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux