linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernel space realpath()
@ 2003-03-23 17:49 Ramy M. Hassan
  2003-03-23 20:03 ` Matthew Wilcox
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ramy M. Hassan @ 2003-03-23 17:49 UTC (permalink / raw)
  To: linux-fsdevel

Hi,
I am new to kernel development. I am developing now a kernel module to
create log of all file operations under a certain specified directory. I
intercept the system calls that may do modifications to this directory
contents and create the logfile. My problem is that a system call like
sys_unlink takes a path that could be relative, and could contain ".." or
".". It might also contain components that are symlinks to other
directories. So I want to get the real path of that file given its relative
path name.
Is there anyway to do that ?

I appreciate your help.
Best regards

Ramy



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel space realpath()
  2003-03-23 17:49 kernel space realpath() Ramy M. Hassan
@ 2003-03-23 20:03 ` Matthew Wilcox
  2003-03-24 21:06   ` Chris Wright
  2003-03-24  6:34 ` Jan Hudec
  2003-03-24  7:26 ` Nir Tzachar
  2 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2003-03-23 20:03 UTC (permalink / raw)
  To: Ramy M. Hassan; +Cc: linux-fsdevel

On Sun, Mar 23, 2003 at 07:49:18PM +0200, Ramy M. Hassan wrote:
> I am new to kernel development. I am developing now a kernel module to
> create log of all file operations under a certain specified directory. I
> intercept the system calls that may do modifications to this directory
> contents and create the logfile. My problem is that a system call like
> sys_unlink takes a path that could be relative, and could contain ".." or
> ".". It might also contain components that are symlinks to other
> directories. So I want to get the real path of that file given its relative
> path name.
> Is there anyway to do that ?

Isn't this exactly what the LSM project does?  See http://lsm.immunix.org/

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel space realpath()
  2003-03-23 17:49 kernel space realpath() Ramy M. Hassan
  2003-03-23 20:03 ` Matthew Wilcox
@ 2003-03-24  6:34 ` Jan Hudec
  2003-03-24  7:26 ` Nir Tzachar
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Hudec @ 2003-03-24  6:34 UTC (permalink / raw)
  To: Ramy M. Hassan; +Cc: linux-fsdevel

On Sun, Mar 23, 2003 at 07:49:18PM +0200, Ramy M. Hassan wrote:
> Hi,
> I am new to kernel development. I am developing now a kernel module to
> create log of all file operations under a certain specified directory. I
> intercept the system calls that may do modifications to this directory
> contents and create the logfile. My problem is that a system call like
> sys_unlink takes a path that could be relative, and could contain ".." or
> ".". It might also contain components that are symlinks to other
> directories. So I want to get the real path of that file given its relative
> path name.
> Is there anyway to do that ?

You should take a look at some syscall, that returns path. Like
sys_getcwd. It call d_path (resp. __d_path, because it already has all
the locks).

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel space realpath()
  2003-03-23 17:49 kernel space realpath() Ramy M. Hassan
  2003-03-23 20:03 ` Matthew Wilcox
  2003-03-24  6:34 ` Jan Hudec
@ 2003-03-24  7:26 ` Nir Tzachar
  2 siblings, 0 replies; 5+ messages in thread
From: Nir Tzachar @ 2003-03-24  7:26 UTC (permalink / raw)
  To: Ramy M. Hassan; +Cc: linux-fsdevel

> I am new to kernel development. I am developing now a kernel module to
> create log of all file operations under a certain specified directory. I

look at http://www.cs.columbia.edu/~ezk/research/fist/

you can achieve what you want, and even more.



-- 
========================================================================
nir.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel space realpath()
  2003-03-23 20:03 ` Matthew Wilcox
@ 2003-03-24 21:06   ` Chris Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2003-03-24 21:06 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Ramy M. Hassan, linux-fsdevel

* Matthew Wilcox (willy@debian.org) wrote:
> On Sun, Mar 23, 2003 at 07:49:18PM +0200, Ramy M. Hassan wrote:
> > I am new to kernel development. I am developing now a kernel module to
> > create log of all file operations under a certain specified directory. I
> > intercept the system calls that may do modifications to this directory
> > contents and create the logfile. My problem is that a system call like
> > sys_unlink takes a path that could be relative, and could contain ".." or
> > ".". It might also contain components that are symlinks to other
> > directories. So I want to get the real path of that file given its relative
> > path name.
> > Is there anyway to do that ?
> 
> Isn't this exactly what the LSM project does?  See http://lsm.immunix.org/

Actually, LSM works with dentry/vfsmount pairs not raw pathnames, but
yes, there are filesystem level hooks that allow one to do things like
this.
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-24 21:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-23 17:49 kernel space realpath() Ramy M. Hassan
2003-03-23 20:03 ` Matthew Wilcox
2003-03-24 21:06   ` Chris Wright
2003-03-24  6:34 ` Jan Hudec
2003-03-24  7:26 ` Nir Tzachar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).