Re: inodes are not cleared!

Savochkin Andrey Vladimirovich (saw@msu.ru)
Thu, 23 Jul 1998 09:24:53 +0400


On Wed, Jul 22, 1998 at 11:01:20PM +0400, kuznet@ms2.inr.ac.ru wrote:
[...]
> The last question: is i_flags the only field not initialized
> properly in socket.c?

Unfortunately, no.

I've found a group of struct inode fields that are never initialized
for sockets and some filesystems. They are not important for the functionality
but they are reported via stat call causing information leak from inodes
you have no access to or from processes if just free'd memory has been reused.

Some fields (like i_rdev) are not initialized in most filesystems!

Here is a patch fixing initialization of sockets.

--- linux.orig/net/socket.c Sat Apr 11 21:42:36 1998
+++ linux/net/socket.c Sun May 24 20:38:15 1998
@@ -290,6 +290,11 @@
inode->i_sock = 1;
inode->i_uid = current->uid;
inode->i_gid = current->gid;
+ inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ /* and meaningless fields: */
+ inode->i_rdev = 0;
+ inode->i_blksize = 1024;
+ inode->i_blocks = 0;

sock->inode = inode;
init_waitqueue(&sock->wait);

Best wishes
Andrey V.
Savochkin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html