我试图破解fs / open.c中的系统调用“sys_open”,并将文件内容抓取到char *缓冲区中。这是调用堆栈: sys_open - > filp_open - > dentry_open,我在dentry_open的末尾添加了以下代码,以便将文件内容读取到缓冲但不起作用,有什么想法吗?
char *buf = kmalloc(sizeof(*f), GFP_KERNEL);
mm_segment_t fs;
fs = get_fs();
set_fs(get_ds());
f->f_op->read(f, buf, sizeof(*f), 0);
set_fs(fs);
答案 0 :(得分:0)
最后,我自己解决了这个问题。
直接调用" kernel_read()"