Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/gcc-bpf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
GCC_BPF_RELEASE_REPO: 'theihor/gcc-bpf'
KBUILD_OUTPUT: ${{ github.workspace }}/src/kbuild-output
REPO_ROOT: ${{ github.workspace }}/src
KERNEL_ORIGIN: 'https://github.com/theihor/bpf.git'
KERNEL_REVISION: selftests-asan

steps:

Expand All @@ -53,7 +55,8 @@ jobs:
uses: libbpf/ci/get-linux-source@v4
with:
dest: ${{ env.REPO_ROOT }}
rev: ${{ env.BPF_NEXT_BASE_BRANCH }}
repo: ${{ env.KERNEL_ORIGIN }}
rev: ${{ env.KERNEL_REVISION }}

- if: ${{ ! inputs.download_sources }}
name: Checkout ${{ github.repository }} to ./src
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/kernel-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ jobs:
test: ${{ matrix.test }}
continue_on_error: ${{ toJSON(matrix.continue_on_error) }}
timeout_minutes: ${{ matrix.timeout_minutes }}
llvm_version: ${{ inputs.llvm_version }}

test-progs-asan:
name: 'test_progs with ASAN'
if: ${{ inputs.arch != 's390x' }}
uses: ./.github/workflows/test-progs-asan.yml
needs: [build]
with:
runs_on: ${{ inputs.runs_on }}
arch: ${{ inputs.arch }}
gcc_version: ${{ inputs.gcc_version }}
llvm_version: ${{ inputs.llvm_version }}
toolchain: ${{ inputs.toolchain }}
toolchain_full: ${{ inputs.toolchain_full }}

veristat-kernel:
if: ${{ inputs.run_veristat }}
Expand Down Expand Up @@ -176,4 +190,3 @@ jobs:
toolchain: ${{ inputs.toolchain }}
toolchain_full: ${{ inputs.toolchain_full }}
download_sources: ${{ inputs.download_sources }}

6 changes: 2 additions & 4 deletions .github/workflows/kernel-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ jobs:
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
KERNEL: ${{ inputs.kernel }}
KERNEL_ROOT: ${{ github.workspace }}
KERNEL_ORIGIN: ${{ github.repository == 'kernel-patches/bpf-rc' && 'https://github.com/kernel-patches/bpf-rc.git'
|| 'https://github.com/kernel-patches/bpf.git'
}}
KERNEL_REVISION: ${{ inputs.download_sources && 'bpf-next' || github.sha }}
KERNEL_ORIGIN: 'https://github.com/theihor/bpf.git'
KERNEL_REVISION: selftests-asan
REFERENCE_REPO_PATH: /libbpfci/mirrors/linux
REPO_PATH: ""
REPO_ROOT: ${{ github.workspace }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/kernel-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ on:
required: true
type: number
description: In case a test runs for too long, after how many seconds shall we timeout and error.
llvm_version:
required: true
type: string

jobs:
test:
Expand Down Expand Up @@ -65,7 +68,7 @@ jobs:
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- name: Run selftests
uses: libbpf/ci/run-vmtest@v4
uses: libbpf/ci/run-vmtest@selftests-asan
# https://github.com/actions/runner/issues/1483#issuecomment-1031671517
# booleans are weird in GH.
continue-on-error: ${{ fromJSON(env.CONTINUE_ON_ERROR) }}
Expand All @@ -74,6 +77,7 @@ jobs:
ARCH: ${{ inputs.arch }}
DEPLOYMENT: ${{ env.DEPLOYMENT }}
KERNEL_TEST: ${{ inputs.test }}
LLVM_VERSION: ${{ inputs.llvm_version }}
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
VMTEST_MEMORY: 5G
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/test-progs-asan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: test_progs with ASAN

on:
workflow_call:
inputs:
arch:
required: true
type: string
description: The architecture to build against, e.g x86_64, aarch64, s390x...
toolchain_full:
required: true
type: string
description: The toolchain and for llvm, its version, e.g gcc, llvm-15
toolchain:
required: true
type: string
description: The toolchain, e.g gcc, llvm
runs_on:
required: true
type: string
description: The runners to run the test on. This is a json string representing an array of labels.
gcc_version:
required: true
type: string
description: GCC version to install
llvm_version:
required: true
type: string
description: LLVM version to install

jobs:
build:
name: build test_progs with ASAN
runs-on:
- ${{ format('codebuild-bpf-ci-{0}-{1}', github.run_id, github.run_attempt) }}
- image:${{ inputs.arch == 'aarch64' && 'custom-arm-ghcr.io/kernel-patches/runner:kbuilder-debian-aarch64'
|| 'custom-linux-ghcr.io/kernel-patches/runner:kbuilder-debian-x86_64' }}
env:
ARCH: ${{ inputs.arch }}
ARTIFACTS_ARCHIVE: ${{ github.workspace }}/selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst
KERNEL_ORIGIN: 'https://github.com/theihor/bpf.git'
KERNEL_REVISION: selftests-asan
REPO_ROOT: ${{ github.workspace }}/src
steps:

- uses: actions/checkout@v6
with:
sparse-checkout: |
.github
ci

- name: Download bpf-next tree @ ${{ env.KERNEL_REVISION }}
uses: libbpf/ci/get-linux-source@v4
with:
dest: ${{ env.REPO_ROOT }}
repo: ${{ env.KERNEL_ORIGIN }}
rev: ${{ env.KERNEL_REVISION }}

- uses: libbpf/ci/patch-kernel@v4
with:
patches-root: '${{ github.workspace }}/ci/diffs'
repo-root: ${{ env.REPO_ROOT }}

- name: Setup build environment
uses: libbpf/ci/setup-build-env@selftests-asan
with:
arch: ${{ inputs.arch }}
gcc-version: ${{ inputs.gcc_version }}
llvm-version: ${{ inputs.llvm_version }}

- uses: actions/download-artifact@v4
with:
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
path: ${{ env.REPO_ROOT }}

- name: Untar artifacts
working-directory: ${{ env.REPO_ROOT }}
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- name: Build selftests/bpf/test_progs with ASAN
uses: libbpf/ci/build-selftests@selftests-asan
env:
KBUILD_OUTPUT: ${{ env.REPO_ROOT }}/kbuild-output
SELFTESTS_BPF_ASAN: 'true'
SELFTESTS_BPF_TARGETS: 'test_progs'
with:
arch: ${{ inputs.arch }}
kernel-root: ${{ env.REPO_ROOT }}
llvm-version: ${{ inputs.llvm_version }}
toolchain: ${{ inputs.toolchain }}

- name: Tar artifacts
id: tar-artifacts
uses: libbpf/ci/tar-artifacts@selftests-asan
env:
ARCHIVE_BPF_SELFTESTS: 'true'
ARCHIVE_KBUILD_OUTPUT: '' # emptystring means false
with:
arch: ${{ inputs.arch }}
archive: ${{ env.ARTIFACTS_ARCHIVE }}
kbuild-output: ${{ env.REPO_ROOT }}/kbuild-output
repo-root: ${{ env.REPO_ROOT }}

- uses: actions/upload-artifact@v4
with:
name: selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}
if-no-files-found: error
path: ${{ env.ARTIFACTS_ARCHIVE }}

test:
name: test_progs ASAN
runs-on: ${{ fromJSON(inputs.runs_on) }}
needs: [build]
timeout-minutes: 100
env:
ARCH: ${{ inputs.arch }}
REPO_ROOT: ${{ github.workspace }}
REPO_PATH: ""
DEPLOYMENT: ${{ github.repository == 'kernel-patches/bpf' && 'prod' || 'rc' }}
ALLOWLIST_FILE: /tmp/allowlist
DENYLIST_FILE: /tmp/denylist
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
ci

- uses: actions/download-artifact@v4
with:
name: vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}
path: ${{ env.REPO_ROOT }}

- name: Untar vmlinux
working-directory: ${{ env.REPO_ROOT }}
run: zstd -d -T0 vmlinux-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- uses: actions/download-artifact@v4
with:
name: selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}
path: ${{ env.REPO_ROOT }}

- name: Untar test_progs ASAN
working-directory: ${{ env.REPO_ROOT }}
run: zstd -d -T0 selftests-bpf-asan-${{ inputs.arch }}-${{ inputs.toolchain_full }}.tar.zst --stdout | tar -xf -

- name: Run selftests
uses: libbpf/ci/run-vmtest@selftests-asan
env:
ARCH: ${{ inputs.arch }}
DEPLOYMENT: ${{ env.DEPLOYMENT }}
LLVM_VERSION: ${{ inputs.llvm_version }}
SELFTESTS_BPF: ${{ github.workspace }}/selftests/bpf
SELFTESTS_BPF_ASAN: 'true'
VMTEST_CONFIGS: ${{ github.workspace }}/ci/vmtest/configs
VMTEST_MEMORY: 5G
VMTEST_NUM_CPUS: 4
TEST_PROGS_WATCHDOG_TIMEOUT: 600
with:
arch: ${{ inputs.arch }}
vmlinuz: '${{ github.workspace }}/vmlinuz'
kernel-root: ${{ env.REPO_ROOT }}
kernel-test: test_progs
kbuild-output: ${{ env.REPO_ROOT }}/kbuild-output
1 change: 0 additions & 1 deletion .github/workflows/veristat-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
REPO_PATH: ""
KBUILD_OUTPUT: kbuild-output/
ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain_full }}
VERISTAT_DUMP_LOG_ON_FAILURE: 'true'
VERISTAT_TARGET: kernel

steps:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/veristat-scx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ jobs:
REPO_PATH: ""
KBUILD_OUTPUT: kbuild-output/
ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain_full }}
VERISTAT_DUMP_LOG_ON_FAILURE: 'true'
VERISTAT_TARGET: scx
SCX_BUILD_OUTPUT: ${{ github.workspace }}/scx-build-output

Expand Down
3 changes: 2 additions & 1 deletion ci/vmtest/configs/run-vmtest.env
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ ALLOWLIST_FILES=(
DENYLIST_FILES=(
"${SELFTESTS_BPF}/DENYLIST"
"${SELFTESTS_BPF}/DENYLIST.${ARCH}"
"${SELFTESTS_BPF}/DENYLIST.${SELFTESTS_BPF_ASAN:+asan}"
"${VMTEST_CONFIGS}/DENYLIST"
"${VMTEST_CONFIGS}/DENYLIST.${ARCH}"
"${VMTEST_CONFIGS}/DENYLIST.${DEPLOYMENT}"
"${VMTEST_CONFIGS}/DENYLIST.${KERNEL_TEST}"
"${VMTEST_CONFIGS}/DENYLIST.${SELFTESTS_BPF_ASAN:+asan}"
)

# Export pipe-separated strings, because bash doesn't support array export
export SELFTESTS_BPF_ALLOWLIST_FILES=$(IFS="|"; echo "${ALLOWLIST_FILES[*]}")
export SELFTESTS_BPF_DENYLIST_FILES=$(IFS="|"; echo "${DENYLIST_FILES[*]}")

Loading