Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1p0KTG-0006Gi-89 for mharc-grub-devel@gnu.org; Wed, 30 Nov 2022 05:37:42 -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 1p0KTD-0006FR-Ey for grub-devel@gnu.org; Wed, 30 Nov 2022 05:37:40 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0KTB-0003z1-PZ for grub-devel@gnu.org; Wed, 30 Nov 2022 05:37:39 -0500 Received: by mail-pf1-x42e.google.com with SMTP id 140so16440584pfz.6 for ; Wed, 30 Nov 2022 02:37:37 -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=l0ouFuiL/Mt0T8nZBnes9PNwNusGA9VKqiMYhCuAImE=; b=W/tBoWEE4OJWT1zUztYV2FeSDAYL6JrWC+YkYKWz8trwNzPz+r2fUQT8+CSDMhc9z1 iMrDvV+58a44J9uRgt75fzIjS3EGZVtaoKGCf2tqKtSs7OEoJR4Fa/YR7bmXAn8sanTe CeXX4522oOSFSaSLGcZR+WkAfsdburw2Ta1JP1MBNl6swd9rha/7UMeuiKc1fks9ODer X86FXksn7xaZFRQa2DELgElkLgyP0lEKcIGB6Pp76CLiEcMlab9/AT30qcqF06cn76Ma fEp4iNB0j8UhXz9YmAO4W7EEYNxje8iTv6T18UPSjq+1zsAgoobBRkU79vK9lvt0MsOq 3C3w== 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=l0ouFuiL/Mt0T8nZBnes9PNwNusGA9VKqiMYhCuAImE=; b=KyRxiT6ftrkMrjm/92HrspgJI5XaIi+idTPTTdMWUo2coiI9VuYJtcXOaWOKgfRD5U bLjjAfC8TdFpoLGazp/h1EbUw8PJRUhu3+C7MxJ/ApzFU4eVNdOrXfhHzpW7WZ3tQ4Pz EGTfThmgJsx/ZdObnC3Vxnb7fE+dhLXNqxBbuOdWwMq3a5N3C12D+1Mxh8nUHnYYKnxr QVNLU79fbERXPZrcKTlsOZ05t5lxhRQ0KDpQ+tM1cthtoHKgqe9qjQz/kJ4dcoYCoUXX mk3fCOmYQ7gjjlCh3+VWtGekfowIv8n0/sjIhi7j4bQ4MtfKaB4ih9B8oGBwLFEbboDB Qg7Q== X-Gm-Message-State: ANoB5pmGQ0EDkCRKiRJXNTTd9hUi4b7KnSyfFDJdEzbNVL8ibajorx8Z X759kc40FGqBd95p+wYk1DpCDyy9TtY= X-Google-Smtp-Source: AA0mqf5LI/dYSEbscd5I3fvPZTp6gUOYGZD2P7xM1gEf4jLHRe67I5TWLso9lwn3XMOs2cpV76iMkA== X-Received: by 2002:a63:1803:0:b0:477:6e5d:4e25 with SMTP id y3-20020a631803000000b004776e5d4e25mr41719108pgl.70.1669804656328; Wed, 30 Nov 2022 02:37:36 -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 l6-20020a622506000000b005748aca80fesm1109521pfl.32.2022.11.30.02.37.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Nov 2022 02:37:36 -0800 (PST) Message-ID: <51a85758-8d47-6287-7a8e-bc6f82a1f770@gmail.com> Date: Wed, 30 Nov 2022 18:37:32 +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: grub-devel@gnu.org References: <20221129183523.GN3245702@tack.einval.com> From: Zhang Boyang In-Reply-To: <20221129183523.GN3245702@tack.einval.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=zhangboyang.id@gmail.com; helo=mail-pf1-x42e.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.258, 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, 30 Nov 2022 10:37:40 -0000 Hi, On 2022/11/30 02:35, Steve McIntyre wrote: > Hey folks! > > So, with the latest set of GRUB CVE patches we've fixed up a bunch of > potential crashes in font-handling code that could lead to Secure Boot > holes. These are good and useful fixes, and thanks to Zhang Boyang and > everyone else involved! > > There were also a few other changes: > > * In SB mode, refuse to load fonts from outside of the signed GRUB > image > * Restrictions to image dimensions > * Fix integer overflow in fbutil > > Locking down fonts here has caused some issues that I've seen. > > We didn't update the config generation code in util/grub.d, so we're > still generating grub.cfg files that will try (and fail!) to load > fonts from other locations at runtime in SB mode. This causes ugly > errors, and also causes GRUB to fail to set up video as normal. We can > fix this, but it would be nice to agree on something upstream rather > than as diverging distro patches. > > 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. 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. 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. > 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. > Thoughts?? > Best Regards, Zhang Boyang