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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 3 Apr 2008 15:07:00 -0400
From:	Erez Zadok <>
To:	"Josef 'Jeff' Sipek" <>
Cc:	Erez Zadok <>,,,,
	Al Viro <>,
Subject: Re: fs_stack/eCryptfs: remove 3rd arg of copy_attr_all, add locking to copy_inode_size 

In message <>, "Josef 'Jeff' Sipek" writes:
> On Wed, Apr 02, 2008 at 09:49:11PM -0400, Erez Zadok wrote:
> ...
> > +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
> > +	spin_lock(&dst->i_lock);
> > +#endif
> I think you need to check CONFIG_PREEMPT as well.
> Josef 'Jeff' Sipek.

I'm not sure if it's needed in case of CONFIG_PREEMPT.  Anyone?  The code
for i_size_write (below), and the comment at the top of the function,
suggest that the spinlock is needed only to prevent the lots seqcount.

 * NOTE: unlike i_size_read(), i_size_write() does need locking around it
 * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
 * can be lost, resulting in subsequent i_size_read() calls spinning forever.
static inline void i_size_write(struct inode *inode, loff_t i_size)
#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
	inode->i_size = i_size;
#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
	inode->i_size = i_size;
	inode->i_size = i_size;

BTW, some time ago I reviewed all callers of i_size_write.  I did so again
just now, and the results were the same:

- a LOT of callers of i_size_write don't take any lock
- some take another spinlock in a different data structure
- those that do take the spinlock, do so unconditionally
- only unionfs and fs/stack.c wrap the spinlock in

	#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists