how could I intercept linux sys calls?

前端 未结 9 2169
夕颜
夕颜 2020-11-28 07:31

Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for

9条回答
  •  甜味超标
    2020-11-28 08:18

    I don't have the syntax to do this gracefully with an LKM offhand, but this article provides a good overview of what you'd need to do: http://www.linuxjournal.com/article/4378

    You could also just patch the sys_open function. It starts on line 1084 of file/open.c as of linux-2.6.26.

    You might also see if you can't use inotify, systemtap or SELinux to do all this logging for you without you having to build a new system.

提交回复
热议问题