Comments (7)
Have you looked at SEC("ksyscall") and BPF_KSYSCALL macro? See https://github.com/libbpf/libbpf-bootstrap/blob/master/examples/c/ksyscall.bpf.c for an example, maybe that will help.
from libbpf-bootstrap.
Thanks for the reply! need to update my kernel to try BPF_KSYSCALL will do that and comeback with results.
from libbpf-bootstrap.
it's purely libbpf-side thing (both SEC("ksyscall") and BPF_KSYSCALL), it's built on top of normal kprobes. So you shouldn't need upgrading.
from libbpf-bootstrap.
Hi, thanks for the notice, you are right, I do not need to upgrade.
I got it properly working now with this code, if anyone in the future needs to access something like clone_args:
SEC("ksyscall/clone3")
int BPF_KSYSCALL(clone3,struct clone_args *cl_args)
{
__u64 pid_tgid = bpf_get_current_pid_tgid();
__u32 pid = pid_tgid >> 32;
__u32 tid = (__u32)pid_tgid;
int THREAD_FLAG = 0x0010000;
__u64 clone_flags;
struct clone_args clone_args_new;
bpf_probe_read_user(&clone_args_new, sizeof(clone_args_new), cl_args);
if ((clone_args_new.flags & THREAD_FLAG)){
bpf_printk("A thread was created using clone3\n");
}
return 0;
}
I followed the example from [1] and I think this is correct. Will close the issue since this seems solved.
[1]https://elixir.bootlin.com/linux/latest/source/tools/testing/selftests/bpf/progs/test_probe_user.c#L22
from libbpf-bootstrap.
Reopening this issue for a quick question is there a bpf_ksyscall equivalent for bpf_kretprobe?
from libbpf-bootstrap.
Reopening this issue for a quick question is there a bpf_ksyscall equivalent for bpf_kretprobe?
SEC("kretsyscall/<syscall>")
int BPF_KRETPROBE(name, int ret) {
...
}
from libbpf-bootstrap.
Thanks!
from libbpf-bootstrap.
Related Issues (20)
- is it possible to add `.clang-format` to the project? HOT 4
- fentry/fexit example breaks when using different syscall HOT 2
- When use bpf_skb_output(), error occurs: [unknown func bpf_skb_output#111] HOT 4
- CLion CMakeList.txt modifications HOT 1
- libbpf: failed to find BTF for extern 'bpf_ct_release' [138] section: -2 HOT 1
- sockfilter HOT 2
- failed run xdp program HOT 2
- How to share skb with user-space in kprobe
- How to compile ebpf-program so that it can run in kernel-version not support BTF
- BPF program load failed: Argument list too long HOT 1
- unknown type and function name errors while building examples HOT 5
- In linux kernel 5.15.46, compile error HOT 1
- Compilation optimizations cause ebpf verify to fail HOT 4
- ksyscall invalid func unknown#177 HOT 2
- libbpf: Error in bpf_create_map_xattr():Invalid argument(-22). Retrying without BTF HOT 2
- Fail to set up performance monitor on a CPU/Core HOT 1
- profile can't output full user stack trace HOT 2
- Dropping Ethernet packets to user space applications HOT 1
- profile program crash HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbpf-bootstrap.