LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2005, 09:19 AM   #1
Caliber
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Rep: Reputation: 0
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.
 
Old 04-18-2005, 01:03 PM   #2
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
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.
 
Old 04-19-2005, 09:08 AM   #3
Caliber
LQ Newbie
 
Registered: Apr 2005
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Interface between user mode and kernel mode santosh_pn Linux - Software 1 06-17-2005 07:20 AM
how to open /proc file in RW mode in user mode? cranium2004 Programming 3 03-06-2005 03:03 AM
writing to file ej25 Programming 17 11-19-2004 11:23 AM
vim: coding mode and doc writing mode? miknight Linux - Software 2 03-07-2004 08:51 PM
writing to hard disk from kernel mode.. udayan Programming 0 07-09-2002 05:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration