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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190826150350.GH10614@quack2.suse.cz>
Date:   Mon, 26 Aug 2019 17:03:50 +0200
From:   Jan Kara <jack@...e.cz>
To:     "zhangyi (F)" <yi.zhang@...wei.com>
Cc:     "Theodore Y. Ts'o" <tytso@....edu>, linux-ext4@...r.kernel.org,
        jack@...e.cz, adilger.kernel@...ger.ca
Subject: Re: [PATCH v5] ext4: fix potential use after free in system zone via
 remount with noblock_validity

On Mon 26-08-19 16:31:41, zhangyi (F) wrote:
> On 2019/8/26 10:56, Theodore Y. Ts'o Wrote:
> > I added a missing rcu_read_lock() to prevent a suspicious RCU
> > warning when CONFIG_PROVE_RCU is enabled:
> > 
> > diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
> > index 003dc1dc2da3..f7bc914a74df 100644
> > --- a/fs/ext4/block_validity.c
> > +++ b/fs/ext4/block_validity.c
> > @@ -330,11 +330,13 @@ void ext4_release_system_zone(struct super_block *sb)
> >  {
> >  	struct ext4_system_blocks *system_blks;
> >  
> > +	rcu_read_lock();
> >  	system_blks = rcu_dereference(EXT4_SB(sb)->system_blks);
> >  	rcu_assign_pointer(EXT4_SB(sb)->system_blks, NULL);
> >  
> >  	if (system_blks)
> >  		call_rcu(&system_blks->rcu, ext4_destroy_system_zone);
> > +	rcu_read_unlock();
> >  }
> >  
> >  int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk,
> > 
> 
> Hi Ted,
> Sorry about missing this warning, I think switch to use:
>   system_blks = rcu_dereference_raw(EXT4_SB(sb)->system_blks);
> or
>   system_blks = rcu_dereference_protected(EXT4_SB(sb)->system_blks, true);
> is enough to fix this waring, am I missing something?

Proper fix for this is actually using:

 system_blks = rcu_dereference_protected(EXT4_SB(sb)->system_blks,
					 lockdep_is_held(&sb->s_umount));

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ