Re: Good idea, or idea gone horribly wrong: Adding kernel file redirection...

From: Jesse Pollard (pollard@cats-chateau.net)
Date: Sat Apr 29 2000 - 11:49:45 EST


On Fri, 28 Apr 2000, Richard Nienhuis wrote:
>
>I don't think the kernel already has this, what I want is a way to redirect where processes
>can open files. What it should do is when process (A) tries to open a file
>for R+W access, the kernel should intercept that and notify process (B).
>Process (B) then makes a temporary file and gives the kernel a handle to it.
>Process (A) then does whatever it wants to the file it was given. Once Process
>(A) closes the file, Process (B) then grabs the file and finds the diff between
>the temp file and the original. Afterwhich Process (B) performs some magic and
>rewrites the original file.
>
>One big additional thing it needs is the ability to do this to spicific
>files. My biggest fear is that the kernel would then have to walk through a
>list of files evertime one is opened. I really can't think of a good solution
>for this off the top of my head and my gut tells me this would not be a good
>solution. Anyone have a better idea?

It would be better (and much simpler) to "modify" the file system to allow
a service inode to point to the inode of an executable. The executable could
then implment the file operations for open/close/read/write/seek and possibly
even IOCTL. Parameters passed to the executable could be the file handle of
the data file being referenced, and the PID of the process making the reference.
The executable would have access to additional information about the parent
process (UID/GID list).

The kernel wouldn't have to track anything, there would be less global
interaction with the kernel.

This could be a hook for providing database level access to data (passing
queries via IOCTL), simple read/write access to a database (using ioctl to
setup, then read/write to transfer the data). It could even be used to
implement custom auditing/journaling on a file-by-file basis.

-- 
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@cats-chateau.net

Any opinions expressed are solely my own.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:17 EST