Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p7uM7-0001nY-2K for mharc-grub-devel@gnu.org; Wed, 21 Dec 2022 03:21:39 -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 1p7uM2-0001mL-2G for grub-devel@gnu.org; Wed, 21 Dec 2022 03:21:35 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7uLz-00021q-Rg for grub-devel@gnu.org; Wed, 21 Dec 2022 03:21:33 -0500 Received: by mail-pl1-x630.google.com with SMTP id n4so14846197plp.1 for ; Wed, 21 Dec 2022 00:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:cc:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tWXEceF9zL/cauzCA5VZcHVj28JpipXdaWXRIDqm0b8=; b=eLGquccRypjyEnzv/Mt7jCiMFUyf5EKlI7d8m8hbt5rrH+g7g/HddcbHFAcKudARnX Jy9aTEsczKaZ626MsZHUwgcac9q4sndE0SiP8o0tYH36L9MFXCgCPA1TIJET+Ut5/9Z+ mLNDCXDhcYa12MzlU/fFpBMMFQosfyKo+x0zw0prmKmeYlBc37UAQTlPHdFphDlNmKG0 17lDFhd1TmBY04p+LAewKE3bvE7dN36OFgCwgJp7KjQ9o0YB4kpbje6RCTaWrJVPtY8v aEIduL1g0GxeJskY5vLBIYHN8y3aoKopl4ZyJ1xNpoEulDmZgk3AHMB8nyds/CUGm22A 1+ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:cc: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=tWXEceF9zL/cauzCA5VZcHVj28JpipXdaWXRIDqm0b8=; b=zhcoL0TQeFxxGxYQBbxTdlvnwmyKHawhGrgyFZEpFECPf/RR5Pcy2uwD6ELm8rOSJO swUTjxzI8ZYe9CsXBmCSiYqJowzbTYpRDV+5lIhRusOb/WT+Cca4fAhgulWBcq33vD16 9Cq7pg/UjHq5WXwE7uL/WKOeoe16jkreS6DsFD7axxiMsBNFAbM5EcVIEOqqFjBe4BOx mTIaJd5gvKWM+rgZf6RMKsDF4paIaIsZmGe/NmNEkFc7owRxlrYos1pHCvCK3BhUgdRl lBbSWICI9BV1uQRMQslVyaIEvvKKZQ/RPfVtgd1Uthr1ekIXIh8gxp3COQjwkJEV8+ZI /Hkg== X-Gm-Message-State: AFqh2kp3ylhBkEHVoZOKKXpvncUdsn/F27sLsURK3OS4YoQNTkzpjhXT OJT8fgM61+BZqhIyl7wbKSs= X-Google-Smtp-Source: AMrXdXshaRbhQ3aQIFTEgPoLBOYIrHKlswGkUfMvYuBPY4tRmxZ8dk7Rn7MluQGRGeuSU/DhHkJgkw== X-Received: by 2002:a17:902:6acb:b0:189:cdcc:5055 with SMTP id i11-20020a1709026acb00b00189cdcc5055mr1275105plt.0.1671610890189; Wed, 21 Dec 2022 00:21:30 -0800 (PST) Received: from [0.0.0.0] (ec2-13-113-80-70.ap-northeast-1.compute.amazonaws.com. [13.113.80.70]) by smtp.gmail.com with ESMTPSA id b4-20020a170902650400b00178b9c997e5sm10738143plk.138.2022.12.21.00.21.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 00:21:29 -0800 (PST) Message-ID: <8490b57e-87e6-58ce-4d7a-c99ebf899b84@gmail.com> Date: Wed, 21 Dec 2022 16:21:25 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [RFC PATCH] kern/dl: Add module version check Content-Language: en-US To: Pete Batard References: <20221219153329.154238-1-zhangboyang.id@gmail.com> <9007a770-9725-a7fe-ebee-de171fc85d72@akeo.ie> From: Zhang Boyang Cc: The development of GNU GRUB , Robbie Harwood , Glenn Washburn , Daniel Kiper In-Reply-To: <9007a770-9725-a7fe-ebee-de171fc85d72@akeo.ie> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=zhangboyang.id@gmail.com; helo=mail-pl1-x630.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, FREEMAIL_FROM=0.001, 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 08:21:35 -0000 Hi, On 2022/12/21 10:43, Pete Batard via Grub-devel wrote: > 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. > The situation is, for BIOS boot, there is no grub core file in ISO because it's written to sectors instead of files? Did I understand correctly? > 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. > Please see my reply to Glenn for a real example of mismatched modules crashes GRUB ( https://lists.gnu.org/archive/html/grub-devel/2022-12/msg00229.html ). I strongly recommend test whether that commit (052e6068be62) breaks Rufus (e.g. Rufus with latest git GRUB, to boot Debian ISO). > 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"). > This patch lives in core, so even it's enforced (I will not enforce this check in next patch reversion, see below), Rufus can still ship its own unpatched version of grub core and thing will still work. > 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... > Will overwriting .mod files in USB drive with Rufus's build helps? > 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. > The main propose is to implement external modules for UEFI secure boot and it's not related to BIOS boot though. Please see my replies to Glenn & Robbie for details. > 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. > I will make next reversion emit a warning but still load such module if grub is not in lockdown mode (e.g. UEFI secure boot enabled). Would you mind a ugly warning will be displayed if mismatched module is loaded? Best Regards, Zhang Boyang > 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 > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel