https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123555

            Bug ID: 123555
           Summary: xdp-tools fails tests for bpf (At subprogram exit the
                    register R0 is not a scalar value (ctx))
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: dfaust at gcc dot gnu.org, jemarch at gcc dot gnu.org
            Blocks: 121462
  Target Milestone: ---

Created attachment 63324
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63324&action=edit
xdp_dispatcher_v1.i.xz

```
$ bpf-unknown-none-gcc -I ../headers/ -I ../headers/linux -I ../../../headers
-I../../util  -Wall -Wno-unused-value -Wno-pointer-sign
-Wno-compare-distinct-pointer-types -Wno-visibility -Werror
-fno-stack-protector -I ../headers/ -I ../headers/linux -I ../../../headers
-I../../util  -Wno-unknown-pragmas -Wno-unused-variable
-Wno-maybe-uninitialized -I/usr/include -I ../headers/ -I ../headers/linux -I
../../../headers -I../../util  -DBPF_DIR_MNT=\"/sys/fs/bpf\"
-DBPF_OBJECT_PATH=\"/usr/local/lib/bpf\" -DMAX_DISPATCHER_ACTIONS=10
-DTOOLS_VERSION=\""1.6.0"\" -DLIBBPF_VERSION=\"1.6.2\" -DRUNDIR=\"/run\"
-DHAVE_BPFTOOL -DHAVE_LIBBPF_PERF_BUFFER__CONSUME
-DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID -DHAVE_LIBBPF_BTF__TYPE_CNT
-DHAVE_LIBBPF_BPF_OBJECT__NEXT_MAP -DHAVE_LIBBPF_BPF_OBJECT__NEXT_PROGRAM
-DHAVE_LIBBPF_BPF_PROGRAM__INSN_CNT -DHAVE_LIBBPF_BPF_PROGRAM__TYPE
-DHAVE_LIBBPF_BPF_PROGRAM__FLAGS
-DHAVE_LIBBPF_BPF_PROGRAM__EXPECTED_ATTACH_TYPE -DHAVE_LIBBPF_BPF_MAP_CREATE
-DHAVE_LIBBPF_PERF_BUFFER__NEW_RAW -DHAVE_LIBBPF_BPF_XDP_ATTACH
-DHAVE_LIBBPF_BPF_MAP__SET_AUTOCREATE -DHAVE_LIBBPF_BPF_PROG_TEST_RUN_OPTS
-DHAVE_LIBBPF_BPF_XDP_QUERY -DHAVE_SECURE_GETENV -DDEBUG -DLIBBPF_DYNAMIC
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -I -I -I -I../../util
-I/usr/include/bpf/uapi -I/usr/include -I -I -I -I../../util -I../../../headers
 -O2 -c -g -o xdp_dispatcher_v1.o xdp_dispatcher_v1.c
```

test_prog_name:
```
[...]
          Validating prog0() func#1...
          100: R1=ctx() R10=fp0
          100: (62) *(u32 *)(r10 -4) = 31       ; R10=fp0 fp-8=mmmm????
          101: (15) if r1 == 0x0 goto pc+5 107: R1=ctx() R10=fp0 fp-8=mmmm????
          107: (bf) r0 = r1                     ; R0=ctx() R1=ctx()
          108: (95) exit
          At subprogram exit the register R0 is not a scalar value (ctx)
          processed 25 insns (limit 1000000) max_states_per_insn 0 total_states
2 peak_states 2 mark_read 0
```

There are two xdp_dispatcher objects: xdp_dispatcher_v1.o and
xdp_dispatcher_v2.o. It's not clear to me which is being used here, so I'm
including both.

```
Using built-in specs.
COLLECT_GCC=bpf-unknown-none-gcc
COLLECT_LTO_WRAPPER=/usr/lib/bpf-toolchain/libexec/gcc/bpf-unknown-none/15/lto-wrapper
Target: bpf-unknown-none
Configured with:
/var/tmp/portage/sys-devel/bpf-toolchain-15.2.0_p2/work/gcc/configure
--build=x86_64-pc-linux-gnu --target=bpf-unknown-none --docdir=/.skip
--infodir=/.skip --mandir=/.skip MAKEINFO=: --prefix=/usr/lib/bpf-toolchain
--host=x86_64-pc-linux-gnu --disable-bootstrap --disable-cc1 --disable-cet
--disable-gcov --disable-gomp --disable-nls --disable-libcc1
--disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libvtv
--disable-shared --disable-werror --enable-languages=c
--with-gcc-major-version-only --with-system-zlib --without-isl --without-zstd
--disable-multilib CXX='x86_64-pc-linux-gnu-g++ -std=c++14'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (GCC)
```


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121462
[Bug 121462] [meta-bug] BPF verifier issues

Reply via email to