开发者

Syscall implementation kernel module 2.6

开发者 https://www.devze.com 2023-02-12 16:42 出处:网络
after doing some reading I came to understand that adding a new syscall via a LKM has gotten harder in 2.6. It seems that the syscall table is not exported any longer, therefore making it (impossible?

after doing some reading I came to understand that adding a new syscall via a LKM has gotten harder in 2.6. It seems that the syscall table is not exported any longer, therefore making it (impossible?) to insert a new call at runtime.

The stuff I want to achieve is the following.

I have a kernel module which is doing a specific task. This task depends on input which should be provided by a user land process. This information needs to reach the module. For this purpose I would introduce a new syscall which is implemented in the kernel module and callable from the user开发者_高级运维 land process.

If I have to recompile the kernel in order to add my new syscall, I would also need to write the actual syscall logic outside of the kernel module, correct?

Is there another way to do this?

Cheers, eeknay


Syscalls are not the correct interface for this sort of work. At least, that's the reason kernel developers made adding syscalls difficult.

There are lots of different ways to move data between userspace and a kernel module: the proc and sysfs pseudo-filesystems, char device interface (using read or write or ioctl), or the local pseudo-network interface netlink.

Which one you choose depends on the amount of type of data you want to send. You should probably only use proc/sysfs if you intend to pass only tiny amounts of data; for big bulk transfers char device or netlink are better suited.


Impossible -- no. AV modules and rootkits do it all the time.

0

精彩评论

暂无评论...
验证码 换一张
取 消