改变Linux内核
大家,我正在尝试学习如何使用Linux Red Hat的内核,我尝试从内核更改一些功能:
/*
* sys_execve() executes a new program.
*/
asmlinkage int sys_execve(struct pt_regs regs)
{
int error;
char * filename;
filename = getname((char *) regs.ebx);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
printk("Hello World!"); // I added this function
error = do_execve(filename, (char **) regs.ecx, (char **) regs.edx, ®s);
if (error == 0)
current->ptrace &= ~PT_DTRACE;
putname(filename);
out:
return error;
}
这个系统调用执行程序,我的问题是为什么当我在终端并编写一些函数时,例如' date' 我没有收到我的hello world,提前感谢您的帮助
everyone, I'm trying to learn how to work with Kernel of the Linux Red Hat, I tried to change some function from kernel:
/*
* sys_execve() executes a new program.
*/
asmlinkage int sys_execve(struct pt_regs regs)
{
int error;
char * filename;
filename = getname((char *) regs.ebx);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
printk("Hello World!"); // I added this function
error = do_execve(filename, (char **) regs.ecx, (char **) regs.edx, ®s);
if (error == 0)
current->ptrace &= ~PT_DTRACE;
putname(filename);
out:
return error;
}
this system call executes programs, my question why while I'm in terminal and writing some function for example 'date' I don't receive my hello world, thanks in advance for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
printk()
应记录到/proc/kmsg
,然后由syslog(8)
读取并记录。printk()
should be logged to/proc/kmsg
, which in turn is read and logged bysyslog(8)
.