2021-08-10 16:26:27

by kernel test robot

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

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 <[email protected]>

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


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
781 my_pid_tgid = getpid() | ((uint64_t)syscall(SYS_gettid) << 32);
782
783 for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
784 test_case = &test_cases[i];
785 if (!test__start_subtest(test_case->case_name))
786 continue;
787
788 if (test_case->setup) {
789 err = test_case->setup(test_case);
790 if (CHECK(err, "test_setup", "test #%d setup failed: %d\n", i, err))
791 continue;
792 }
793
794 obj = bpf_object__open_file(test_case->bpf_obj_file, NULL);
795 if (CHECK(IS_ERR(obj), "obj_open", "failed to open '%s': %ld\n",
796 test_case->bpf_obj_file, PTR_ERR(obj)))
797 continue;
798
799 /* for typed raw tracepoints, NULL should be specified */
800 if (test_case->direct_raw_tp) {
801 probe_name = "tp_btf/sys_enter";
802 tp_name = NULL;
803 } else {
804 probe_name = "raw_tracepoint/sys_enter";
805 tp_name = "sys_enter";
806 }
807
808 prog = bpf_object__find_program_by_title(obj, probe_name);
809 if (CHECK(!prog, "find_probe",
810 "prog '%s' not found\n", probe_name))
811 goto cleanup;
812
813
814 if (test_case->btf_src_file) {
815 err = access(test_case->btf_src_file, R_OK);
816 if (!ASSERT_OK(err, "btf_src_file"))
817 goto cleanup;
818 }
819
820 load_attr.obj = obj;
821 load_attr.log_level = 0;
822 load_attr.target_btf_path = test_case->btf_src_file;
823 err = bpf_object__load_xattr(&load_attr);
824 if (err) {
825 if (!test_case->fails)
826 ASSERT_OK(err, "obj_load");
827 goto cleanup;
828 }
829
830 data_map = bpf_object__find_map_by_name(obj, "test_cor.bss");
831 if (CHECK(!data_map, "find_data_map", "data map not found\n"))
832 goto cleanup;
833
834 mmap_data = mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE,
835 MAP_SHARED, bpf_map__fd(data_map), 0);
836 if (CHECK(mmap_data == MAP_FAILED, "mmap",
837 ".bss mmap failed: %d", errno)) {
838 mmap_data = NULL;
839 goto cleanup;
840 }
841 data = mmap_data;
842
843 memset(mmap_data, 0, sizeof(*data));
844 memcpy(data->in, test_case->input, test_case->input_len);
845 data->my_pid_tgid = my_pid_tgid;
846
847 link = bpf_program__attach_raw_tracepoint(prog, tp_name);
848 if (CHECK(IS_ERR(link), "attach_raw_tp", "err %ld\n",
849 PTR_ERR(link)))
850 goto cleanup;
851
852 /* trigger test run */
853 usleep(1);
854
855 if (data->skip) {
856 test__skip();
857 goto cleanup;
858 }
859
> 860 if (!ASSERT_FALSE(test_case->fails, "obj_load_should_fail"))

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (5.09 kB)
.config.gz (40.26 kB)
Download all attachments

2021-08-10 16:41:08

by Andrii Nakryiko

[permalink] [raw]
Subject: 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'

On Tue, Aug 10, 2021 at 4:25 AM kernel test robot <[email protected]> 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 <[email protected]>
>
> 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

[...]

2021-08-11 03:39:04

by Chen, Rong A

[permalink] [raw]
Subject: Re: [kbuild-all] 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'



On 8/10/2021 11:11 PM, Andrii Nakryiko wrote:
> On Tue, Aug 10, 2021 at 4:25 AM kernel test robot <[email protected]> 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 <[email protected]>
>>
>> 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.

Hi Andrii,

The issue was found in a stable branch, and commit 7a2fa70aaffc
(selftests/bpf: Add remaining ASSERT_xxx() variants) seems not in the
branch, There are some conflicts that I failed to cherry-pick it to the
head to test.

Best Regards,
Rong Chen

>
>>
>> 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
>
> [...]
> _______________________________________________
> kbuild-all mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>