eunomia-bpf / bpftime

Userspace eBPF runtime for fast Uprobe & Syscall hook & Extensions with LLVM JIT
https://eunomia.dev/bpftime/
MIT License
687 stars 68 forks source link

[BUG] Unable to initialize shared memory: No such file or directory #275

Closed ScriptSathi closed 2 months ago

ScriptSathi commented 2 months ago

Describe the bug

When using bpftrace with bpftime I got the below error

[error] [agent.cpp:105] Unable to initialize shared memory: No such file or directory

To Reproduce

Use Ubuntu Dockerfile, build the image and then run it with

docker run --rm -it \
-v /dev/shm:/dev/shm:rw -v /usr/src:/usr/src:ro \
-v /lib/modules/:/lib/modules:ro \
--privileged \
-v /sys/kernel/debug/:/sys/kernel/debug:rw  \
-v /sys/kernel/tracing:/sys/kernel/tracing:rw \
bpftime bash

then install bpftrace (no need to have the latest)

apt install bpftrace -y

Then run the test

bpftime start bpftrace -e 'BEGIN { printf("hello world\n"); }'

Expected behavior

No error happen

Additional context

I think the error come from this line https://github.com/eunomia-bpf/bpftime/blob/master/runtime/src/bpftime_shm_internal.cpp#L547

But I use the default shared memory name https://github.com/eunomia-bpf/bpftime/blob/master/runtime/src/handler/handler_manager.hpp#L52

I probably have a wrong understanding of the origin, though ...

Officeyutong commented 2 months ago

You should use bpftime load to start bpftrace, not bpftime start

ScriptSathi commented 2 months ago

But then it goes to this issue...

https://github.com/eunomia-bpf/bpftime/issues/269

Officeyutong commented 2 months ago

Has this issue been solved now? If so, please close this issue @ScriptSathi

ScriptSathi commented 2 months ago

Well not really ... I still can't use bpftime properly with bpftrace

Should I reopen the other one ?

Officeyutong commented 2 months ago

Well not really ... I still can't use bpftime properly with bpftrace

Should I reopen the other one ?

Just open a new issue if you have any other problems