Re: sys_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 21, 2004 at 16:40:14 -0700, Can Sar wrote:
> Hi,
> 
> I am making some modifications to the Linux sys_open function to keep 
> track of various things. Two of the things I am trying to do is to get 
> the path of the executable that is doing the open, and the path of the 
> file being opened.
> Let me start with the file name: I have tried to copy the path from the 
> user (it is stored by) filename using strncpy_from_user into a buffer 
> of size PATH_MAX, and also tried to strcpy tmp, which is what 
> getname(filename) returns (a kernel pointer). Every time I try to copy 
> this though, my kernel just crashes. My theory is that it is missing a 
> '\0' but I am not really sure. Can someone help?

Theories are worthless. Could you describe HOW the kernel crashes?

Anyway, the best way is to get user-mode-linux, attach debugger to it...

> My other problem is figuring out where to get the path for exec from, 
> is there someway to find this using current? I've been looking through 
> several files, but couldn't figure out a way.

Have a look at how the /proc entries are generated. They include symlink
to the executable, so there has to be a code that get's the path.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux