【问题标题】:Hack into sys_open in kernel and grab file content to a buffer侵入内核中的 sys_open 并将文件内容抓取到缓冲区
【发布时间】:2013-03-16 15:43:27
【问题描述】:

我试图侵入 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);

【问题讨论】:

    标签: kernel system-calls


    【解决方案1】:

    最后我自己解决了这个问题。

    直接调用“kernel_read()”

    【讨论】:

      猜你喜欢
      • 2015-08-20
      • 2021-09-26
      • 1970-01-01
      • 2013-05-20
      • 2012-04-14
      • 2019-09-10
      • 1970-01-01
      • 1970-01-01
      • 2011-12-18
      相关资源
      最近更新 更多