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: <Y+KP/fAQjawSofL1@gmail.com>
Date:   Tue, 7 Feb 2023 17:53:01 +0000
From:   Eric Biggers <ebiggers@...nel.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Dan Carpenter <error27@...il.com>, linux-block@...r.kernel.org,
        Julia Lawall <julia.lawall@...ia.fr>,
        Luis Chamberlain <mcgrof@...nel.org>,
        Hongchen Zhang <zhanghongchen@...ngson.cn>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Christian Brauner (Microsoft)" <brauner@...nel.org>,
        David Howells <dhowells@...hat.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        maobibo <maobibo@...ngson.cn>,
        Matthew Wilcox <willy@...radead.org>,
        Sedat Dilek <sedat.dilek@...il.com>
Subject: Re: block: sleeping in atomic warnings

On Tue, Feb 07, 2023 at 08:15:04AM -0800, Linus Torvalds wrote:
> On Tue, Feb 7, 2023 at 6:06 AM Dan Carpenter <error27@...il.com> wrote:
> >
> > block/blk-crypto-profile.c:382 __blk_crypto_evict_key() warn: sleeping in atomic context
> > block/blk-crypto-profile.c:390 __blk_crypto_evict_key() warn: sleeping in atomic context
> 
> Yeah, that looks very real, but doesn't really seem to be a block bug.
> 
> __put_super() has a big comment that it's called under the sb_lock
> spinlock, so it's all in atomic context, but then:
> 
> > -> __put_super()
> >    -> fscrypt_destroy_keyring()
> >       -> fscrypt_put_master_key_activeref()
> >          -> fscrypt_destroy_prepared_key()
> >             -> fscrypt_destroy_inline_crypt_key()
> >                -> blk_crypto_evict_key()
> 
> and we have a comment in __blk_crypto_evict_key() that it must be
> called in "process context".
> 
> However, the *normal* unmount sequence does all the cleanup *before*
> it gets sb_lock, and calls fscrypt_destroy_keyring() in process
> context, which is probably why it never triggers in practice, because
> the "last put" is normally there, not in __put_super.
> 
> Eric? Al?
> 
> It smells like __put_super() may need to do some parts delayed, not
> under sb_lock.
> 

It's a false positive.  See the comment above fscrypt_destroy_keyring(), which
is meant to explain this, though I can update the comment to be clearer.  If the
filesystem has been mounted, then fscrypt_destroy_keyring() is called from
generic_shutdown_super(), which can sleep, and the call from __put_super() is a
no-op.  If the filesystem has not been mounted, then the call from __put_super()
is needed, but blk_crypto_evict_key() can never be executed in that case.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ