Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nsMjP-00022h-V2 for mharc-grub-devel@gnu.org; Sat, 21 May 2022 06:53:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsMjO-00022W-2O for grub-devel@gnu.org; Sat, 21 May 2022 06:53:10 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:43760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nsMjM-00066Q-2o for grub-devel@gnu.org; Sat, 21 May 2022 06:53:09 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E11231F898; Sat, 21 May 2022 10:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1653130384; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ejF8xo5QfgMeg9cEW2xntevdZtKVWDaC9bQrJtcOaWg=; b=Mb5jkzRrxmyEMwH+WtzjHe/eCZekl0OmmJAUo6jCXoVx31Y/cANj79kYhVSThyYxz9Yx8R dIe5tE4aJlmK6FHpxdZJMqgxNwEcZBffe5uw6nlkwll/dfg/mBrFO1CSRd1n60tttRCoD0 QWX0F9rZAq+nqtpiAj/k2IX74RwLCZ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1653130384; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ejF8xo5QfgMeg9cEW2xntevdZtKVWDaC9bQrJtcOaWg=; b=2NgWXGUjXAbBPZfcDx19luNxuYq0gZ+CL+UVx7MbpTJta5kEy6Tdb3P2S7AaXDpmInpakw rg7KnMsER0Kf0yDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A6F6B13A8B; Sat, 21 May 2022 10:53:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qpTxJpDEiGLcaAAAMHmgww (envelope-from ); Sat, 21 May 2022 10:53:04 +0000 From: Fabian Vogt To: Josselin Poiret via Grub-devel , Josselin Poiret , development@efficientek.com Cc: Patrick Steinhardt , Michael Chang , Pierre-Louis Bonicoli Subject: Re: [PATCH 3/4] luks2: set up dummy sector size during scan Date: Sat, 21 May 2022 12:53:04 +0200 Message-ID: <5598827.DvuYhMxLoT@fabians-envy> In-Reply-To: <20220520191353.2d55b59a@crass-HP-ZBook-15-G2> References: <877da6rf6s.fsf@jpoiret.xyz> <20220520191353.2d55b59a@crass-HP-ZBook-15-G2> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=195.135.220.29; envelope-from=fvogt@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 May 2022 10:53:10 -0000 Hi, Am Samstag, 21. Mai 2022, 02:13:53 CEST schrieb Glenn Washburn: > On Mon, 07 Feb 2022 14:15:07 +0100 > Josselin Poiret via Grub-devel wrote: > > > Hi Fabian, > > > > Fabian Vogt writes: > > > > > Did you have a look at my approach? That effectively does the same, but using a > > > single ioctl instead of anything complex with DM directly. > > I skipped this thread because I didn't really care about probing for > LUKS2 (I don't use it). However, things change and now I'm evaluating > the different patch series that implement this. I had missed Fabian's > patch and I'm just now seeing it and this thread. > > Now that I've taken a look at Fabian's patch, I think its the better > way to go for getting the sector size. The reason is that it uses > grub_util_get_fd_size() to get the size and sector size of the cheat > mount device. That function's implementation is platform dependant. So, > for instance, if FreeBSD has a LUKS* implementation that is not > libdevicemapper based, we'll correctly get the number of sectors and > sector size. But yes, its very unlikely that FreeBSD will support LUKS. > However, this same code should allow us to get the correct sector size > for GELI devices also. I don't believe GRUB has GELI probe support, so > ths would make things easier for whoever wants to develop it. The same > goes for future cryptodisk backends. > > > I agree that it's sufficient for sector_size, but we still need the > > cryptodisk algorithm so that grub-install will know which crypto modules > > to include. libdm is actually a helper library around dm-specific > > I'm now thinking that GRUB should use Fabian's patch to get the sector > size and number of sectors and Josselin's method of querying device > mapper to get the other properies. We could have Josselin's patch first > check if log_sector_size is set and if not then try to get it from DM. > However, I think that's overkill and not really useful because > grub_util_get_fd_size() should always give us the correct information, > otherwise we've found a kernel bug. Also, by not having to parse out > the sector size from the dm-crypt params string, we avoid much the > complexity of that code, which has been the source of several bugs in > reviewing a couple iterations of that patch. > > > ioctls, since they are apparently annoying to use, so in the end we're > > still using the same interface :) > > Technically different interface, the code Fabian is using is not using > device mapper related ioctls, they are generic block device ioctls (on > Linux systems). > > > As for the 4 patches, since the actual sector_size is available to us, I > > think using 512 in all cases or adding a specific 0 sector_size is > > something we should avoid. > > I agree. > > Fabian, would you be able to send an updated patch with Patrick's > suggestions in the near future? Sure! I'll be back from vacation after end of May, I hope that still counts. Cheers, Fabian > Glenn