Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p0exY-0008SJ-AT for mharc-grub-devel@gnu.org; Thu, 01 Dec 2022 03:30:21 -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 1p0exW-0008Rh-2h for grub-devel@gnu.org; Thu, 01 Dec 2022 03:30:18 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0exU-0008WJ-1U for grub-devel@gnu.org; Thu, 01 Dec 2022 03:30:17 -0500 Received: by mail-pl1-x629.google.com with SMTP id k7so969086pll.6 for ; Thu, 01 Dec 2022 00:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=U3EKAonJNF7HQ/3NO4GuKM5+0o1KNqAutBjd6l6cF1c=; b=U5CmH81M6g/i2XIPlJWuxhPZmKP5tsYA0X49ALk3fQrsVdDkYbB27WmqX23Rh/yTDC Zss6REKtLRrVxgUZcDfJUxTEiJIbINIXPXs2IGN3ojxYkNPGIbU0oKTa9e3za5Aa7WG9 TkoTi39tht07xNBmYQVPApU8Nh07NEYrhB8+vGIPJTfFlN6lJSx35Tp+wZFaF/VxyyWw 870RByRz52YzPkz4xHmptDqKuMF7G/QOTc/ntPw6YmNZOnAH2oca+UF1rA11rldXq+Id yvCiGUE3o4PcErU3wVIOhD5/+wrdNBmTYr2WFbs3My57+Wre829rtRx1j8zzeSAGOqxb eF+Q== 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=U3EKAonJNF7HQ/3NO4GuKM5+0o1KNqAutBjd6l6cF1c=; b=Wk4ZbRSGRxWqJRiNLNPvD7ZvW3ieqDX4iVsqDfKXh4KiiQLpnrTGv79W9aziSK505S Gn4IwHjvEVhBBFf41glyDHQt5KU1TTIREdmwGlp3IqhTRYvslGXTzCIWyZV0ayGdFnJs csjiFYdk4PhrM9lTk7WP7VGpYIC3KjXppv5tyEWR4llE7bEMvOx1J9sgJdVu8KWR0lm3 2Bw43sSMD5w6g+dPs1peu4ZESWlyNGrBBBGWIhJNXI2W2adfw3x72tIW4kofaRFjCIXG bulF8chXaWtPmq6KbpAg/pUw4RxrRyDrA/1csQlzapdZSsDNKvTsrRXa+YXMxQcgBTKN juwQ== X-Gm-Message-State: ANoB5plbiHWakK1mWrp8xTAs5blXAgQGOp3Za3b2VM19xtbYw5aCz092 yEySuTgViAk/vAjEpxf7/Z8= X-Google-Smtp-Source: AA0mqf7hNw3/GFI7g1epMYPUQ45eFPeVnMGv5KVhXV1x7Fy+WGDWbLFdzzlFL58EKQg1O8FYQ1GcZg== X-Received: by 2002:a17:902:ead4:b0:189:68ed:6c0d with SMTP id p20-20020a170902ead400b0018968ed6c0dmr29640645pld.140.1669883413944; Thu, 01 Dec 2022 00:30:13 -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 v129-20020a622f87000000b005761c4754e7sm827484pfv.144.2022.12.01.00.30.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Dec 2022 00:30:13 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2022 16:30:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: Fonts and theming and what to do in future with SB Content-Language: en-US To: Robbie Harwood , grub-devel@gnu.org References: <20221129183523.GN3245702@tack.einval.com> <51a85758-8d47-6287-7a8e-bc6f82a1f770@gmail.com> From: Zhang Boyang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=zhangboyang.id@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.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, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.257, 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: Thu, 01 Dec 2022 08:30:18 -0000 Hi, On 2022/12/1 00:08, Robbie Harwood wrote: > Zhang Boyang writes: > >> On 2022/11/30 02:35, Steve McIntyre wrote: >> >>> AFAIK Chris Coulson has a patch for the font loader to cause it to try >>> loading fonts from the embedded memdisk first. Is that the best >>> approach? If so, what fonts should we be embedding in the signed >>> image? It's a tradeoff between size and functionality, of course - >>> some people are happy with just "unicode" while others may want a >>> wider choice for added theming options. Is the size an issue for most >>> people? >> >> Personally I prefer to embed Unifont to GRUB. This can be done by >> memdisk, or embed as code directly (like ASCII chars). For Unifont, this >> will make GRUB about 2.5MB (+150%) fatter. This is sufficient for vast >> majority of GRUB usecases. > > My testing with Chris's patch and approach for unicode.pf2 (in Fedora) > adds just under a megabyte - presumably this is due to benefits from > xz-compressing it, minus overhead to add the modules required for > support to our builds. > > Is your suggestion that we should officially remove support for other > fonts, then? > >> It's also possible to embed only hashes of font files into GRUB >> (although not implemented yet). Therefore, distros can pre-generate a >> series of fonts files and add their hashes to GRUB bundle. End-users >> can choose their font in the pre-defined list from distros. > > As you say, someone would have to implement this first :) And if we were > to go this route, I think we'd want to do the same for background > images. > >> For those who want to use fonts which not in the pre-defined list. The >> last option would be disable secureboot or use MOK to sign their own >> GRUB bundle. > > "Disable secureboot in order to do this" is not a position I ever want > to take. In a forced tradeoff between features and security, some users > will opt for features. (And it's easier to just disable secureboot than > roll out one's own signing, unfortunately.) So my preference is to keep > feature parity between SB and non-SB, even if that means dropping > customizability. > >>> Or... Could/should we look at options to sign fonts separately? I've >>> heard suggestions to embed them into faked-up modules that we could >>> load with insmod, but of course we don't support signing modules yet >>> anyway... :-) >> >> It seems "shim" can process PE files only, so it's hard to implement >> signature checking for other files (modules, fonts, etc.). A tradeoff >> solution is to wrap PF2 font into a PE file, so they can be processed by >> shim. A better solution would be add more functionality to "shim" to >> allow it process more types of files. > > I don't agree with making shim more complicated. > Then I think the best solution would be: wrap font files into PE files. Therefore we can sign font files directly and verify them using "shim", and there is no need to use memdisks or something like that. If I understand correctly, user can also sign their own font files with MOK using existing tools and no special infrastructure need to be introduced. I'm planning to implement a PE unwrapper using `grub_file_filters`. Using it we can wrap even more type of files into PE files, like ELF files. I will send a RFC patch in few days. > Be well, > --Robbie Best Regards, Zhang Boyang