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

bpf: Support bpf_get_func_ip helper in uprobes #5451

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: bpf: Support bpf_get_func_ip helper in uprobes
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=771512

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 1110865
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=771512
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: d3c4db8
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=771512
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=771512 expired. Closing PR.

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 87dc2bb
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 648880e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6f9bad6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 5964d1e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 21ce6ab
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 8a60a04
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 5426700
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: dde3979
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 09d1505
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=772535
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 1e8e2ef
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=773552
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2369e52
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=773552
version: 1

Adding support for bpf_get_func_ip helper for uprobe program to return
probed address for both uprobe and return uprobe.

We discussed this in [1] and agreed that uprobe can have special use
of bpf_get_func_ip helper that differs from kprobe.

The kprobe bpf_get_func_ip returns:
  - address of the function if probe is attach on function entry
    for both kprobe and return kprobe
  - 0 if the probe is not attach on function entry

The uprobe bpf_get_func_ip returns:
  - address of the probe for both uprobe and return uprobe

The reason for this semantic change is that kernel can't really tell
if the probe user space address is function entry.

The uprobe program is actually kprobe type program attached as uprobe.
One of the consequences of this design is that uprobes do not have its
own set of helpers, but share them with kprobes.

As we need different functionality for bpf_get_func_ip helper for uprobe,
I'm adding the bool value to the bpf_trace_run_ctx, so the helper can
detect that it's executed in uprobe context and call specific code.

The is_uprobe bool is set as true in bpf_prog_run_array_sleepable, which
is currently used only for executing bpf programs in uprobe.

Renaming bpf_prog_run_array_sleepable to bpf_prog_run_array_uprobe
to address that it's only used for uprobes and that it sets the
run_ctx.is_uprobe as suggested by Yafang Shao.

Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Alan Maguire <alan.maguire@oracle.com>
[1] https://lore.kernel.org/bpf/CAEf4BzZ=xLVkG5eurEuvLU79wAMtwho7ReR+XJAgwhFF4M-7Cg@mail.gmail.com/
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Viktor Malik <vmalik@redhat.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Adding get_func_ip tests for uprobe on function entry that
validates that bpf_get_func_ip returns proper values from
both uprobe and return uprobe.

Tested-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Adding get_func_ip test for uprobe inside function that validates
the get_func_ip helper returns correct probe address value.

Tested-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a5c0a42
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=773552
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=773552 irrelevant now. Closing PR.

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot deleted the series/771512=>bpf-next branch August 7, 2023 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant