On Thu, Aug 22, 2024 at 06:45:14PM GMT, Sherry Yang wrote: > Hi All, > > We found BPF sefltest fail to build with following error: > > 08-09 20:39:59 DBG: |output|: progs/test_global_func10.c:24:1: error: unknown type name '__failure' > 08-09 20:39:59 DBG: |output|: __failure __msg("invalid indirect access to stack") > 08-09 20:39:59 DBG: |output|: ^ > 08-09 20:39:59 DBG: |output|: progs/test_global_func10.c:24:17: error: expected parameter declarator > 08-09 20:39:59 DBG: |output|: __failure __msg("invalid indirect access to stack") > 08-09 20:39:59 DBG: |output|: ^ > 08-09 20:39:59 DBG: |output|: progs/test_global_func10.c:24:17: error: expected ')' > 08-09 20:39:59 DBG: |output|: progs/test_global_func10.c:24:16: note: to match this '(' > 08-09 20:39:59 DBG: |output|: __failure __msg("invalid indirect access to stack") > 08-09 20:39:59 DBG: |output|: ^ > 08-09 20:39:59 DBG: |output|: progs/test_global_func10.c:24:52: error: expected ';' after top level declarator > 08-09 20:39:59 DBG: |output|: __failure __msg("invalid indirect access to stack") > 08-09 20:39:59 DBG: |output|: ^ > 08-09 20:39:59 DBG: |output|: ; > 08-09 20:39:59 DBG: |output|: 4 errors generated. > 08-09 20:39:59 DBG: |output|: make: *** [Makefile:470: /root/oltf/work/linux-bpf-qa/tools/testing/selftests/bpf/test_global_func10.o] Error 1 > 08-09 20:39:59 DBG: |output|: make: *** Waiting for unfinished jobs.... > > It happens from the commit e30bc19a9ee8("bpf: Allow reads from uninit > stack"). We did a further look, '__failure' is defined in > tools/testing/selftests/bpf/progs/bpf_misc.h, and was 1st introduced > in commit 537c3f66eac1("selftests/bpf: add generic BPF program > tester-loader") which is not backported to linux-5.15.y. > > So we may need to revert the patch, or fix it. To fix it I think we just need to drop the use of __failure and __msg in progs/test_global_func10.c, and update the "struct test_def tests[]" table in prog_tests/test_global_funcs.c with the new verifier rejection message. On the other hand I believe commit 537c3f66eac1("selftests/bpf: add generic BPF program tester-loader") should be relatively easy to backport, just picking that commit up and resolving simple conflict in Makefile should be enough. It will also save a lot of future headaches like this one. (Note: the generic test-loader patch will need to backport it to stable 6.1 first before it an be backported to 5.15, as per the stable rule[1]) 1: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#procedure-for-submitting-patches-to-the-stable-tree