Linux内核-通过模块动态添加系统调用

问题描述:

有没有办法添加动态系统调用,例如通过模块?我找到了一些地方,可以通过更改sys_call_table[]数组来覆盖模块来覆盖现有的系统调用,以获取覆盖的函数而不是安装模块时的本机函数,但是您可以使用新的系统调用和一个模块?

Is there any way to add a system call dynamic, such as through a module? I have found places where I can override an existing system call with a module by just changing the sys_call_table[] array to get my overridden function instead of the native when my module is installed, but can you do this with a new system call and a module?

不,sys_call_table具有固定大小:

const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = { ... 

您可能已经发现,最好的办法是拦截现有系统调用

The best you can do, as you probably already discovered, is to intercept existing system calls.