Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1247522ybb; Wed, 1 Apr 2020 19:20:41 -0700 (PDT) X-Google-Smtp-Source: APiQypK0i9hTAzGgkDa6w7Q9yJQQWjpufX/yLSVUoJ7aPdRmwicC/dFo2iQzVfo0Qk0J3tuMeQHO X-Received: by 2002:a05:6830:19ec:: with SMTP id t12mr678177ott.24.1585794041582; Wed, 01 Apr 2020 19:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585794041; cv=none; d=google.com; s=arc-20160816; b=fqYnqL1xAlqvDaDVyTjIwZSwAfc3BmTo0W+ovRPi+m8bhOzN7oq2akrhPaV+CcRnTz D2IwAbzZOrCaj5xa8PDO+NJpjJKSqKxMknkeVcP0ZAXsXpspXHU1B6YOVt7fNQfEODy5 elpQFkZSar2J4I/F2nlqE//TfkTB2f7w43fG7Qti4avxh8tXukvebqqOWDE9asVJYenN BnC1GDOorCRs0lH+Peqg/gWsZtEVpAVXsWObO3+SHRxrOkAL583DDO+4cESuBOi8z0mb 3I0MOrrJiMSxib5VynQsZmSuDPc4wVhpzI/YQVLNfR64J01AwzcuQYl7uKo5103taa8o I7yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature; bh=cRVGT7W3LSRRhDk/rlNVm/PGeYNXtUFpf2OpNSP8aCM=; b=BKCOBQqLxWUxhpLZ+jNb25jotWWpkpKProeIw+hXPHdM6WPyfzw9/r5kbpDF9DwyQv 3uR33BB9Aj9FHLOgfQGFf7P2hp6a+ISmus9VS0Ts3/oj+7lttm5g7NYdSeW3Trk/QQnl tr1gF9gXeoQYmSLYvUclrYXl+6lSHALv1BrHLs53m3DuKobX6VWNPONH7BbWkW8PjOm9 pKXpFmHlmG9G/EzCEcqwaZIL/inCrXA4c7Z+lXeFgdbrueqrqcP0T9Bykj6CFn9R3J6h jW1FqevfOw8cfOiZxhVbuZtxj9u6wwnl5vSVGDBZbi9ljjQzDDVxSgXTXVumZVCi4ONg BPjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=DqlOzrYR; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c31si1564007otb.281.2020.04.01.19.20.29; Wed, 01 Apr 2020 19:20:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=DqlOzrYR; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732660AbgDBCTm (ORCPT + 99 others); Wed, 1 Apr 2020 22:19:42 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33050 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732560AbgDBCTm (ORCPT ); Wed, 1 Apr 2020 22:19:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay1so774817plb.0 for ; Wed, 01 Apr 2020 19:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=cRVGT7W3LSRRhDk/rlNVm/PGeYNXtUFpf2OpNSP8aCM=; b=DqlOzrYRWebqHdkkoa2qFY3+eudf2pM6EUhuM1CofZ9vXs32ZXpsmkysBD9K7ebG9P 2bs+5Fbm+n4irVdwPYDmv7Iashc7AabNVnLn8jqXdYilnfi+wyhskwbvYoy2cZwq44Xz iptdPKK8LwsVIPJahctTYWBLu3IeT+LrtPYoxoTGlbcw5RBwqLvKpqpDGrtcXeGI9jrF o9REK3cZB56kkER8wXJ7VZ38uFG0EblqiTRj4q6CQ55WPWIzp3gc2KeMaHcrOAJqAWin E93iINt3+sFzneWuRBDd7i+CwbRQ+ytR5c2aKx7FRQ2QmWfUDlYbwcFBX4MwFkag++lr FS9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=cRVGT7W3LSRRhDk/rlNVm/PGeYNXtUFpf2OpNSP8aCM=; b=ofAlFrue4RQt8xw2tXDRDpUOAjbeEgrk3AYkTRTGTKJu2E9vk1dZ2XeZZr8pT0coaK b5WgMmh/JwG0fsN14oZ8k75ffxwZE2Ui1X2gFfsAiUTHYSkWLgvn7Po889os7o0jt16I 61o6E2gfKE+lLVlx/GkX63fmgb+ImghofyGeYSVu6iGfVPFqVVZUMd4Kx1vtU7PAvwjE u08h+lseRwY97dnoh6jsm8mggT0UnpyJLKQ+/G26cEZfqxe7ypr4Qo5vHebtknMR8PdL JqIEi1nTDBqOegjFKMbcnLSociLgUvBGR0hnwp5+jraybidkOvVoOUl5IXowWc1Ra/G5 ywyQ== X-Gm-Message-State: AGi0PubRKzUb9Rk/Kzy+7UgO2ijSx1Db3XbwW6bHFcuyYw3nh/KaBTq8 58ZL3ZWGHfb5Ez5Ek7CvM0Jvgw== X-Received: by 2002:a17:902:207:: with SMTP id 7mr823113plc.216.1585793981023; Wed, 01 Apr 2020 19:19:41 -0700 (PDT) Received: from [192.168.10.160] (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id b189sm2543041pfa.209.2020.04.01.19.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2020 19:19:40 -0700 (PDT) From: Andreas Dilger Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_3DA047BA-35EF-48C4-A8AB-ACB70041D364"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH 1/4] tune2fs: prevent changing UUID of fs with stable_inodes feature Date: Wed, 1 Apr 2020 20:19:38 -0600 In-Reply-To: <20200401203239.163679-2-ebiggers@kernel.org> Cc: linux-ext4 , linux-fscrypt@vger.kernel.org To: Eric Biggers References: <20200401203239.163679-1-ebiggers@kernel.org> <20200401203239.163679-2-ebiggers@kernel.org> X-Mailer: Apple Mail (2.3273) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org --Apple-Mail=_3DA047BA-35EF-48C4-A8AB-ACB70041D364 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 1, 2020, at 2:32 PM, Eric Biggers wrote: >=20 > From: Eric Biggers >=20 > The stable_inodes feature is intended to indicate that it's safe to = use > IV_INO_LBLK_64 encryption policies, where the encryption depends on = the > inode numbers and thus filesystem shrinking is not allowed. However > since inode numbers are not unique across filesystems, the encryption > also depends on the filesystem UUID, and I missed that there is a > supported way to change the filesystem UUID (tune2fs -U). >=20 > So, make 'tune2fs -U' report an error if stable_inodes is set. >=20 > We could add a separate stable_uuid feature flag, but it seems = unlikely > it would be useful enough on its own to warrant another flag. What about having tune2fs walk the inode table checking for any inodes = that have this flag, and only refusing to clear the flag if it finds any? = That takes some time on very large filesystems, but since inode table reading = is linear it is reasonable on most filesystems. Cheers, Andreas > Signed-off-by: Eric Biggers > --- > misc/tune2fs.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/misc/tune2fs.c b/misc/tune2fs.c > index 314cc0d0..ca06c98b 100644 > --- a/misc/tune2fs.c > +++ b/misc/tune2fs.c > @@ -3236,6 +3236,13 @@ _("Warning: The journal is dirty. You may wish = to replay the journal like:\n\n" > char buf[SUPERBLOCK_SIZE] __attribute__ ((aligned(8))); > __u8 old_uuid[UUID_SIZE]; >=20 > + if (ext2fs_has_feature_stable_inodes(fs->super)) { > + fputs(_("Cannot change the UUID of this = filesystem " > + "because it has the stable_inodes = feature " > + "flag.\n"), stderr); > + exit(1); > + } > + > if (!ext2fs_has_feature_csum_seed(fs->super) && > (ext2fs_has_feature_metadata_csum(fs->super) || > ext2fs_has_feature_ea_inode(fs->super))) { > -- > 2.26.0.rc2.310.g2932bb562d-goog >=20 Cheers, Andreas --Apple-Mail=_3DA047BA-35EF-48C4-A8AB-ACB70041D364 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl6FS7oACgkQcqXauRfM H+DmSQ//TkmQb/2AkeInHenVL/Fxhl2Asosr4hz+uikYf5nJMtaE5ovIX/IaAp5m isDr3MqEy5+5LYkYhzq6l9HXrdP347zIJLXOocsTMCos9s27O4cso+vhcGm7g1yU iJoVtTh9Lzbz0WOsuSeUHwJbKs/zc2Fuys67Iox5ZwggeiMosFDd4ntqQOo/t3fp XswmzQGNpz4594wPSeV4wui3X/wIqb/Xja4/c2lTHl+Ixa8JLLKSobDqQnKX1ffv mfGkujXnlIMgZsoqWFEfgWYVS8MbMIG4K+SWe0oEFgfoXQuLSBb+8OiqKLrlhoUE mpxqNS8AaYm6PhMpm+vSexkaO+uk+PG1iwSqNjbkrcKHOqtfFoK9IIna+InzLV0p g6Ja/CD7Kn+B1eFS1olqjuvnoeHHZRwjwfl48A7RskGo3OKWLpP9wsdYFLiD6q3Y S4Pp4qY8azI4zaRSgO0QguPcoLRLc+alor83+O7/ZKWE2RfgNOGxrSvfYWyrDRQU y8svRLmchmCEgBzecLCzS6OTXicgXweWDUFpHf/CdI/4fYko3y3ueVdTTFDD9BHJ QrWnWTuJo2KEd55Ol7gl0s1SGo6emotjPq+NMQQMuEWuwPwtD0FOQ8zC2cSOxQ2J r3c2p6GoAlGqg6jgD+OGTnla4X6OYkkGdWolM943eW7CPfswscY= =oBpG -----END PGP SIGNATURE----- --Apple-Mail=_3DA047BA-35EF-48C4-A8AB-ACB70041D364--