diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b1d2c9a..e9b1add4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,29 +119,26 @@ jobs: RUST_BACKTRACE: full run: | set -euxo pipefail - cargo hack test --all-targets --feature-powerset \ + cargo hack test --all-targets \ --exclude aya-ebpf \ --exclude aya-ebpf-bindings \ --exclude aya-log-ebpf \ --exclude integration-ebpf \ --exclude integration-test \ - --exclude xtask \ - --workspace + --feature-powerset - name: Doctests env: RUST_BACKTRACE: full run: | set -euxo pipefail - cargo hack test --doc --feature-powerset \ + cargo hack test --doc \ --exclude aya-ebpf \ --exclude aya-ebpf-bindings \ --exclude aya-log-ebpf \ - --exclude init \ --exclude integration-ebpf \ --exclude integration-test \ - --exclude xtask \ - --workspace + --feature-powerset build-test-aya-ebpf: runs-on: ubuntu-latest @@ -175,28 +172,36 @@ jobs: # to the overhead of setting up the job - so this saves a bunch of # machine time. for arch in aarch64 arm loongarch64 mips powerpc64 riscv64 s390x x86_64; do + echo "::group::arch=$arch" + export RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" for target in bpfeb-unknown-none bpfel-unknown-none; do - echo "::group::Build and test for $arch / $target" + echo "::group::target=$target" if ! ( - - RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" cargo +nightly hack build \ + cargo +nightly hack build \ + --release \ --target "$target" \ -Z build-std=core \ --package aya-ebpf \ + --package aya-ebpf-bindings \ --package aya-log-ebpf \ - --feature-powerset - - cargo hack test \ - --doc \ - --package aya-ebpf \ - --package aya-log-ebpf \ + --package integration-ebpf \ --feature-powerset ); then - echo "FAILED: $arch / $target" - failures+=("$arch/$target") + failures+=("build: $arch/$target") fi echo "::endgroup::" done + if ! ( + RUSTDOCFLAGS=$RUSTFLAGS cargo +nightly hack test --doc \ + --package aya-ebpf \ + --package aya-ebpf-bindings \ + --package aya-log-ebpf \ + --package integration-ebpf \ + --feature-powerset + ); then + failures+=("doctests: $arch") + fi + echo "::endgroup::" done if ((${#failures[@]})); then @@ -204,6 +209,7 @@ jobs: printf ' %s\n' "${failures[@]}" exit 1 fi + run-integration-test: strategy: fail-fast: false diff --git a/aya-ebpf-macros/src/lib.rs b/aya-ebpf-macros/src/lib.rs index bbd4fdc3..5c9878b0 100644 --- a/aya-ebpf-macros/src/lib.rs +++ b/aya-ebpf-macros/src/lib.rs @@ -216,14 +216,11 @@ pub fn cgroup_skb(attrs: TokenStream, item: TokenStream) -> TokenStream { /// pub fn connect4(ctx: SockAddrContext) -> i32 { /// match try_connect4(ctx) { /// Ok(ret) => ret, -/// Err(ret) => match ret.try_into() { -/// Ok(rt) => rt, -/// Err(_) => 1, -/// }, +/// Err(ret) => ret, /// } /// } /// -/// fn try_connect4(ctx: SockAddrContext) -> Result { +/// fn try_connect4(ctx: SockAddrContext) -> Result { /// Ok(0) /// } /// ``` @@ -440,7 +437,7 @@ pub fn btf_tracepoint(attrs: TokenStream, item: TokenStream) -> TokenStream { /// ///#[stream_parser] ///fn stream_parser(ctx: SkBuffContext) -> u32 { -/// match { try_stream_parser(ctx) } { +/// match try_stream_parser(ctx) { /// Ok(ret) => ret, /// Err(ret) => ret, /// } @@ -470,7 +467,7 @@ pub fn stream_parser(attrs: TokenStream, item: TokenStream) -> TokenStream { /// ///#[stream_verdict] ///fn stream_verdict(ctx: SkBuffContext) -> u32 { -/// match { try_stream_verdict(ctx) } { +/// match try_stream_verdict(ctx) { /// Ok(ret) => ret, /// Err(ret) => ret, /// } @@ -507,7 +504,7 @@ fn sk_skb(kind: SkSkbKind, attrs: TokenStream, item: TokenStream) -> TokenStream /// /// #[socket_filter] /// pub fn accept_all(_ctx: SkBuffContext) -> i64 { -/// return 0 +/// 0 /// } /// ``` #[proc_macro_attribute] @@ -531,9 +528,10 @@ pub fn socket_filter(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fentry, programs::FEntryContext}; +/// # #[expect(non_camel_case_types)] /// # type filename = u32; +/// # #[expect(non_camel_case_types)] /// # type path = u32; /// /// #[fentry(function = "filename_lookup")] @@ -573,9 +571,10 @@ pub fn fentry(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fexit, programs::FExitContext}; +/// # #[expect(non_camel_case_types)] /// # type filename = u32; +/// # #[expect(non_camel_case_types)] /// # type path = u32; /// /// #[fexit(function = "filename_lookup")] @@ -658,7 +657,7 @@ pub fn flow_dissector(attrs: TokenStream, item: TokenStream) -> TokenStream { /// #[sk_lookup] /// pub fn accept_all(_ctx: SkLookupContext) -> u32 { /// // use sk_assign to redirect -/// return 0 +/// 0 /// } /// ``` #[proc_macro_attribute] @@ -688,7 +687,7 @@ pub fn sk_lookup(attrs: TokenStream, item: TokenStream) -> TokenStream { /// #[cgroup_device] /// pub fn cgroup_dev(ctx: DeviceContext) -> i32 { /// // Reject all device access -/// return 0; +/// 0 /// } /// ``` #[proc_macro_attribute] diff --git a/aya/src/maps/array/program_array.rs b/aya/src/maps/array/program_array.rs index 9f8f9340..3b88fe11 100644 --- a/aya/src/maps/array/program_array.rs +++ b/aya/src/maps/array/program_array.rs @@ -36,13 +36,13 @@ use crate::{ /// let flags = 0; /// /// // bpf_tail_call(ctx, JUMP_TABLE, 0) will jump to prog_0 -/// prog_array.set(0, &prog_0_fd, flags); +/// prog_array.set(0, prog_0_fd, flags); /// /// // bpf_tail_call(ctx, JUMP_TABLE, 1) will jump to prog_1 -/// prog_array.set(1, &prog_1_fd, flags); +/// prog_array.set(1, prog_1_fd, flags); /// /// // bpf_tail_call(ctx, JUMP_TABLE, 2) will jump to prog_2 -/// prog_array.set(2, &prog_2_fd, flags); +/// prog_array.set(2, prog_2_fd, flags); /// # Ok::<(), aya::EbpfError>(()) /// ``` #[doc(alias = "BPF_MAP_TYPE_PROG_ARRAY")] diff --git a/aya/src/programs/mod.rs b/aya/src/programs/mod.rs index 3255381f..9e151ad8 100644 --- a/aya/src/programs/mod.rs +++ b/aya/src/programs/mod.rs @@ -1229,9 +1229,8 @@ impl_info!( /// use aya::programs::loaded_links; /// /// for info in loaded_links() { -/// if let Ok(info) = info { -/// println!("loaded link: {}", info.id()); -/// } +/// let info = info.unwrap(); +/// println!("loaded link: {}", info.id()); /// } /// ``` pub fn loaded_links() -> impl Iterator> { diff --git a/aya/src/util.rs b/aya/src/util.rs index 3a04aa2a..200b80a1 100644 --- a/aya/src/util.rs +++ b/aya/src/util.rs @@ -323,7 +323,9 @@ fn parse_kernel_symbols(reader: impl BufRead) -> Result, i /// # Example /// /// ```no_run +/// # #[expect(deprecated)] /// use aya::util::syscall_prefix; +/// # #[expect(deprecated)] /// let prefix = syscall_prefix().unwrap(); /// let syscall_fname = format!("{prefix}exec"); /// ``` diff --git a/clippy.sh b/clippy.sh index ca314276..9641623b 100755 --- a/clippy.sh +++ b/clippy.sh @@ -4,12 +4,12 @@ set -eux # `-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 hack clippy "$@" \ --all-targets \ @@ -18,17 +18,30 @@ cargo +nightly hack clippy "$@" \ -C panic=abort \ -Zpanic_abort_tests +export CLIPPY_ARGS='--deny=warnings' +export RUSTDOCFLAGS='--no-run -Z unstable-options --test-builder clippy-driver' + +cargo +nightly hack test --doc "$@" --feature-powerset for arch in aarch64 arm loongarch64 mips powerpc64 riscv64 s390x x86_64; do + export RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" + for target in bpfeb-unknown-none bpfel-unknown-none; do - RUSTFLAGS="--cfg bpf_target_arch=\"$arch\"" cargo +nightly hack clippy \ + cargo +nightly hack clippy \ --target "$target" \ -Zbuild-std=core \ - --package aya-ebpf-bindings \ --package aya-ebpf \ + --package aya-ebpf-bindings \ --package aya-log-ebpf \ --package integration-ebpf \ --feature-powerset \ -- --deny warnings - done + done + + RUSTDOCFLAGS="$RUSTDOCFLAGS $RUSTFLAGS" cargo +nightly hack test --doc "$@" \ + --package aya-ebpf \ + --package aya-ebpf-bindings \ + --package aya-log-ebpf \ + --package integration-ebpf \ + --feature-powerset done diff --git a/ebpf/aya-ebpf/src/helpers.rs b/ebpf/aya-ebpf/src/helpers.rs index 6e23f1d3..44b61342 100644 --- a/ebpf/aya-ebpf/src/helpers.rs +++ b/ebpf/aya-ebpf/src/helpers.rs @@ -35,7 +35,6 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -74,7 +73,6 @@ pub unsafe fn bpf_probe_read(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let ptr: *const u8 = 0 as _; @@ -103,7 +101,6 @@ pub unsafe fn bpf_probe_read_buf(src: *const u8, dst: &mut [u8]) -> Result<(), c /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const c_int = 0 as _; @@ -140,7 +137,6 @@ pub unsafe fn bpf_probe_read_user(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -170,7 +166,6 @@ pub unsafe fn bpf_probe_read_user_buf(src: *const u8, dst: &mut [u8]) -> Result< /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -207,7 +202,6 @@ pub unsafe fn bpf_probe_read_kernel(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -240,11 +234,12 @@ pub unsafe fn bpf_probe_read_kernel_buf(src: *const u8, dst: &mut [u8]) -> Resul /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] +/// # #[expect(deprecated)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_str(kernel_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -276,11 +271,12 @@ pub unsafe fn bpf_probe_read_str(src: *const u8, dest: &mut [u8]) -> Result Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_user_str(user_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -315,7 +311,6 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -421,11 +416,12 @@ fn read_str_bytes(len: i64, dest: &[u8]) -> Result<&[u8], c_long> { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] +/// # #[expect(deprecated)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; /// let mut my_str = [0u8; 16]; +/// # #[expect(deprecated)] /// let num_read = unsafe { bpf_probe_read_kernel_str(kernel_ptr, &mut my_str)? }; /// /// // Do something with num_read and my_str @@ -464,7 +460,6 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -554,7 +549,6 @@ pub unsafe fn bpf_probe_read_kernel_str_bytes( /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::{ /// # cty::{c_int, c_long}, /// # helpers::bpf_probe_write_user, @@ -587,7 +581,6 @@ pub unsafe fn bpf_probe_write_user(dst: *mut T, src: *const T) -> Result<(), /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_comm; /// let comm = bpf_get_current_comm(); /// @@ -622,7 +615,6 @@ pub fn bpf_get_current_comm() -> Result<[u8; 16], c_long> { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_pid_tgid; /// let tgid = (bpf_get_current_pid_tgid() >> 32) as u32; /// let pid = bpf_get_current_pid_tgid() as u32; @@ -645,7 +637,6 @@ pub fn bpf_get_current_pid_tgid() -> u64 { /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_uid_gid; /// let gid = (bpf_get_current_uid_gid() >> 32) as u32; /// let uid = bpf_get_current_uid_gid() as u32; diff --git a/ebpf/aya-ebpf/src/maps/program_array.rs b/ebpf/aya-ebpf/src/maps/program_array.rs index d56f076a..8241eed2 100644 --- a/ebpf/aya-ebpf/src/maps/program_array.rs +++ b/ebpf/aya-ebpf/src/maps/program_array.rs @@ -14,7 +14,6 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![expect(dead_code)] /// use aya_ebpf::{macros::map, maps::ProgramArray, cty::c_long}; /// # use aya_ebpf::{programs::LsmContext}; /// @@ -24,8 +23,8 @@ use crate::{ /// # unsafe fn try_test(ctx: &LsmContext) -> Result<(), c_long> { /// let index: u32 = 13; /// -/// if let Err(e) = JUMP_TABLE.tail_call(ctx, index) { -/// return Err(e); +/// unsafe { +/// JUMP_TABLE.tail_call(ctx, index)?; /// } /// /// # Err(-1) diff --git a/ebpf/aya-ebpf/src/programs/fentry.rs b/ebpf/aya-ebpf/src/programs/fentry.rs index b67fb35c..0e61236d 100644 --- a/ebpf/aya-ebpf/src/programs/fentry.rs +++ b/ebpf/aya-ebpf/src/programs/fentry.rs @@ -16,10 +16,10 @@ impl FEntryContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FEntryContext}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } diff --git a/ebpf/aya-ebpf/src/programs/fexit.rs b/ebpf/aya-ebpf/src/programs/fexit.rs index 20a4c3b5..d936c310 100644 --- a/ebpf/aya-ebpf/src/programs/fexit.rs +++ b/ebpf/aya-ebpf/src/programs/fexit.rs @@ -16,10 +16,10 @@ impl FExitContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FExitContext}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } diff --git a/ebpf/aya-ebpf/src/programs/lsm.rs b/ebpf/aya-ebpf/src/programs/lsm.rs index 741aa1b6..4e0111d5 100644 --- a/ebpf/aya-ebpf/src/programs/lsm.rs +++ b/ebpf/aya-ebpf/src/programs/lsm.rs @@ -25,7 +25,6 @@ impl LsmContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::LsmContext, cty::{c_int, c_ulong}}; /// unsafe fn try_lsm_mmap_addr(ctx: LsmContext) -> Result { /// // In the kernel, this hook is defined as: diff --git a/ebpf/aya-ebpf/src/programs/probe.rs b/ebpf/aya-ebpf/src/programs/probe.rs index 6c7266c6..e2ee6e0e 100644 --- a/ebpf/aya-ebpf/src/programs/probe.rs +++ b/ebpf/aya-ebpf/src/programs/probe.rs @@ -16,16 +16,18 @@ impl ProbeContext { /// # Examples /// /// ```no_run - /// # #![expect(non_camel_case_types)] - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::ProbeContext, cty::c_int, helpers::bpf_probe_read}; + /// # #[expect(non_camel_case_types)] /// # type pid_t = c_int; + /// # #[expect(non_camel_case_types)] /// # struct task_struct { /// # pid: pid_t, /// # } /// unsafe fn try_kprobe_try_to_wake_up(ctx: ProbeContext) -> Result { /// let tp: *const task_struct = ctx.arg(0).ok_or(1u32)?; - /// let pid = bpf_probe_read(&(*tp).pid as *const pid_t).map_err(|_| 1u32)?; + /// let pid = unsafe { + /// bpf_probe_read(core::ptr::addr_of!((*tp).pid)) + /// }.map_err(|err| err as u32)?; /// /// // Do something with pid or something else with tp /// diff --git a/ebpf/aya-ebpf/src/programs/retprobe.rs b/ebpf/aya-ebpf/src/programs/retprobe.rs index c2aec986..c669f25e 100644 --- a/ebpf/aya-ebpf/src/programs/retprobe.rs +++ b/ebpf/aya-ebpf/src/programs/retprobe.rs @@ -16,7 +16,6 @@ impl RetProbeContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::RetProbeContext, cty::c_int}; /// unsafe fn try_kretprobe_try_to_wake_up(ctx: RetProbeContext) -> Result { /// let retval: c_int = ctx.ret(); diff --git a/ebpf/aya-ebpf/src/programs/sk_buff.rs b/ebpf/aya-ebpf/src/programs/sk_buff.rs index 93b5f5e0..deb9654b 100644 --- a/ebpf/aya-ebpf/src/programs/sk_buff.rs +++ b/ebpf/aya-ebpf/src/programs/sk_buff.rs @@ -384,8 +384,8 @@ impl SkBuffContext { /// fn try_cgroup_skb(ctx: SkBuffContext) -> Result { /// let len = ETH_HLEN + IP_HLEN + UDP_HLEN; /// match ctx.pull_data(len as u32) { - /// Ok(()) => return Ok(0), - /// Err(ret) => return Err(ret as i32), + /// Ok(()) => Ok(0), + /// Err(ret) => Err(ret as i32), /// } /// } /// ``` diff --git a/ebpf/aya-ebpf/src/programs/tc.rs b/ebpf/aya-ebpf/src/programs/tc.rs index e9281d83..8304d58c 100644 --- a/ebpf/aya-ebpf/src/programs/tc.rs +++ b/ebpf/aya-ebpf/src/programs/tc.rs @@ -176,8 +176,8 @@ impl TcContext { /// fn try_classifier(ctx: TcContext) -> Result { /// let len = ETH_HLEN + IP_HLEN + UDP_HLEN; /// match ctx.pull_data(len as u32) { - /// Ok(()) => return Ok(0), - /// Err(ret) => return Err(ret as i32), + /// Ok(()) => Ok(0), + /// Err(ret) => Err(ret as i32), /// } /// } /// ``` diff --git a/ebpf/aya-ebpf/src/programs/tp_btf.rs b/ebpf/aya-ebpf/src/programs/tp_btf.rs index 9e39f2f0..c5daf637 100644 --- a/ebpf/aya-ebpf/src/programs/tp_btf.rs +++ b/ebpf/aya-ebpf/src/programs/tp_btf.rs @@ -19,7 +19,6 @@ impl BtfTracePointContext { /// # Examples /// /// ```no_run - /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::BtfTracePointContext, cty::{c_int, c_ulong, c_char}}; /// unsafe fn try_tp_btf_sched_process_fork(ctx: BtfTracePointContext) -> Result { /// // Grab arguments diff --git a/test/integration-ebpf/src/log.rs b/test/integration-ebpf/src/log.rs index 3e7bf5b8..b55b7276 100644 --- a/test/integration-ebpf/src/log.rs +++ b/test/integration-ebpf/src/log.rs @@ -115,10 +115,10 @@ fn test_log(ctx: ProbeContext) { let buf = &buf[..core::cmp::min(len, buf.len())]; info!(&ctx, "variable length buffer: {:x}", buf); - info!(&ctx, "2KiB array: {:x}", &TWO_KB_ARRAY); - info!(&ctx, "4KiB array: {:x}", &FOUR_KB_ARRAY); + info!(&ctx, "2KiB array: {:x}", TWO_KB_ARRAY.as_slice()); + info!(&ctx, "4KiB array: {:x}", FOUR_KB_ARRAY.as_slice()); // This one is too big and should be dropped. - info!(&ctx, "8KiB array: {:x}", &EIGHT_KB_ARRAY); + info!(&ctx, "8KiB array: {:x}", EIGHT_KB_ARRAY.as_slice()); } #[uprobe]