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

how to get vfs_rename old_dentry? #5056

Open
gamawangzi opened this issue Jul 8, 2024 · 0 comments
Open

how to get vfs_rename old_dentry? #5056

gamawangzi opened this issue Jul 8, 2024 · 0 comments

Comments

@gamawangzi
Copy link

`int trace_file_rename(struct pt_regs* ctx){

struct dentry *old_dentry = (struct dentry *)PT_REGS_PARM1(ctx);
struct dentry *new_dentry = (struct dentry *)PT_REGS_PARM3(ctx);

struct qstr d_name_old = old_dentry->d_name;
char filename_old[DNAME_INLINE_LEN];
bpf_probe_read_user(filename_old, sizeof(filename_old), d_name_old.name);
bpf_trace_printk("this is d_name_old: %s\n", d_name_old.name);

struct qstr d_name_new = new_dentry->d_name;
char filename_new[DNAME_INLINE_LEN];
bpf_probe_read_user(filename_new, sizeof(filename_new), d_name_new.name);
bpf_trace_printk("this is d_name_new: %s\n", d_name_new.name);

}`

I can get the infomation of "new_dentry = (struct dentry *)PT_REGS_PARM3(ctx)" ,but "the d_name_old print" always is a empty ("")

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

1 participant