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

fix: move to new bpf api #47

Closed
wants to merge 1 commit into from

Conversation

black-desk
Copy link

No description provided.

@CoelacanthusHex
Copy link

CoelacanthusHex commented Oct 7, 2022

@black-desk
Copy link
Author

Should you also update https://github.com/springzfx/cgproxy/blob/master/execsnoop-kernel/aarch64/execsnoop_kern_skel.h ?

I don't have any arm device TAT.

Copy link

@darsvador darsvador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@black-desk PTAL.

pb_opts.sample_cb = handle_event;
pb_opts.lost_cb = handle_lost_events;
pb = perf_buffer__new(bpf_map__fd(obj->maps.perf_events), PERF_BUFFER_PAGES, &pb_opts);
pb = perf_buffer__new(bpf_map__fd(obj->maps.perf_events),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last argument of this function should be nullptr. The following image contains the old (libbpf version 0.8.1) definition perf_buffer_opts which is a size_t or callback functions.
0.8.1

Copy link
Author

@black-desk black-desk Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I look into libbpf source, seems like this opts just use to do a check, and not passed into __perf_buffer__new:

https://github.com/torvalds/linux/blob/c40e8341e3b3bb27e3a65b06b5b454626234c4f0/tools/lib/bpf/libbpf.c#L11606

this check will success when opts is nullptr:

https://github.com/torvalds/linux/blob/c40e8341e3b3bb27e3a65b06b5b454626234c4f0/tools/lib/bpf/libbpf_internal.h#L296-L300

so it will be fine whether pass opts or nullptr.

I have no idea why libbpf need this opts arg.

@adwinb
Copy link

adwinb commented Nov 8, 2022

Shall we fork this repo and maintain that one instead?
As far I appreciate springzfx's work, it seems s/he has had no activity on github for the last two years.

@opsiff
Copy link

opsiff commented Nov 9, 2022

execsnoop_kern_skel.h for aarch64(without test)
https://gist.github.com/opsiff/2ce709b98b2084090eadf7004ceea2cb

@springzfx
Copy link
Owner

Works for libbpf 1.x now. Thanks for your contribution.

@springzfx springzfx closed this Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants