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
| ||
|
Message-ID: <53CE3722.60307@ispras.ru> Date: Tue, 22 Jul 2014 14:04:18 +0400 From: Andrey Tsyvarev <tsyvarev@...ras.ru> To: Gu Zheng <guz.fnst@...fujitsu.com> CC: Jaegeuk Kim <jaegeuk@...nel.org>, linux-f2fs-devel@...ts.sourceforge.net, linux-kernel <linux-kernel@...r.kernel.org>, Alexey Khoroshilov <khoroshilov@...ras.ru> Subject: Re: f2fs: Possible use-after-free when umount filesystem Hi Gu, >> Investigation shows, that f2fs_evict_inode, when called for 'meta_inode', uses invalidate_mapping_pages() for 'node_inode'. >> But 'node_inode' is deleted before 'meta_inode' in f2fs_put_super via iput(). >> >> It seems that in common usage scenario this use-after-free is benign, because 'node_inode' remains partially valid data even after kmem_cache_free(). >> But things may change if, while 'meta_inode' is evicted in one f2fs filesystem, another (mounted) f2fs filesystem requests inode from cache, and formely >> 'node_inode' of the first filesystem is returned. > The analysis seems reasonable. Have you tried to swap the reclaim order of node_inde > and meta_inode? > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 870fe19..e114418 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -430,8 +430,8 @@ static void f2fs_put_super(struct super_block *sb) > if (sbi->s_dirty && get_pages(sbi, F2FS_DIRTY_NODES)) > write_checkpoint(sbi, true); > > - iput(sbi->node_inode); > iput(sbi->meta_inode); > + iput(sbi->node_inode); > > /* destroy f2fs internal modules */ > destroy_node_manager(sbi); > > Thanks, > Gu With reclaim order of node_inode and meta_inode swapped, use-after-free error disappears. But shouldn't initialization order of these inodes be swapped too? As meta_inode uses node_inode, it seems logical that it should be initialized after it. -- Best regards, Andrey Tsyvarev Linux Verification Center, ISPRAS web:http://linuxtesting.org -- 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