
From the editor's desk
The second issue of the lprogs Journal is out. The first issue was accepted as a good initiative by some people. And that is enough to keep this going. Though the posts this month were less in number , but we had more "technical" posts and they have al been compiled together in this issue. ILUG-DELHI also celebrated its annual festival "FreeDel,2006" of which i was a part. I delivered a talk there . You will find the relevant link in this issue also. So you have the 2nd issue of the journal packed with GNU/LINUX and FLOSS Topics.
To DO
Talk on IDS & IPS at FreeDel,2006
Group Posts
The query
amit saha wrote:
struct rule{
int proto;
char source[15];
}instance;
I have written this structure into a file in user space ,say rule.txt .
Say this file contains 10 records , i. e 10 instances of the above
structure.Now I would like to read the same file in kernel space by a
kernel module by reading 1 record at a time. How can i do this ?
Is there any other way to do this without using files ? My objective
is to read the 10 records from kernel space one record at a time and
not the individual bytes.
The replies:
2) using kernel system call which has been exported by kernel
3) create and use sysfs files within a kernel module.
4) using netlink socket.
But the question is that why we shouldn't read or write files in kernel space? And what is the efficient way to do that?does kernel actually reads or writes files?
The only one reason that i could find , "where" and "how" files would be located and loaded . and it is policy decision in the linux community that we shouldn't do. The problem is , where this config file lives? Is there any particular location where all config file can stay and read by kernel. If i am correct, the various same config file location could be different in different distribution. So one my kernel module can run only one distribution. It is not guaranteed that it will run in different distribution.
And yes how to load the config files. May today u r using very simple file but tomorrow you could use very complex database file and in that case kernel doesn't have more flexibility to handle such file.
So many kernel hackers suggest not to read and write file in kernel space. But what is the solution? Yes as per my knowledge, We could do like
1.implement file reading and writing in user space
2. communicate vis /proc entry.
I can give some example
1.Mounting file system [ mount program reads config file /etc/fstab and issue mount system call]
2.Netfilter filrewalls gets rule from user space application[iptables which read the configuration file and communication with kernel via socket]
From Linux Journal
Miscellaneous Resources & Good Readings
Kernel Status
Journal Contributors
