From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.server123.net (mail.server123.net [78.46.64.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6E26C433EF for ; Tue, 25 Jan 2022 12:31:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at saout.de Received-SPF: None (mailfrom) identity=mailfrom; client-ip=84.19.178.47; helo=v1.tansi.org; envelope-from=arno@wagner.name; receiver= X-Greylist: delayed 463 seconds by postgrey-1.37 at siona; Tue, 25 Jan 2022 13:28:46 CET Received: from v1.tansi.org (mail.tansi.org [84.19.178.47]) by mail.server123.net (Postfix) with ESMTP for ; Tue, 25 Jan 2022 13:28:46 +0100 (CET) Received: from gatewagner.dyndns.org (81-6-44-245.init7.net [81.6.44.245]) by v1.tansi.org (Postfix) with ESMTPA id E5B6A140131 for ; Tue, 25 Jan 2022 13:20:50 +0100 (CET) Received: by gatewagner.dyndns.org (Postfix, from userid 1000) id 37EBB17A456; Tue, 25 Jan 2022 13:20:56 +0100 (CET) Date: Tue, 25 Jan 2022 13:20:56 +0100 From: Arno Wagner To: dm-crypt@saout.de Message-ID: <20220125122055.GA29580@tansi.org> Mail-Followup-To: dm-crypt@saout.de MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Message-ID-Hash: QM7KGZORZ6F3CQDEHZ2D6YBFJAEVZAIC X-Message-ID-Hash: QM7KGZORZ6F3CQDEHZ2D6YBFJAEVZAIC X-MailFrom: arno@wagner.name X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-dm-crypt.saout.de-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.2 Precedence: list Subject: [dm-crypt] Re: misaligned ending sector, 4096-byte luks sector size can't be used List-Id: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Mon, Jan 24, 2022 at 23:10:34 CET, Milan Broz wrote: > On 24/01/2022 18:07, Chris Murphy wrote: [...] > The whole idea of misaligned backup GPT at the end of device is broken. > We should not follow that with adding hacks when the easy solution > is just to align a partition properly. I fully agree to that. It is like having a virtual sector size and then selectively in some places only not sticking to it. Not smart and a gross KISS violation. And, of course, fundamental problems like this one should always be fixed were they are caused. Heaping hacks and special treatment on top of it just makes the situation a lot worse. Better to live with the problem that making it worse. > Years ago there was a general agreement to align partition start > to 1 MiB offset, I think we should do the same for the partition > length. I fully agree to that. The only downside I see to that is that you create some spaces that some malware could store information in. But you have that anyways in lots of places, so it is not really a downside. For the case of wiping a disk you should wipe the raw device anyways, not just partitions. > > Therefore it seems suboptimal to fall back to 512-byte LUKS > > sector size, or for luksFormat --sector-size 4096 to fail. Is there a > > way for cryptsetup to just map out the dangling 1-7 512-byte sectors > > at the end? They are useless anyway in this case, but the partitioning > > tools aren't in a position to know the use case. The last 1-7 sectors > > are legitimately individually addressable so it's not incorrect for > > the partitioning tool to include them in the last partition on the > > device. > > The default is to not store device length in LUKS header - so it follows > underlying device resize. And that is a really good design. Single source of truth and all that. > If you set sector size to 4k, then the unaligned sectors are no longer > "legitimately" addressable (dm-crypt will set 4k as "physical" sector, > IOW as atomic unit of the device). I understand that some filesystems use > hacks to ignore this, but it is really not a system solution. And it is a solution that likely will create hard to understand and hard to debug problems at some point in the future. Not good. Unfortunately, even the Linux OS community has its share of people that do not really understand why KISS is so fundamental for all good engineering and that do not really consider what happens if some things change in the future and hence write non-resilient stuff or stuff with surprising properties without any real need. In established engineering disciplines, this is called "an accident waiting to happen" and a lot of the engineering education focuses on avoiding those. In CS/IT/SW-Eng almost all teaching is still just on how to make things, not on how to make them well. Regards, Arno -- Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: arno@wagner.name GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718 ---- A good decision is based on knowledge and not on numbers. -- Plato If it's in the news, don't worry about it. The very definition of "news" is "something that hardly ever happens." -- Bruce Schneier _______________________________________________ dm-crypt mailing list -- dm-crypt@saout.de To unsubscribe send an email to dm-crypt-leave@saout.de