Erik Mouw wrote: > At OLS 2002 there was an interesting discussion about persistant data > in drivers during and after the talks from Arjan van der Ven[1] and > Greg Kroah-Hartman[2]. The bottom line was that there really is no > excuse to handle persistant data in the kernel. Handling files from kernelspace is tricky and, i strongly agree with you. The problem is that i work in a very special case: "filesystem implementation" and, i haven't found a way to do differently. You can have a look at "FiST" (a general framework for stackable filesystem) which use files from kernelspace. It's a rare example where things can't be tringered differently. > Arjan made some excellent points why you shouldn't mess with files in > the kernel: > > - Writing a secure parser is non-trivial. Writing a secure kernel-mode > parser is even more non-trivial. I agree, kernel should be 100% robust. > - Every process has its own namespace and hence its own root directory. > Autoloading the driver means the module will be using /sbin/init's > namespace, loading it manually will use whatever namespace root is in > right now. Add chroot for more fun. To avoid "chroot" race and be able to access my file from every process, i need to handle the file handle inside kernel memory and not from user process. I don't know how to do this because "mmap" is designed to work for process memory and not for kernel. > - With initrd there even is a security risk. Also true, unfortunatly this bootstrap stage can't be skip. > > The complete OLS 2002 proceedings (including the papers mentioned) are > available as a PDF file at http://www.linuxsymposium.org/2002/ . > > Erik > > [1] Arjan van der Ven, "How NOT write kernel drivers". See > http://www.linuxsymposium.org/2002/view_txt.php?text=abstract&talk=73 > [2] Greg Kroah-Hartman, "Documentation/CodingStyle and Beyond". See > http://www.linuxsymposium.org/2002/view_txt.php?text=abstract&talk=57 Good reading, thanks. j. -- Jérôme de Vivie -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/