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>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 11 Jan 2007 11:46:41 -0500
From:	Jeff Layton <jlayton@...chiereds.net>
To:	Eric Sandeen <sandeen@...hat.com>
CC:	Christoph Hellwig <hch@...radead.org>,
	Jeff Layton <jlayton@...hat.com>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	esandeen@...hat.com, aviro@...hat.com
Subject: Re: [PATCH 2/3] change libfs sb creation routines to avoid collisions
 with their root inodes

Eric Sandeen wrote:
 > Christoph Hellwig wrote:
 >
 >>>  		return -ENOMEM;
 >>> +	/* set to high value to try and avoid collisions with loop below */
 >>> +	inode->i_ino = 0xffffffff;
 >>> +	insert_inode_hash(inode);
 >> This is odd.  Can't we just add some constant base to the loop below?
 >>
 > I thought the same thing, but Jeff pointed out that
 > nfsctl_transaction_write does ops based on inode numbers, and they maybe
 > can't move around?
 >
 >         rv =  write_op[ino](file, data, size);
 >
 > However, nfsd's call to simple_fill_super already sends in a set of
 > files starting at inode 2:
 >
 > enum {
 >         NFSD_Root = 1,
 >         NFSD_Svc,
 > ...
 >
 >         static struct tree_descr nfsd_files[] = {
 >                 [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR},
 > ...
 >         return simple_fill_super(sb, 0x6e667364, nfsd_files);
 >
 > which does...
 >
 >       for (i = 0; !files->name || files->name[0]; i++, files++) {
 >                 if (!files->name)
 >                         continue;
 > ...
 >                 inode->i_ino = i;
 >
 > So I think it's already expecting the root inode at one, and the other
 > files starting at 2?
 >

Very interesting -- I saw that nfsctl depended on certain values for i_ino,
but I didn't notice that it had reserved the first slot for NFSD_Root. The
only other caller of simple_fill_super that seems to depend on the inode
numbers is selinuxfs, and that one has this:

enum sel_inos {
         SEL_ROOT_INO = 2,

...so it looks like we can probably use 1 for the root inode (though we might
want to fix selinuxfs to set SEL_ROOT_INO = 1). I'll have a closer look to be
sure that this is all correct and respin this patch since that seems like it
would be less magic-number-y.

Thanks,
Jeff
-
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