LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Writing to a file in Kernel Mode (https://www.linuxquestions.org/questions/programming-9/writing-to-a-file-in-kernel-mode-314502/)

Caliber 04-18-2005 09:19 AM

Writing to a file in Kernel Mode
 
Hello everyone. I am new here, so if this is the wrong area, please point me in the right direction. :)

I am currently attempting to enable secure deletion in the EXT3 filesystem, by altering the code inside the kernel itself. I plan on adding code in the linux-2.4.18\linux\fs\ext3\inode.c and namei.c files, specifically in the ext3_delete_inode and ext3_unlink functions, respectively.

My planned alterations will write out a series of 0s to the data blocks of a deleted file or directory before the inode itself is zeroed out. This will cause an obvious performance hit, which I will attempt to address later. One step at a time and all. :)

My conundrum is figuring out how to write to the disk from kernel mode. Both of the functions I am working in will provide me with the inode of the file. What is the best way to go about my goal? A link to an appropriate FAQ or how-to would be similarly appreciated.

Thank for all your help.

sirclif 04-18-2005 01:03 PM

here is an interesting article for you. I've never done any kernel programming, but from what it says in the article. you shouldn't write to files from within the kernel. the resources page here have some links to related topics. hope this helps.

Caliber 04-19-2005 09:08 AM

I know the Kernel is generally not supposed to touch files, but this isn't so much writing to a file as performing cleanup required to make delete secure. After looking through pages and pages of source code, it seems like my best chance is to use the address space object of the inode to access its buffered pages in memory. Anyone have reasons this wouldn't work?

PS: Your link requires you to be a subscriber so I couldn't read the document. Thanks though.


All times are GMT -5. The time now is 05:18 PM.