intercepting file system system calls

后端 未结 4 587
轮回少年
轮回少年 2021-02-08 09:58

I am writing an application for which I need to intercept some filesystem system calls eg. unlink. I would like to save some file say abc. If user deletes the file then I need t

4条回答
  •  执笔经年
    2021-02-08 10:55

    As far as hooking into the kernel and intercepting system calls go, this is something I do in a security module I wrote:

    https://github.com/cormander/tpe-lkm

    Look at hijacks.c and symbols.c for the code; how they're used is in the hijack_syscalls function inside security.c. I haven't tried this on linux > 3.0 yet, but the same basic concept should still work.

    It's a bit tricky, and you may have to write a good deal of kernel code to do the file copy before the unlink, but it's possible here.

提交回复
热议问题