Skip to content
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

examples/c: demo how to get IP for uprobe and uretprobe #221

Closed
wants to merge 1 commit into from

Commits on Sep 26, 2023

  1. examples/c: demo how to get IP for uprobe and uretprobe

    Show how it's possible to fetch user-space function's address from
    uprobe and uretprobe BPF programs.
    
    When uprobe example is run, you'll see:
    
    ```
    Triggering user function test_func, addr 0x402bc2...
    ```
    
    in the console output. And corresponding:
    
    ```
    uprobe-1805730 [036] ....1 674139.123096: bpf_trace_printk: UPROBE    IP 0x402bc2.
    uprobe-1805730 [036] ....1 674139.123110: bpf_trace_printk: URETPROBE IP 0x402bc2.
    ```
    
    in /sys/kernel/debug/tracing/trace_pipe.
    
    As you can see, those IPs match exactly.
    
    ARM might need a bit of adjustment, I'm not sure, I think ARM can have
    uprobe/uretprobe breakpoint installed not at the very first byte offset within
    user space function.
    
    Signed-off-by: Andrii Nakryiko <[email protected]>
    anakryiko committed Sep 26, 2023
    Configuration menu
    Copy the full SHA
    420b96a View commit details
    Browse the repository at this point in the history