Skip to content

Commit

Permalink
kernel-test: denylist and adjustments for GCC BPF
Browse files Browse the repository at this point in the history
  • Loading branch information
theihor committed Jan 1, 2025
1 parent 9a19a16 commit c4c73b3
Show file tree
Hide file tree
Showing 6 changed files with 1,166 additions and 16 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/kernel-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,15 @@ jobs:
# zstd is installed by default in the runner images.
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- name: Prepare ALLOW/DENYLIST
- name: Prepare to run selftests
env:
ARCH: ${{ inputs.arch }}
DEPLOYMENT: ${{ env.DEPLOYMENT }}
KERNEL_TEST: ${{ inputs.test }}
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
run: |
cat "${SELFTESTS_BPF}/ALLOWLIST" \
"${SELFTESTS_BPF}/ALLOWLIST.${ARCH}" \
"${VMTEST_CONFIGS}/ALLOWLIST" \
"${VMTEST_CONFIGS}/ALLOWLIST.${ARCH}" \
2> /dev/null > "${ALLOWLIST_FILE}" || true
cat "${SELFTESTS_BPF}/DENYLIST" \
"${SELFTESTS_BPF}/DENYLIST.${ARCH}" \
"${VMTEST_CONFIGS}/DENYLIST" \
"${VMTEST_CONFIGS}/DENYLIST.${ARCH}" \
"${VMTEST_CONFIGS}/DENYLIST.${DEPLOYMENT}" \
2> /dev/null > "${DENYLIST_FILE}" || true
shell: bash
run: ${{ github.workspace }}/ci/vmtest/prepare-selftests-run.sh

- name: Run selftests
uses: ./run-vmtest
Expand Down
4 changes: 2 additions & 2 deletions build-bpf-gcc/build-and-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ ! -f "${INSTALLDIR}/${BINUTILS_BASENAME}.built" ]; then
cd ${BINUTILS_BASENAME};
mkdir build-bpf;
cd build-bpf && ../configure --target=bpf-unknown-none --prefix=$INSTALLDIR && make -j $(nproc) && make install && touch ${INSTALLDIR}/${BINUTILS_BASENAME}.built;
) >> $LOGFILE 2>&1 || { echo -e "\nerror: building $BINUTILS_TARBALL"; exit 1; }
) 2>&1 | tee -a $LOGFILE || { echo -e "\nerror: building $BINUTILS_TARBALL"; exit 1; }
echo done
fi

Expand All @@ -35,7 +35,7 @@ if [ ! -f "${INSTALLDIR}/${GCC_BASENAME}.built" ]; then
./contrib/download_prerequisites
mkdir build-bpf;
cd build-bpf && ../configure --target=bpf-unknown-none --prefix=$INSTALLDIR && make -j $(nproc) && make install && touch ${INSTALLDIR}/${GCC_BASENAME}.built;
) >> $LOGFILE 2>&1 || { echo -e "\nerror: building $GCC_TARBALL"; exit 1; }
) 2>&1 | tee -a $LOGFILE || { echo -e "\nerror: building $GCC_TARBALL"; exit 1; }
echo done
fi

Expand Down
40 changes: 40 additions & 0 deletions ci/diffs/0599-selftests-bpf-GCC-BPF-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 1cbbffc89dc42c353031067a49cdc3b912b07321 Mon Sep 17 00:00:00 2001
From: Ihor Solodrai <[email protected]>
Date: Tue, 31 Dec 2024 16:24:43 -0800
Subject: [PATCH] selftests/bpf: GCC BPF build

---
tools/testing/selftests/bpf/Makefile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 75016962f795..c4f4003a8c2e 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -102,6 +102,14 @@ progs/btf_dump_test_case_packing.c-bpf_gcc-CFLAGS := -Wno-error
progs/btf_dump_test_case_padding.c-bpf_gcc-CFLAGS := -Wno-error
progs/btf_dump_test_case_syntax.c-bpf_gcc-CFLAGS := -Wno-error

+
+progs/test_cls_redirect.c-CFLAGS := -nostdinc
+progs/test_cls_redirect_dynptr.c-CFLAGS := -nostdinc
+progs/test_cls_redirect_subprogs.c-CFLAGS := -nostdinc
+
+progs/verifier_bpf_fastcall.c-CFLAGS := -Wno-error
+progs/verifier_search_pruning.c-CFLAGS := -Wno-error
+
# The following tests do type-punning, via the __imm_insn macro, from
# `struct bpf_insn' to long and then uses the value. This triggers an
# "is used uninitialized" warning in GCC due to strict-aliasing
@@ -502,7 +510,7 @@ endef
# Build BPF object using GCC
define GCC_BPF_BUILD_RULE
$(call msg,GCC-BPF,$4,$2)
- $(Q)$(BPF_GCC) $3 -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes -O2 -c $1 -o $2
+ $(Q)$(BPF_GCC) $3 -DBPF_NO_PRESERVE_ACCESS_INDEX -Wno-attributes -O2 -std=gnu17 -c $1 -o $2
endef

SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c
--
2.47.1

Loading

0 comments on commit c4c73b3

Please sign in to comment.