Skip to content

fix: fix segmentation fault about bashreadline #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2024

Conversation

Officeyutong
Copy link
Contributor

@Officeyutong Officeyutong commented May 4, 2024

There are two bugs that caused bpftime unable to run bashreadline (example/libbpf-tools/bashreadline)

  • bashrc seems to be incompatible with bpftime+bash. These can be temporarily solved by running bash using --norc. This is not fixed yet.
  • All subprocesses spawned by bash will ended up with segmentation fault. This is caused by bpftime will not check if the injected process contains the module that uprobe requires, e.g we may attach a uprobe designed for /bin/bash @ 0x123456 to /bin/ls (a process that bash spawns). Under this way, resolve_function_addr_by_module_offset is unable to resolve the real address that should be attached, it returns nullptr, so a segmentation fault will be raised if we invoke frida to add a invocation listener. This issue was solved by checking /proc/self/maps and try to match each line for the desired module. If nothing was matched, we will reject this attach

Closes #277

@Officeyutong Officeyutong changed the title fix: fix bugs about bashreadline fix: fix segmentation fault about bashreadline May 6, 2024
@Officeyutong Officeyutong marked this pull request as ready for review May 6, 2024 04:50
@Officeyutong Officeyutong requested a review from yunwei37 May 6, 2024 04:50
@yunwei37 yunwei37 merged commit 8ebca3e into eunomia-bpf:master May 6, 2024
70 checks passed
hp77-creator pushed a commit to hp77-creator/bpftime-hp that referenced this pull request May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] bpftrace with bashreadline leads to segmentation fault on subprocess of bash
2 participants