Linux内核 - 通过模块动态添加系统调用 [英] Linux kernel - add system call dynamically through module

查看:26
本文介绍了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.

这篇关于Linux内核 - 通过模块动态添加系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆