mbox series

[v4,0/3] cleanup the legacy probe_event on failed scenario

Message ID 20220629151848.65587-1-nashuiliang@gmail.com (mailing list archive)
Headers show
Series cleanup the legacy probe_event on failed scenario | expand

Message

Chuang Wang June 29, 2022, 3:18 p.m. UTC
A potential scenario, when an error is returned after
add_uprobe_event_legacy() in perf_event_uprobe_open_legacy(), or
bpf_program__attach_perf_event_opts() in
bpf_program__attach_uprobe_opts() returns an error, the uprobe_event
that was previously created is not cleaned.

At the same time, the legacy kprobe_event also have similar problems.

With these patches, whenever an error is returned, it ensures that
the created kprobe_event/uprobe_event is cleaned.

V1 -> v3:

- add detail commits
- call remove_kprobe_event_legacy() on failed bpf_program__attach_perf_event_opts()

v3 -> v4:

- cleanup the legacy kprobe_event on failed add/attach_event

Chuang Wang (3):
  libbpf: cleanup the legacy kprobe_event on failed add/attach_event()
  libbpf: fix wrong variable used in perf_event_uprobe_open_legacy()
  libbpf: cleanup the legacy uprobe_event on failed add/attach_event()

 tools/lib/bpf/libbpf.c | 37 +++++++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 8 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 6, 2022, 4:30 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Wed, 29 Jun 2022 23:18:44 +0800 you wrote:
> A potential scenario, when an error is returned after
> add_uprobe_event_legacy() in perf_event_uprobe_open_legacy(), or
> bpf_program__attach_perf_event_opts() in
> bpf_program__attach_uprobe_opts() returns an error, the uprobe_event
> that was previously created is not cleaned.
> 
> At the same time, the legacy kprobe_event also have similar problems.
> 
> [...]

Here is the summary with links:
  - [v4,1/3] libbpf: cleanup the legacy kprobe_event on failed add/attach_event()
    https://git.kernel.org/bpf/bpf-next/c/8094029330a2
  - [v4,2/3] libbpf: fix wrong variable used in perf_event_uprobe_open_legacy()
    https://git.kernel.org/bpf/bpf-next/c/5666fc997ccb
  - [v4,3/3] libbpf: cleanup the legacy uprobe_event on failed add/attach_event()
    https://git.kernel.org/bpf/bpf-next/c/2655144fb49b

You are awesome, thank you!