Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5450464iob; Mon, 9 May 2022 17:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBNqICIdI4u3CsKhIR4IaiBC0otIXFlBt8nTSNvPYb1hvq9smHQ6ONEol5S5AiWWKJOcml X-Received: by 2002:a05:6830:1d64:b0:606:799a:8e9a with SMTP id l4-20020a0568301d6400b00606799a8e9amr4268285oti.147.1652141434887; Mon, 09 May 2022 17:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652141434; cv=none; d=google.com; s=arc-20160816; b=q8uUK98A66f7tMPTmTYJ3AuNoXqnppwM7XMxZTBcMnc1cOduQXQTz2HzSP73haKOCx jZP0jXpG/aVo5y9VDFAKPoiWhlATGoeFOSgWHGS9imCzmVyHvMz3TUVWjITZikMTgwPP 2+11ELopoeKmp/nplovM399RFKYPPd4z18zu6H1LqieKOs0pQxdy969bFzaDlH8KLNGc LD9s/RyNvC0ImhgcM/9O6OqEtX5gNMFVLUvL0rZiSZZ1UGW6/X/ETaTm2wlynNMeHV4m A6xLvW0+X/A4+FQxslxRhrZDSBltOtHlxpz8GN+CnIDdsq0rdStkye6qKSTpKdVAaHGN Qxzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z7gCAC3XIK1Ei3AgBRzRpDRN+kIB8M1f7D41zKn6VmI=; b=GidoBozn+OzPm3gUtJQztlNW0F1c3xRN4NvQVqy3Jb2ayeBdWfjqSRwXVtul/b50nt Gra3xH49+QFxUw1tyNQpoWGWO72JvyyQs6OXyL7cJNqzRfyWuLhNoMVbk27V5dqKnsoJ EEvumHeQyzoghiyIVkUzUicu67efRkxCEprIIche3kr/o7TLU7B1igTUqDu8/p3YjpAr WXqBR3ahBt0tb/DyGZ1oNmCWiCui472c8GkhTEcPia5vTQbLrNnLl3gKmtFLsmaPZvRH pJRI8kUGgl4iIew2jvU2hlCcFCHEL3jgWkHyAO8FUSOOuVOQ8iSLHp9H/cQnZWbgA4dp ZjIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OB6Bv54N; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a056830060100b005cb2fc13865si11255466oti.225.2022.05.09.17.10.15; Mon, 09 May 2022 17:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OB6Bv54N; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231564AbiEIXsg (ORCPT + 99 others); Mon, 9 May 2022 19:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbiEIXrb (ORCPT ); Mon, 9 May 2022 19:47:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BCD52CE230; Mon, 9 May 2022 16:40:31 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 68BEBB819D6; Mon, 9 May 2022 23:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDCDFC385C2; Mon, 9 May 2022 23:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652139629; bh=RLRAqi8NcpOLCm0sad+42+BXu2XUKaGuSgWzJjtxch0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OB6Bv54N3c1nd1ASVso50lKwDGHnTt3gojR/6u9cXxTNXqkrPFwKTRS22ATNcXBvU FupdC/uG4ukZCXgG2H3BNJpxkeS8LLVNxEoyQ2oSocyxx4kH/d0y3mXElKwwvIPtHe dUDzt35YsU5vqDWLVD6p/TTs61j/q6G+YoBgJBuENC0jDB0r4IdlyRaI8+FwAgXL8y SWkEEEi7WUg2UseIzsD8TmxEY1Uwb+iSOZ9mgm9c9snZ8emFvzxv4f4Zmyt6NUfQOi TzMZlseoamQ7+mj8VAL+eVvudLGA3viK3ePWFp7W1RLT3znPRwKTk3rkEthqPAsOpF 0nMruR3yXmo4g== Date: Mon, 9 May 2022 16:40:27 -0700 From: Eric Biggers To: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jeff Layton , Lukas Czerner , Theodore Ts'o , Jaegeuk Kim Subject: Re: [PATCH v2 5/7] ext4: fix up test_dummy_encryption handling for new mount API Message-ID: References: <20220501050857.538984-1-ebiggers@kernel.org> <20220501050857.538984-6-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220501050857.538984-6-ebiggers@kernel.org> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org A couple corrections I'll include in the next version: On Sat, Apr 30, 2022 at 10:08:55PM -0700, Eric Biggers wrote: > + if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) { > + if (fscrypt_dummy_policies_equal(&sbi->s_dummy_enc_policy, > + &ctx->dummy_enc_policy)) > + return 0; > ext4_msg(NULL, KERN_WARNING, > - "Can't set test_dummy_encryption on remount"); > + "Can't set or change test_dummy_encryption on remount"); > return -EINVAL; > } I think this needs to be 'fc->purpose == FS_CONTEXT_FOR_RECONFIGURE || fscrypt_is_dummy_policy_set(&sbi->s_dummy_enc_policy)', since ext4 can parse mount options from both s_mount_opts and the regular mount options. > +static void ext4_apply_test_dummy_encryption(struct ext4_fs_context *ctx, > + struct super_block *sb) > +{ > + if (!fscrypt_is_dummy_policy_set(&ctx->dummy_enc_policy)) > + return; To handle remounts correctly, this needs to be '!fscrypt_is_dummy_policy_set(&ctx->dummy_enc_policy) || fscrypt_is_dummy_policy_set(&EXT4_SB(sb)->s_dummy_enc_policy)'. - Eric