eunomia-bpf / bpftime

Userspace eBPF runtime for Observability, Network & General Extensions Framework
https://eunomia.dev/bpftime/
MIT License
791 stars 74 forks source link

[BUG] Need better error message for `bpftime start` when `bpftime load` is never run #167

Closed agentzh closed 6 months ago

agentzh commented 8 months ago

Currently, when bpftime load is never run, bpftime start gives strange error message like below:

terminate called after throwing an instance of 'boost::interprocess::interprocess_exception'
  what():  No such file or directory

The bpftime attach command might also be affected here.

agentzh commented 8 months ago

OK, I've noticed a much more serious consequence when running bpftime attach without running bpftime load. The bpftime attach reports success (which is definitely not true in this case):

$ bpftime attach `pgrep victim`
[2024-01-27 14:27:32.600] [info] Injecting to 619340
[2024-01-27 14:27:32.609] [info] Successfully injected. ID: 1

while the target process would immediatley crash:

terminate called after throwing an instance of 'boost::interprocess::interprocess_exception'
  what():  No such file or directory
Aborted (core dumped)

This is very dangerous and we need proper error handling and error reporting here.

The backtrace for the crashed target process's core dump is like this:

                #0  0x00007fb53731f7d5 __GI_raise (libc.so.6 + 0x3c7d5)
                #1  0x00007fb537308895 __GI_abort (libc.so.6 + 0x25895)
                #2  0x00007fb5358d3941 _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold (libstdc++.so.6 + 0x9e941)
                #3  0x00007fb5358df32c _ZN10__cxxabiv111__terminateEPFvvE (libstdc++.so.6 + 0xaa32c)
                #4  0x00007fb5358df397 _ZSt9terminatev (libstdc++.so.6 + 0xaa397)
                #5  0x00007fb5358df649 __cxa_throw (libstdc++.so.6 + 0xaa649)
                #6  0x00007fb535ea39e7 n/a (/home/agentzh/.bpftime/libbpftime-agent.so + 0x3049e7)
                #7  0x00007fb535e9aa7d n/a (/home/agentzh/.bpftime/libbpftime-agent.so + 0x2fba7d)
                #8  0x00007fb535e9b31c n/a (/home/agentzh/.bpftime/libbpftime-agent.so + 0x2fc31c)
                #9  0x00007fb535e9b3c2 n/a (/home/agentzh/.bpftime/libbpftime-agent.so + 0x2fc3c2)
                #10 0x0000000000000004 n/a (n/a + 0x0)
                #11 0x00007fb5372a8e50 n/a (n/a + 0x0)

Interestingly, I cannot use gdb to inspect the resulting core dump file. Is this a known issue?

Zheaoli commented 8 months ago

/assgin

Bakugo90 commented 7 months ago

Hello @agentzh @Zheaoli , I am new to eBPF, I am interested in applying for GSOC, I want to get started with the repo, can I look into this issue ?

Officeyutong commented 6 months ago

Hello @agentzh @Zheaoli , I am new to eBPF, I am interested in applying for GSOC, I want to get started with the repo, can I look into this issue ?

Sorry for no response, I've assigned this to you

Officeyutong commented 6 months ago

Solved by #260