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, 10 Mar 2016 11:04:03 +0100
From:	Jan Kara <jack@...e.cz>
To:	Daeho Jeong <daeho.jeong@...sung.com>
Cc:	tytso@....edu, jack@...e.cz, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v3 2/3] ext4: fix races between changing inode journal
 mode and ext4_writepages

On Wed 09-03-16 17:09:46, Daeho Jeong wrote:
> Now, in ext4, there is a race condition between changing inode journal
> mode and ext4_writepages(). While ext4_writepages() is executed on
> a non-journalled mode inode, the inode's journal mode could be enabled
> by ioctl() and then, some pages dirtied after switching the journal
> mode will be still exposed to ext4_writepages() in non-journaled mode.
> To resolve this problem, we use fs-wide per-cpu rw semaphore by
> Jan Kara's suggestion because we don't want to waste ext4_inode_info's
> space for this extra rare case.
> 
> Signed-off-by: Daeho Jeong <daeho.jeong@...sung.com>
> Signed-off-by: Jan Kara <jack@...e.cz>

The patch is almost fine except for one small issue:

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 9ecfb76..1176142 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2476,6 +2476,7 @@ static int ext4_writepages(struct address_space *mapping,
>  	struct blk_plug plug;
>  	bool give_up_on_write = false;
>  
> +	percpu_down_read(&sbi->s_journal_flag_rwsem);
>  	trace_ext4_writepages(inode, wbc);

You need to change how dax_writeback_mapping_range() is called a few lines
below so that it also exits via out_writepages: and not directly.

								Honza

-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ