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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4BCABED6.7050400@nerdgrounds.com>
Date:	Sun, 18 Apr 2010 01:12:06 -0700
From:	Jonathan Campbell <jon@...dgrounds.com>
To:	ratheesh k <ratheesh.ksz@...il.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: open sockets from task_struct

Get the Linux kernel source and look at what the procfs filesystem is 
doing to get that information. Look under fs/proc.
fs/proc/base.c(2508) seems to contain the inode structures for 
/proc/pid/fd and /proc/pid/fdinfo, locate the inode operations
structure and locate the functions. Drill down through the function 
calls and you'll eventually find how to read what
file handles are open. A quick glance tells me that the calls go several 
layers deep including a call through a function pointer passed in one of 
the parameters, "instantiate", hopefully that won't be a problem for you.
> On Sun, Apr 18, 2010 at 12:53 PM, Jonathan Campbell<jon@...dgrounds.com>  wrote:
>    
>> I know that on the user-space side any open handles can be seen in the
>> /proc/<pid>/fd directory (<pid>  is whatever process you're interested in).
>> Assuming you're talking about reading this from kernel space, I'd look at
>> what the procfs filesystem is doing and learn from that.
>> Sockets and block/char devices are listed like any other file, the list is
>> based on file handles.
>>      
>>> I have task_struct structure , how to find all the opened files ? how
>>> to find opened sockets ?
>>>
>>> Thanks,
>>> Ratheesh
>>> --
>>> 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/
>>>
>>>
>>>
>>>        
>>
>>      
> I need it in kernel space and i am using  2.6.29.4 kernel .. could you
> please guide a little ?
>
>
>    

--
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