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]
Message-ID: <20221220195306.GU10499@twin.jikos.cz>
Date:   Tue, 20 Dec 2022 20:53:06 +0100
From:   David Sterba <dsterba@...e.cz>
To:     wqu@...e.com
Cc:     Chung-Chiang Cheng <shepjeng@...il.com>,
        Chung-Chiang Cheng <cccheng@...ology.com>, clm@...com,
        josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...heng.net, Johnny Chang <johnnyc@...ology.com>
Subject: Re: [PATCH] btrfs: refuse to remount read-write with unsupported
 compat-ro features

On Tue, Dec 06, 2022 at 11:14:56AM +0000, Filipe Manana wrote:
> On Tue, Dec 6, 2022 at 2:42 AM Chung-Chiang Cheng <shepjeng@...il.com> wrote:
> >
> > On Mon, Dec 5, 2022 at 6:45 PM Filipe Manana <fdmanana@...nel.org> wrote:
> > >
> > > Wasn't this already done by the following commit?
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=81d5d61454c365718655cfc87d8200c84e25d596
> > >
> > > Thanks.
> > >
> >
> > Wow. I did not notice this commit doing the same job by Qu. But I have
> > tested the latest linux-6.1 rc-7, and it's still able to mount a unsupported
> > comat-ro btrfs as read-write via remount.
> >
> > It's caused by the follow-up commit d7f67ac9a928 ("btrfs: relax
> > block-group-tree feature dependency checks"). This commit checks read-
> > only with the current superblock, which will always pass in the situation
> > remounting from read-only to read-write. It seems `btrfs_check_features()`
> > cannot cover this scenario.
> >
> >         if (compat_ro_unsupp && !sb_rdonly(sb)) {
> >                                 ^^^^^^^^^^^^^^
> 
> Yep, that's a bug.
> btrfs_check_features() is called before the read only flag is updated
> in the super block.
> 
> So the condition should be:
> 
> if (compat_ro_unsupp && sb_rdonly(sb) && we_want_to_transition_to_rw)
> 
> We need to pass the flags passed to btrfs_remount() to
> btrfs_check_features() for that "we_want_to_transition_to_rw" check.
> 
> That seems to be what needs to be fixed.

Qu, can you please have a look, it's caused by commit
81d5d61454c365718655cfc87d8200c84e25d596 that's also in stable kernels
so this should be fixed quickly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ