eunomia-bpf / bpf-developer-tutorial

eBPF Developer Tutorial: Learning eBPF Step by Step with Examples
https://eunomia.dev/tutorials/
MIT License
2.45k stars 349 forks source link

[BUG] Not able to execute tutorial 7-execsnoop #116

Closed trend-leon-wang closed 6 months ago

trend-leon-wang commented 6 months ago

Describe the bug A clear and concise description of what the bug is. After successfully compiling tutorial 7-execsnoop, I run it with $ sudo ecli-aarch run package.json, and encounter the following error

INFO [faerie::elf] strtab: 0x6754 symtab 0x6790 relocs 0x67d8 sh_offset 0x67d8
thread '<unnamed>' panicked at ecli-lib/src/runner/task_manager/mod.rs:252:22:
called `Result::unwrap()` on an `Err` value: Export map named `events` found, but no export type is provided
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Already tried with the suggested flag RUST_BACKTRACE=1 and the error ls like below

INFO [faerie::elf] strtab: 0x6754 symtab 0x6790 relocs 0x67d8 sh_offset 0x67d8
thread '<unnamed>' panicked at ecli-lib/src/runner/task_manager/mod.rs:252:22:
called `Result::unwrap()` on an `Err` value: Export map named `events` found, but no export type is provided

Stack backtrace:
   0: std::sys_common::backtrace::__rust_begin_short_backtrace
   1: core::ops::function::FnOnce::call_once{{vtable.shim}}
   2: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2007:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys/unix/thread.rs:108:17
   3: <unknown>
   4: <unknown>
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Desktop (please complete the following information):

Additional context The ecc as well as ecli are the lastest versions, which is v1.0.21

Currently, I am no idea how to troubleshoot this issue, since I am very new to eBPF. If someone has any idea, I would go check it out and give it a try.

trend-leon-wang commented 6 months ago

Noticed that there's a github discussion space for this. I'll first ask if anyone can help me with this to confirm this is a bug or not.

yunwei37 commented 6 months ago

Hi! How did you compile the example?

trend-leon-wang commented 6 months ago

Hi @yunwei37, Thanks for your reply. After you asking me about the compilation, I went back and check the doc and noticed that I should include the header file in my command, which is:

$ ecc execsnoop.bpf.c execsnoop.h

But what I have done was:

$ ecc  execsnoop.bpf.c

Now that the problem is solved.