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: <CAHk-=wg6ohuyrmLJYTfEpDbp2Jwnef54gkcpZ3-BYgy4C6UxRQ@mail.gmail.com>
Date:   Tue, 7 Feb 2023 08:15:04 -0800
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Dan Carpenter <error27@...il.com>,
        Eric Biggers <ebiggers@...nel.org>
Cc:     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 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.

              Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ