Re: [kbuild-all] [PATCH v3] ARM: smp: add support for per-task stack canaries

From: Kees Cook
Date: Wed Jan 09 2019 - 16:38:07 EST


On Tue, Jan 8, 2019 at 10:30 PM Rong Chen <rong.a.chen@xxxxxxxxx> wrote:
> I tested the commit on another machine and the warnings are exist.
> I found " -Wno-vla" was lost after the commit, so I think it's a real problem.
>
> -Werror=designated-init -fplugin-arg-arm_ssp_per_task_plugin-tso=1 -fplugin-arg-arm_ssp_per_task_plugin-offset=24 -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=object-size -fsanitize=bool -fsanitize=enum -fsanitize=alignment -Wno-maybe-uninitialized -fsanitize-coverage=trace-pc -DMODULE -DKBUILD_BASENAME='"test_ubsan"' -DKBUILD_MODNAME='"test_ubsan"' -c -o lib/.tmp_test_ubsan.o lib/test_ubsan.c
>
> -Werror=designated-init -Wno-vla -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=object-size -fsanitize=bool -fsanitize=enum -fsanitize=alignment -Wno-maybe-uninitialized -fsanitize-coverage=trace-pc -DMODULE -DKBUILD_BASENAME='"test_ubsan"' -DKBUILD_MODNAME='"test_ubsan"' -c -o lib/.tmp_test_ubsan.o lib/test_ubsan.c

Hm, so the -Wno-vla is getting clobbered.

in lib/Makefile, I see "+=", so I wouldn't expect a clobber:
CFLAGS_test_kasan.o += $(call cc-disable-warning, vla)
...
CFLAGS_test_ubsan.o += $(call cc-disable-warning, vla)

and scripts/Makefile.gcc-plugins is using += against KBUILD_CFLAGS:
KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)

I'm not sure where the per-target CFLAGS are built, but it seems like
something has gone wrong there?

--
Kees Cook