samples: bpf: don’t run probes at the local make stage [Linux 5.3]

This Linux kernel change "samples: bpf: don’t run probes at the local make stage" is included in the Linux 5.3 release. This change is authored by Jakub Kicinski <jakub.kicinski [at]> on Fri Jun 7 10:11:16 2019 -0700. The commit for this change in Linux stable tree is 0ed3cc4 (patch).

samples: bpf: don't run probes at the local make stage

Quentin reports that commit 07c3bbdb1a9b ("samples: bpf: print
a warning about headers_install") is producing the false
positive when make is invoked locally, from the samples/bpf/

When make is run locally it hits the "all" target, which
will recursively invoke make through the full build system.

Speed up the "local" run which doesn't actually build anything,
and avoid false positives by skipping all the probes if not in
kbuild environment (cover both the new warning and the BTF

Reported-by: Quentin Monnet <>
Signed-off-by: Jakub Kicinski <>
Reviewed-by: Quentin Monnet <>
Signed-off-by: Alexei Starovoitov <>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 samples/bpf/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 4074a66..9eb5d73 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -206,6 +206,8 @@ HOSTCC = $(CROSS_COMPILE)gcc
 CLANG_ARCH_ARGS = -target $(ARCH)

+# Don't evaluate probes and warnings if we need to run make recursively
+ifneq ($(src),)
 HDR_PROBE := $(shell echo "\#include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \
    $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \
    echo okay)
@@ -232,6 +234,7 @@ ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),)
    DWARF2BTF = y

 # Trick to allow make to be run from this directory

Leave a Reply

Your email address will not be published. Required fields are marked *