eBPF-based security platform
build: refuse a sign test of an unsigned value with clang too
Daniel Borkmann983d30c845ce
diff --git a/Documentation/reference/cli/build.rst b/Documentation/reference/cli/build.rstindex 8015fd96..cd20386c 100644--- a/Documentation/reference/cli/build.rst+++ b/Documentation/reference/cli/build.rst@@ -61,9 +61,9 @@ Building a upatch``vmlinux.h`` (``/usr/share/shirudo/vmlinux.h`` in the operatorpackage, ``/usr/local/share/shirudo/vmlinux.h`` after ``makeinstall``). It then runs ``/usr/bin/clang -target bpf -O2 -g -Wall- -Wextra -Wshadow`` with the ``vmlinux.h`` directory, the libbpf- headers and the shirudo BPF headers on the include path, plus- ``--extra-cflags``. The clang path is fixed when the helper is built,+ -Wextra -Wshadow -Wtype-limits`` with the ``vmlinux.h`` directory,+ the libbpf headers and the shirudo BPF headers on the include path,+ plus ``--extra-cflags``. The clang path is fixed when the helper is built,and ``PATH`` is not searched. The object goes to a temporary file in``/tmp``, or with ``--emit-artifacts`` beside the output.#. A ``.bpf.o`` or ``.o`` input is packaged as it is. Any other input isdiff --git a/Makefile.shirudo b/Makefile.shirudoindex 85bf0e5b..11d4aafd 100644--- a/Makefile.shirudo+++ b/Makefile.shirudo@@ -81,7 +81,7 @@ WERROR_CFLAGS := $(if $(filter 1,$(WERROR)),-Werror)WARNINGS := -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wvla \-Wmissing-prototypes -Wpointer-arith -Wshadow \-Wdeclaration-after-statement -Wformat-security -Wformat=2 \- -Wwrite-strings -Wundef \+ -Wwrite-strings -Wundef -Wtype-limits \$(WERROR_CFLAGS)# The warnings that not every compiler shirudo builds with has, each@@ -192,7 +192,7 @@ endif# -Wmissing-declarations; the BPF_PROG() / BPF_KPROBE() macros# generate auto-named params that often go unused. Neither is# fixable upstream of us, so silence both for BPF compilation.-CLANG_BPF := $(CLANG) -target bpf -O2 -g -Wall -Wextra -Wvla -Wshadow \+CLANG_BPF := $(CLANG) -target bpf -O2 -g -Wall -Wextra -Wvla -Wshadow -Wtype-limits \-Wno-missing-declarations -Wno-unused-parameter \-Wdeclaration-after-statement $(WERROR_CFLAGS)diff --git a/tools/shirudo-build/compile.c b/tools/shirudo-build/compile.cindex 9df45cb3..a5f46674 100644--- a/tools/shirudo-build/compile.c+++ b/tools/shirudo-build/compile.c@@ -110,6 +110,7 @@ int build_compile(const char *source, const char *output,push(argv, &n, "-Wall");push(argv, &n, "-Wextra");push(argv, &n, "-Wshadow");+ push(argv, &n, "-Wtype-limits");/** vmlinux.h dumps anonymous struct forward declarations that* trip -Wmissing-declarations -- unfixable upstream of us;