Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p7p58-0001YY-A5 for mharc-grub-devel@gnu.org; Tue, 20 Dec 2022 21:43:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7p55-0001YH-VH for grub-devel@gnu.org; Tue, 20 Dec 2022 21:43:43 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7p53-0005WD-Fu for grub-devel@gnu.org; Tue, 20 Dec 2022 21:43:43 -0500 Received: by mail-wm1-x32a.google.com with SMTP id o15so10214762wmr.4 for ; Tue, 20 Dec 2022 18:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo.ie; s=google; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LWd7p9gO5xNsxo8zkz+FMlORs89OUL9RTIlDiS27bjw=; b=QlkPJJxGYfJD8mXgGbE3wmE6CNhmRVMSPtqZNrrSOsOc9x1qew0LreMPZ0JxweNckf CJvNPHMnl4Wsm/r/orG7/eIx9RYeBef0ZILFF949UBkkfKsOPbwx0Ug5DdyFQyenrTgZ /fLACX4gOBXU2psO4WWxuQBFR5xmhN1sW/Xdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LWd7p9gO5xNsxo8zkz+FMlORs89OUL9RTIlDiS27bjw=; b=GruFbsZp4idFjD944wd0IkyuaHCrMLQ9e9REXhPK28ATi+C/RlVIhpX7lFohfnICfj 0HHQ5DTcn8nUeyyrSh+46hLMmvoQ64kENU6n+JAJrNgHEOGsmB4ct5aItdJrWRLAFHA8 AR6Wj+ljDTuyWbM3fadyDi8DQUOqTVl4A4Q/gVrFA+xAZkgPhYdtXyukiBj2BsbJNTj1 OxkyXYYXc0fKkHK9dMximbVRo7kGkYY4FoG+8b37KLdiD/f1QnAqD9thAn2wcg65P1vL hyZ4eNpQNpnGJ0K/Q63ia7pdhMP34FwAkgQUBsQfjGfvGLf8yZ+Qcn6pCvWRsjqJ/VQU 5eig== X-Gm-Message-State: AFqh2koCb+MUcwmKgDLkx0SRC76XKm/NoUbL046yzixA9MElZRkyEhEb t8k9Y8d5x6dBRYvwFM5SjHtAuIPju8LssWOa X-Google-Smtp-Source: AMrXdXsPtGauGBRxp0DkwQ4oKMJ6PeGGmsDORq7eHfotcmyYl464IqwmnEWiTw80DUi/UvL+CUfvyA== X-Received: by 2002:a05:600c:4b1d:b0:3d3:3deb:d916 with SMTP id i29-20020a05600c4b1d00b003d33debd916mr356543wmp.4.1671590618877; Tue, 20 Dec 2022 18:43:38 -0800 (PST) Received: from [10.0.0.104] (ip-84-203-43-212.broadband.digiweb.ie. [84.203.43.212]) by smtp.gmail.com with ESMTPSA id l3-20020a1c7903000000b003cf4d99fd2asm583953wme.6.2022.12.20.18.43.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 18:43:38 -0800 (PST) Message-ID: <9007a770-9725-a7fe-ebee-de171fc85d72@akeo.ie> Date: Wed, 21 Dec 2022 02:43:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RFC PATCH] kern/dl: Add module version check Content-Language: en-GB To: grub-devel@gnu.org References: <20221219153329.154238-1-zhangboyang.id@gmail.com> From: Pete Batard In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=pete@akeo.ie; helo=mail-wm1-x32a.google.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 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, NICE_REPLY_A=-1.161, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: Wed, 21 Dec 2022 02:43:44 -0000 Hello all, On 2022.12.20 22:58, Robbie Harwood wrote: > Zhang Boyang writes: > >> This patch add version information to GRUB modules. Specifically, >> PACKAGE_VERSION is embedded as null-terminated string in .modver >> section. This string is checked at module loading time. That module will >> be rejected if mismatch is found. This will prevent loading modules from >> different versions of GRUB. >> >> It should be pointed out that the version string is only consisted of >> PACKAGE_VERSION. Any difference not reflected in PACKAGE_VERSION is not >> noticed by version check (e.g. configure options). > > Right now, this only affects non-secureboot scenarios (because we don't > have external signed module support). I would want to see a resolution > to the external module signing question first so that we don't paint > ourselves into a corner with something like this. > > I share Glenn's confusion about what real-world problems this addresses: > my understanding is that grub modules mostly register callbacks, so the > possibility of disaster is low (unless the callback interfaces change of > course, but that generally has not happened). I'll add a note that integrating this proposal will make life A LOT more difficult for Rufus [1] users (and potentially users of other boot media creation software) when booting in BIOS/CSM mode. The reason is that, unlike what is the case for UEFI, one can not expect to be able to pick all the GRUB core files needed to convert a GRUB based ISO bootable media to a GRUB based USB bootable media when using the kind File System Transposition one needs to apply, in order to avoid end-users, especially Windows ones, being left confused as to why their USB media is not showing the content they expect. Typically, one of the missing files will be a 'core.img' that can work for USB BIOS boot of a MBR partitioned FAT or NTFS media, and that even a GRUB based ISOHybrid image will not readily provide. As a result, whereas it can also write a GRUB base ISOHybrid image in DD mode, Rufus usually recommends to write such images in what it calls "ISO mode" (shorthand for "ISO extraction mode") with the ISO content extracted to a FAT or NTFS file system and with a GRUB core.img bootloader being installed by the application itself rather than being provided by the source image. This core.img, which is usually recompiled from GRUB dot releases to include support for MBR partition scheme, FAT, NTFS and potentially other required elements, then calls into the GRUB modules that were extracted from the ISO image. And whereas, on paper, this may look a recipe for disaster, ~8 years of boot media creation for GRUB 2.x, using this default method of mixing a GRUB core.img that wasn't built alongside the modules it is using, shows the method to actually work quite well, *even* when most distros take it upon themselves to cherry-pick an extra selection of GRUB patches to their source while waiting for the next dot release. However, if this proposal gets applied for BIOS modules, this will break the mechanism described above thereby penalising users who have come to rely on Rufus on account that most distros, and especially the ones that add patches to their GRUB sources, tend to use a distro specific version for GRUB (e.g. "2.06~unbuntu_xyz"). Thus, right at the time where we are finally seeing light at the end of the tunnel for UEFI, with regards to the root of the problem we are trying to address (about Windows users thinking their boot media is not created properly when using DD mode, and therefore not even trying to boot to Linux -- this is a VERY REAL issue for which I have provided a large number of examples already), by ensuring that GRUB will properly support File System Transposition for UEFI moving forward (with my thanks to Daniel for having reviewed the respective patch series just today!) this proposal is now planning to undo the whole File System Transposition support *equivalent* we spent a lot of time trying to find a workaround for, for BIOS... I therefore have to second asking what kind of real-world problems this is meant to address, especially as I can vouch that, if GRUB goes through with this proposal for BIOS, this will most certainly result in real-world problems for users trying to create GRUB based BIOS bootable media on Windows. One thing I will point out however is that I have no issue with the module version check proposal if it is to be restricted to UEFI boot only (or with any other means to validate the UEFI trust/compatibility chain), as the underlying problem of not being able to find all the GRUB data we need for File System Transposition only applies to BIOS boot. Regards, /Pete [1] https://github.com/pbatard/rufus > The combination of those two things leads me to suspect this is not the > right approach. It seems likely that if we want to down the road of > versionlocking, something like the kernel's ephemeral key approach would > be better suited - and if we want external modules (which I don't think > we do), full SBAT support. > > Be well, > --Robbie > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel