Is it possible to add a system call via a LKM?

前端 未结 3 1484
感动是毒
感动是毒 2021-01-17 19:33

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 s

相关标签:
3条回答
  • 2021-01-17 19:53

    This is an old question, but nevertheless I want to propose my solution. The easiest way to implement a "system-call-like" environment is to rely on a fake device. In particular, you could create a new device driver which is not actually driving anything. Yet, writing on it, can cause the installed module to perform the required actions. Additionally, if you want to offer several services, you might map them to ioctl operations.

    0 讨论(0)
  • 2021-01-17 19:58

    Here's an example
    linux system calls

    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.

    0 讨论(0)
  • 2021-01-17 20:08

    Check The Linux Documentation Project website for "The Linux Kernel Module Programming Guide" (http://www.tldp.org/LDP/lkmpg/2.6/html/index.html). Specifically, look here for System Calls: http://www.tldp.org/LDP/lkmpg/2.6/html/x978.html. That should give you a start, at least.

    0 讨论(0)
提交回复
热议问题