Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D33BC636D3 for ; Tue, 7 Feb 2023 19:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231886AbjBGTgA (ORCPT ); Tue, 7 Feb 2023 14:36:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbjBGTf6 (ORCPT ); Tue, 7 Feb 2023 14:35:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EF473B679; Tue, 7 Feb 2023 11:35:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFE45610E8; Tue, 7 Feb 2023 19:35:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB5EBC433D2; Tue, 7 Feb 2023 19:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675798556; bh=GOpZdtZRgKDtmDXADa0qEIoR4yYcUa4yeh/TXWHd/4U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rfDGzcDRrr8wmW6ribUKyx0FIWU+dM1UdE4+T6CtQa1uhZRtv8Nl4DMKEF06m7cTu yp9Kb6V8VivS4tLLvDgZzAsX8J7s6qe/dOFcvtGLYQrjUbXNd48x5Lhf5FD3y7KeqJ oWL78VFQcNCnggExiIrHmfi4iQIK+3I9TTt72UXy8PKjb9kj1VfrXWR+yCMe0ryfgz iN1Nw07UZE3LZ6s3Jk7CWxpLYkTARXiqQf/D0xcA1VGeA5ZCw86j+iZ/KYR36VKwBA gOcXD3xB/udACpov80jCWq80IFZz7v2lrrwIIZwDDaIGlGmssAhIQiJK2RHuUjH9e+ B29EbRC/XUsDQ== Date: Tue, 7 Feb 2023 19:35:54 +0000 From: Eric Biggers To: Linus Torvalds Cc: Dan Carpenter , linux-block@vger.kernel.org, Julia Lawall , Luis Chamberlain , Hongchen Zhang , Alexander Viro , Andrew Morton , "Christian Brauner (Microsoft)" , David Howells , Mauro Carvalho Chehab , Eric Dumazet , "Fabio M. De Francesco" , Christophe JAILLET , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, maobibo , Matthew Wilcox , Sedat Dilek Subject: Re: block: sleeping in atomic warnings Message-ID: References: <20230129060452.7380-1-zhanghongchen@loongson.cn> <4ffbb0c8-c5d0-73b3-7a4e-2da9a7b03669@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 07, 2023 at 10:57:08AM -0800, Linus Torvalds wrote: > On Tue, Feb 7, 2023 at 10:36 AM Eric Biggers wrote: > > > > Also note that keys are normally added using an ioctl, which can only be > > executed after the filesystem was mounted. The only exception is the key > > associated with the "test_dummy_encryption" mount option. > > Could we perhaps then replace the > > fscrypt_destroy_keyring(s); > > with a more specific > > fscrypt_destroy_dummy_keyring(s); > > thing, that would only handle the dummy encryption case? Sure, they would still need to do most of the same things though. > Or could we just *fix* the dummy encryption test to actually work like > real encryption cases, so that it doesn't have this bogus case? We've wanted to do that for a very long time, but there never has been a way to actually do it. Especially with the filesystem-level keyring now, if the kernel doesn't automatically add the key for test_dummy_encryption, then userspace would have to do it *every time it mounts the filesystem*. The point of the "test_dummy_encryption" mount option is that you can just add it to the mount options and run existing tests, such as a full run of xfstests, and test all the encrypted I/O paths that way. Which is extremely useful; it wouldn't really be possible to properly test the encryption feature without it. So that's why we've gone through some pain to keep "test_dummy_encryption" working over time. Now, it's possible that "the kernel automatically adds the key for test_dummy_encryption" could be implemented a bit differently. It maybe could be done at the last minute, when the key is being looked for due to a user filesystem operation, instead of during the mount itself. That would eliminate the need to call fscrypt_destroy_keyring() from __put_super(), which would avoid the issue being discussed here. I'll see if there's a good way to do that. - Eric