eunomia-bpf / bpftime

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

[BUG] daemon cannot run if /a is not exists in system #116

Closed yunwei37 closed 9 months ago

yunwei37 commented 10 months ago

Describe the bug

The current daemon exists a hack:

    // strncpy(obj->rodata->new_uprobe_path, env.new_uprobe_path, PATH_LENTH);
    // TODO: currently using `/a` as the replacing executable path to uprobe
    // perf event in the kernel, since long strings (such as bpftime_daemon it self)
    // may break userspace memory.
    // Find a better way to solve this in the future
    strncpy(obj->rodata->new_uprobe_path, "/a", PATH_LENTH);

This will make the uprobe failed if /a is not exist as an elf.

To Reproduce

run daemon

Expected behavior

  1. can we found a better way to solve this?
  2. Maybe we can create the /a file in advance?

Screenshots

Desktop (please complete the following information):

Additional context

Officeyutong commented 9 months ago

Workaround: create /a when running daemon