是否可以通过LKM添加系统调用? [英] Is it possible to add a system call via a LKM?

查看:81
本文介绍了是否可以通过LKM添加系统调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过LKM添加一个新的系统调用,但是我不确定如何执行此操作.也就是说,我知道如果我想添加一个全新的系统调用,我可以查看sys_call_table并找到一个sys_ni_syscall并将其替换,但是我很好奇是否可以实际 add sys_call_table.考虑到它是固定大小的数组,我意识到这可能不可能,但是我想知道是否还有其他聪明的方法可以添加系统调用而不覆盖未使用的系统调用号.

I'd like to add a new system call via an LKM, but I'm not sure how to do this. That is, I know that if I want to add a completely new system call, I can look through the sys_call_table and find a sys_ni_syscall and just replace it, but I was curious if it was possible to actually add to the sys_call_table. I realize it's probably not possible, given that it's a fixed size array, but I was wondering if there were any other clever ways to add system calls without overriding an unused system call number.

推荐答案

下面是一个示例
Linux系统调用

Here's an example
linux system calls


上面的示例显示了如何实现系统调用,以及如何从可加载模块中实现一个系统调用. AFAIK,这是不可能的,除非您在哪里覆盖一个现有数组,因为数组的大小是#define.

edit:
The example above shows howto implement a system call, as far as implementing one from a loadable module; AFAIK, that's not possible, unless you where to overwrite an existing one because the size of the array is a #define.

请记住,至少在您希望能够实际使用新系统调用的情况下,还需要更改用户空间.

Keep in mind there are user space changes required as well, at least if you want to be able to actually use the new system call.

这篇关于是否可以通过LKM添加系统调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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