Re: [linux-stable-rc:linux-5.10.y 4948/4972] tools/testing/selftests/bpf/prog_tests/core_reloc.c:860: undefined reference to `ASSERT_FALSE'

From: Andrii Nakryiko
Date: Tue Aug 10 2021 - 11:11:27 EST


On Tue, Aug 10, 2021 at 4:25 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
> head: e97bd1e03e6ef58ec47ee7f085f8c14ed6329cf7
> commit: 183d9ebd449c20658a1aaf580f311140bbc7421d [4948/4972] selftests/bpf: Fix core_reloc test runner
> config: x86_64-rhel-8.3-kselftests (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.3-348-gf0e6938b-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=183d9ebd449c20658a1aaf580f311140bbc7421d
> git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> git fetch --no-tags linux-stable-rc linux-5.10.y
> git checkout 183d9ebd449c20658a1aaf580f311140bbc7421d
> # save the attached .config to linux build tree
> make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash -C tools/testing/selftests/bpf install
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> /usr/bin/ld: tools/testing/selftests/bpf/core_reloc.test.o: in function `test_core_reloc':
> >> tools/testing/selftests/bpf/prog_tests/core_reloc.c:860: undefined reference to `ASSERT_FALSE'
> collect2: error: ld returned 1 exit status
> --
> /usr/bin/ld: tools/testing/selftests/bpf/no_alu32/core_reloc.test.o: in function `test_core_reloc':
> >> tools/testing/selftests/bpf/prog_tests/core_reloc.c:860: undefined reference to `ASSERT_FALSE'
> collect2: error: ld returned 1 exit status
>

ASSERT_FALSE() macro is defined in test_progs.h, which is included
from core_reloc.c. There must be something wrong about how kernel test
robot is building selftests/bpf.

>
> vim +860 tools/testing/selftests/bpf/prog_tests/core_reloc.c
>
> 765
> 766 void test_core_reloc(void)
> 767 {
> 768 const size_t mmap_sz = roundup_page(sizeof(struct data));
> 769 struct bpf_object_load_attr load_attr = {};
> 770 struct core_reloc_test_case *test_case;
> 771 const char *tp_name, *probe_name;
> 772 int err, i, equal;
> 773 struct bpf_link *link = NULL;
> 774 struct bpf_map *data_map;
> 775 struct bpf_program *prog;
> 776 struct bpf_object *obj;
> 777 uint64_t my_pid_tgid;
> 778 struct data *data;
> 779 void *mmap_data = NULL;
> 780

[...]