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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 3 Apr 2008 15:07:00 -0400 From: Erez Zadok <ezk@...sunysb.edu> To: "Josef 'Jeff' Sipek" <jeffpc@...efsipek.net> Cc: Erez Zadok <ezk@...sunysb.edu>, akpm@...ux-foundation.org, linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>, hch@...radead.org Subject: Re: fs_stack/eCryptfs: remove 3rd arg of copy_attr_all, add locking to copy_inode_size In message <20080403182001.GB30189@...efsipek.net>, "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) write_seqcount_begin(&inode->i_size_seqcount); inode->i_size = i_size; write_seqcount_end(&inode->i_size_seqcount); #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) preempt_disable(); inode->i_size = i_size; preempt_enable(); #else inode->i_size = i_size; #endif } 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) Erez. -- 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