From 59c882cebf799d8d7e288eb025818a663394e112 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 26 Nov 2024 15:01:29 -0500 Subject: [PATCH] Enable unwinding in userspace --- .github/workflows/ci.yml | 5 +---- Cargo.toml | 6 ------ test.sh | 14 ++++++++++++-- {{project-name}}-ebpf/.cargo/config.toml | 12 ------------ 4 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 {{project-name}}-ebpf/.cargo/config.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 632f9d0..b96f7ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,27 +63,24 @@ jobs: - uses: dtolnay/rust-toolchain@nightly with: - components: rust-src,rustfmt + components: clippy,rust-src,rustfmt - uses: dtolnay/rust-toolchain@master if: runner.os == 'macOS' && runner.arch == 'X64' with: toolchain: ${{ matrix.rust }} targets: x86_64-unknown-linux-musl - components: clippy - uses: dtolnay/rust-toolchain@master if: runner.os == 'macOS' && runner.arch == 'ARM64' with: toolchain: ${{ matrix.rust }} targets: aarch64-unknown-linux-musl - components: clippy - uses: dtolnay/rust-toolchain@master if: runner.os == 'Linux' with: toolchain: ${{ matrix.rust }} - components: clippy - uses: Swatinem/rust-cache@v2 diff --git a/Cargo.toml b/Cargo.toml index 25a3645..8936d14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,12 +21,6 @@ log = { version = "0.4.22", default-features = false } tokio = { version = "1.40.0", default-features = false } which = { version = "6.0.0", default-features = false } -[profile.dev] -panic = "abort" - -[profile.release] -panic = "abort" - [profile.release.package.{{project-name}}-ebpf] debug = 2 codegen-units = 1 diff --git a/test.sh b/test.sh index 570e13a..76076ef 100755 --- a/test.sh +++ b/test.sh @@ -81,8 +81,18 @@ case $OS in # ${CRATE_NAME} and ${CRATE_NAME}-ebpf depend on ${CRATE_NAME}-common and ${CRATE_NAME} activates # ${CRATE_NAME}-common's aya dependency, we end up trying to compile the panic handler twice: once # from the bpf program, and again from std via aya. - cargo clippy --exclude "${CRATE_NAME}-ebpf" --all-targets --workspace -- --deny warnings - cargo clippy --package "${CRATE_NAME}-ebpf" --all-targets -- --deny warnings + # + # `-C panic=abort` because "unwinding panics are not supported without std"; + # integration-ebpf contains `#[no_std]` binaries. + # + # `-Zpanic_abort_tests` because "building tests with panic=abort is not supported without + # `-Zpanic_abort_tests`"; Cargo does this automatically when panic=abort is set via profile + # but we want to preserve unwinding at runtime - here we are just running clippy so we don't + # care about unwinding behavior. + # + # `+nightly` because "the option `Z` is only accepted on the nightly compiler". + cargo +nightly clippy --exclude "${CRATE_NAME}-ebpf" --all-targets --workspace -- --deny warnings + cargo +nightly clippy --package "${CRATE_NAME}-ebpf" --all-targets -- --deny warnings -C panic=abort -Zpanic_abort_tests expect <