Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp33787rdh; Tue, 6 Feb 2024 18:09:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFY6T8dt9iroxOjPr/LyEiCMdMTG2p6Rspi5/XCTf2m0CXoGLKrndsnQ1El4APNGSNkI4i X-Received: by 2002:a17:906:4750:b0:a36:802b:2639 with SMTP id j16-20020a170906475000b00a36802b2639mr5138087ejs.11.1707271782816; Tue, 06 Feb 2024 18:09:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707271782; cv=pass; d=google.com; s=arc-20160816; b=L0KizA4ZClDUTxb40d0rZfTzT6C9SRunBcGQ2cAthR/NM4Rw/z3542pIarPGiZPnIn Uu90c8GDHTXwYKEP3pMqf3OqWXYC12vT53fdJ1G9tvpUx+KXKpXPNfaF9T/gyEUFvIK+ 3hlYaYmWk9eojlX4i3uH5Jlf73pGK7t/rZweIbQkVqJ97uVCT8noU5YG+dkc3dEQCn57 pDuAvAxoT2E5KqZwPKdC58YiPA09EAt9IhHsWCM5czsQlJ+xFmber56XUOnVbD+sRZid HtI5qvmO+cWazgy3VmYxcig2TLo1E85wqN/6w83HyVornpXBxpFqBmJl+XQbhsqhju+U 9sSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=++I8ohVZqZsnkrpMTnNHgZjBWSSQ0NOqOxOVzrM8PVk=; fh=I3O4iDlDGFojKLdH4TNqyn7RHZnqEt/qS9KgK10WHIc=; b=RcnKxPDzypZI/wO11pwG5qwXaQ+BI7ZgR9spQNdFqvv2Hmhon3nC+qecO910rMzcXa 7++Jd1eRTug1oFH5KO74Tmqx9e7bMbF+ydzzgTySf9Rk0TxHP9NEuYWbF/8xrjSLtrUt ZjgErvA7nOqzNNcOzh0F4KYlGvLbUnQ3PNcwwef+JfZR7aQ8zxqjvoYFcv+MxQ1HOmiR Ugyupk7ikKnx5eyZCAVgB81efQ1BTJ5+uTnQDTsgUhkBXwz/QK3va/v97FDbEXFQPEXb EXy5S74LFcwBV+UuXGJGhOdU4/KzUWFYIjCCwXGasc49O3faq0r4FXSgqsNlq58PqBaf tujg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DJiqYOmL; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-55836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCUmCAqo4hXbQk0BYeFv45bBEQEzshnV38RttR5QonE43RWqY8foHfFC+dD/pOu32Ut4eseiOs1dkGlH+2uiDlI1XL0+Qex1tf3dYe5fjw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b8-20020a170906d10800b00a382cd9b8d9si242028ejz.307.2024.02.06.18.09.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:09:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DJiqYOmL; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-55836-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55836-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9110F1F2832B for ; Wed, 7 Feb 2024 02:09:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29332EECC; Wed, 7 Feb 2024 02:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DJiqYOmL" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 621E5DDA7 for ; Wed, 7 Feb 2024 02:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271770; cv=none; b=Srx6q4d8NWDDyNKGmry4E3LJTcr5NF3NacjD2IJVUogVXOtUNYzFYAtNH11kf2n8a9PRIijHNJrntoqj1iUT7lB72br4FBvMXPFo9TV8OMbjlfzPOB8cWWwYCP0Sc7/QisqYU2MGBNHUSBBNm6OnscmwdMqVnjofhQQuUdJ42UQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707271770; c=relaxed/simple; bh=UAPXd7rOZbx98r8KvdfkNo0YYES+bEmSjU7lI2NGJUw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=afIdotY8Wi5s1GNg2YOJV3R0uaAe+l8cqvkfs/7/umyCjBO08YXb2q1Ca0KG/G6OyHSjBd0kjYqYzDXE/QbRkRxGSE+kfKFqvYnqQ0qrjK1QNvFVIevEZz9g85pwhzz4hM8L92nIGkC6xi9/qbYtcWrZWjrYR+UpJbeFBzi5G7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DJiqYOmL; arc=none smtp.client-ip=95.215.58.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Tue, 6 Feb 2024 21:09:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707271766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=++I8ohVZqZsnkrpMTnNHgZjBWSSQ0NOqOxOVzrM8PVk=; b=DJiqYOmLpdyTuFwHjZGIxdLr7RGUBwG/wC09pcUKcfozeCSZEk7Nb0LM6Y87UNvvQ/A7UC 8FtxY69z0sdUC0kdMZkKmQmyD9sUixGNUvgFE4OGF2kfuzg9mo/VOnLtVq9/3O2B6mC98/ FutDEjfrB9X5v1tR61tTwZxrJ8VUFYo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Eric Biggers Cc: brauner@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/7] filesystem visibililty ioctls Message-ID: References: <20240206201858.952303-1-kent.overstreet@linux.dev> <20240207014729.GC35324@sol.localdomain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240207014729.GC35324@sol.localdomain> X-Migadu-Flow: FLOW_OUT On Tue, Feb 06, 2024 at 05:47:29PM -0800, Eric Biggers wrote: > On Tue, Feb 06, 2024 at 03:18:48PM -0500, Kent Overstreet wrote: > > > > Darrick also noticed that fscrypt (!) is using sb->s_uuid, which looks > > busted - they want to be using the "this can never change" UUID, but > > that is not an item for this patchset. > > > > fscrypt only uses sb->s_uuid if FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 or > FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 is being used in the encryption policy. > These flags are only supported by ext4 and f2fs, and they are only useful when > the file contents encryption is being done with inline encryption hardware that > only allows 64-bits or less of the initialization vector to be specified and > that has poor performance when switching keys. This hardware is currently only > known to be present on mobile and embedded systems that use eMMC or UFS storage. > > Note that these settings assume the inode numbers are stable as well as the > UUID. So, when they are in use, filesystem shrinking is prohibited as well as > changing the filesystem UUID. (In ext4, both operations are forbidden using the > stable_inodes feature flag. f2fs doesn't support either operation regardless.) > > These restrictions are unfortunate, but so far they haven't been a problem for > the only known use case for these non-default settings. > > In the case of s_uuid, for both ext4 and f2fs it's true that we could have used > s_encrypt_pw_salt instead, or added a new general-purpose internal UUID field > and used that. Maybe we even should have, considering the precedent of ext4's > metadata_csum migrating away from using the UUID to its own internal seed. I do > worry that relying on an internal UUID for these settings would make it easier > for people to create insecure setups where they're using the same fscrypt key on > multiple filesystems with the same internal UUID. With the external UUID, such > misconfigurations are obvious and will be noticed and fixed. With the internal > UUID, such vulnerabilities would not be noticed, as things will "just work". > Which is better? It's not entirely clear to me. We do encourage the use of > different fscrypt keys on different filesystems anyway, but this isn't required. *nod* nonce reuse is a thorny issue - that makes using the changeable, external UUID a bit more of a feature than a bug. > Of course, even if the usability improvement outweighs that concern, switching > these already-existing encryption settings over to use an internal UUID can't be > done trivially; it would have to be controlled by a new filesystem feature flag. > We probably shouldn't bother unless/until there's a clear use case for it. > > If anyone does have any new use case for these weird and non-default encryption > settings (and I hope you don't!), I'd be interested to hear... I just wanted to make sure I wasn't breaking fscrypt by baking-in that s_uuid is the user facing one - thanks for the info. Can we get this documented in a code comment somewhere visible? It was definitely a "wtf" moment when Darrick and I saw it, I want to make sure people know what's going on later.