lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1231799141.2714.24.camel@linux-51e8.site>
Date:	Tue, 13 Jan 2009 09:25:40 +1100
From:	Ben Nizette <bn@...sdigital.com>
To:	joseluismarchetti@...oo.com.br
Cc:	Robert Hancock <hancockr@...w.ca>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	linux-kernel@...r.kernel.org
Subject: Re: How to access a regular file from within a module ?

On Mon, 2009-01-12 at 07:51 -0800, Jose Luis Marchetti wrote:

> OK, that is clear now.
> From all I read, it is possible to access files from within inside the kernel, but it would not be a good practice, thanks for the insights.
> > 

I don't know why no-one's brought this up already but no, it usually
isn't even possible.  As previously mentioned, you will hijack the
current user context to do your file operations.  That context may be in
a different filesystem namespace (eg due to chroot'ing) and as such
*won't even be able to see the file you're trying to hit*.

Even if you create a new kernel thread which is parented to init you'll
get a consistent view of files but it's still very hard to know it's the
*right* view of files.

http://kernelnewbies.org/FAQ/WhyWritingFilesFromKernelIsBad

	--Ben.


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ