legend1999
legend1999

Reputation: 1

Modifiying the linux system kernel

i want to modify the system kernell for linux, i want to change the open system call, so when i try to open one file, i want to open another one, but i cannot find where in the open.c file this can be done and which variables to work with, would appreciate some information. There are a lot of syscalls_defines in the open systemcall, but i do not understand which one of them i could work with. I have tried to add some printk() functions into some functions in the open.c, and when i sudo dmesg i get there output, but i still can't find exactly which functions that open.c calls and which function to modify.

Upvotes: 0

Views: 50

Answers (1)

rgouicem
rgouicem

Reputation: 421

Not exactly sure what you want to achieve, but if you just want to hijack the open system call without the malign intention of applying this to all processes on a machine, you don't need to tinker with the kernel. Using shared library magic with LD_PRELOAD, and redefining the libc system call wrapper would probably be enough.

You can find how to do this with read and write here. But the idea is the same with any system call.

Upvotes: 1

Related Questions