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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 9 Nov 2006 17:33:17 +0000
From:	Christoph Hellwig <hch@...radead.org>
To:	Jeff Layton <jlayton@...hat.com>
Cc:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
	akpm@...l.org
Subject: Re: [PATCH 1/3] new_inode_autonum: add per-sb lastino counter and add new_inode_autonum function that guarantees i_ino uniqueness

On Thu, Nov 09, 2006 at 10:24:39AM -0500, Jeff Layton wrote:
> +/**
> + *	new_inode_autonum 	- obtain an inode with a unique i_ino value
> + *	@sb: superblock
> + *
> + *	Allocates a new inode for given superblock. Ensures that i_ino is
> + *	unique on the filesystem.
> + */
> +struct inode *new_inode_autonum(struct super_block *sb)
> +{
> +	struct inode *inode;
> +
> +	inode = __new_inode(sb);
> +	inode->i_ino = iunique(sb, 0);
> +	return inode;

Why do we need this wrapper?  The callers could aswell just do the
iunique call themselves.  It's already exported aswell.

> +/**
> + *	new_inode 	- obtain an inode -- i_ino not guaranteed unique
> + *	@sb: superblock
> + *
> + *	Allocates a new inode for given superblock. i_ino is not guaranteed to
> + *	be unique. Should only be used when i_ino is going to be clobbered.
> + */
> +struct inode *new_inode(struct super_block *sb)
> +{
> +	struct inode *inode;
> +
> +	inode = __new_inode(sb);
> +	inode->i_ino = 0; /* 0 to try to catch callers that don't reset it */
> +	return inode;

And this wrapper is rather pointless as inode_init_once already zeroes the
whole inode.  Just keep the name new_inode for the basic don't assigned
inode number thing.

> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -961,6 +961,14 @@ #endif
>  	/* Granularity of c/m/atime in ns.
>  	   Cannot be worse than a second */
>  	u32		   s_time_gran;
> +
> +	/* per-sb inode counter for new_inode. Make it a 32-bit counter when
> +	   we have the possibility of dealing with 32-bit apps */
> +#ifdef CONFIG_COMPAT
> +	unsigned int		s_nextino;
> +#else
> +	unsigned long		s_nextino;
> +#endif

This is more thanb ugly.  CONFIG_COMPAT should not modify core kernel
behaviour.  It's also short sightened as we once again plan to support
64bit inode numbers on 32bit hosts.

-
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