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

one-liner examples not work #41

Open
cheng-zhongliang opened this issue Feb 24, 2025 · 1 comment
Open

one-liner examples not work #41

cheng-zhongliang opened this issue Feb 24, 2025 · 1 comment

Comments

@cheng-zhongliang
Copy link

my machine: ubuntu x86

one-liner example: ply 'kprobe:do_sys_open { printf("%v(%v): %s\n", comm, uid, str(arg1)); }'

not work:

Image

@wkz
Copy link
Owner

wkz commented Feb 24, 2025

Yeah, since writing that example, the kernel implementation has changed, and it seems that the call to do_sys_open() is now inlined into the syscall.

kprobes are not stable across kernel versions, so these issues continue to crop up. I have debated with myself if I should just stick to tracepoints in the examples, but they are just not as exciting 😄 . I will keep this issue open as a reminder to make a decision on this.

Anyway, for you particular example, I think you might have better luck with do_sys_openat2() on recent kernels:

kprobe:do_sys_openat2
{
    if (!strcmp(str(arg1), "TODO")) {
        print(pid, comm, str(arg1));
        exit(0);
    }
}

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

No branches or pull requests

2 participants