From nobody Tue Feb 10 05:44:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1660245071; cv=none; d=zohomail.com; s=zohoarc; b=FTaUwid1Q1erNw/NK1rFju6GWuvQtAXrkE368G9hzotg6StTUAA3iNrGKalwVbo8+im97tU3HTr+h02Y673ae/yL9TAwa4DLcePgECS+jcMJecrixuBeKwj9iAEyr7tQ6b5GhD/7Xaml9VnDe84gTwryhScdXM2AyZ9OfglPO3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660245071; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; b=QbrxlEeuUkm/96mmkH4y+mLuAknaX8nuZD5NVf+YpYO9pmeu+DF6T5L+khjQUB1uOUm/36pSsU9/lu08KyC6nG2c3CUox3Q/4Q6XlGJZmk3F58QvlEf4ExVlBGwz8/rO0HlB6LtQGQOb3vODVhAB8iWyZub8x7in9Tx3w0l2oa4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1660245071346103.04163810321393; Thu, 11 Aug 2022 12:11:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.385111.620643 (Exim 4.92) (envelope-from ) id 1oMDZf-00048N-51; Thu, 11 Aug 2022 19:10:31 +0000 Received: by outflank-mailman (output) from mailman id 385111.620643; Thu, 11 Aug 2022 19:10:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZf-00048G-2H; Thu, 11 Aug 2022 19:10:31 +0000 Received: by outflank-mailman (input) for mailman id 385111; Thu, 11 Aug 2022 19:10:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oMDZd-0003so-S0 for xen-devel@lists.xenproject.org; Thu, 11 Aug 2022 19:10:29 +0000 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 428ad19f-19a9-11ed-924f-1f966e50362f; Thu, 11 Aug 2022 21:10:27 +0200 (CEST) Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 418093FB95 for ; Thu, 11 Aug 2022 19:10:27 +0000 (UTC) Received: by mail-vs1-f70.google.com with SMTP id 124-20020a670882000000b00388cd45f433so1751644vsi.8 for ; Thu, 11 Aug 2022 12:10:27 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:4e1:83a2:2ee9:2118:a2dc:3dd6]) by smtp.gmail.com with ESMTPSA id g7-20020a67ea07000000b00384b60a5160sm120094vso.12.2022.08.11.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 12:10:25 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 428ad19f-19a9-11ed-924f-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660245027; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JvfFDGvxb4Ky1UyLUiF1YIdF6mYNxCfwhk09hK6SY0yqMo+lOG0wljB0qxkLwTbCr kN5pKEOKE7+SX6uV8DBhdG9NHglkuaA2DbrJz+xvo7c/3Fc4NQKyvJRpsdo3zPj0HB wkG4yuiAg9c7FIbasgkYcycoIa2ZNQ8R2ftotSkAsetEQHqWBMRL7vDUhTvqXu1Uqc KZisrNZtloq1YoHnwOT3ugj91M43/isBjwETWksWupBWqUzCZd0V9cUF7rx/D7Eael +gGAVMSlKbDp2BIWdLS0EtyTh/GEj525rOvo9hJWysEmM7DSnmfoWbjlwlqsdia4F9 T/5S41C+PmIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=hUhj4xVWV7i7kcWOSw9PKIOewcy2KLy7hUSFmlSeALs=; b=jKCPbq3j42olQQl1h+ZtjyPXp3hGhzpBkDDuTx6Dxg19YgL6lW66s7yHUvg9FV/cUK Fh8wpt5OXb5br6cWD1iyLCxxATCKl83cfi3o3a5aLlTme9z8AMj02xdQ+kgAcm5qI6UR aAXL9wueLrx98qGHx0cNeM3XL8SAtxnWcLC+eWXnMqEyhbrE/Mzm2oVTb9sgil4M5JHK 2dpSUUzSJkGnxc+h531ZZNyGxrU3XRV2yafDRm7zoNqRiaV0nIRCiWUbMPV64TA1RTUf s+TYYIzgmZRtBMJUOuTR0sM41qK6Pa8l4z9eELLU5xquyh++P5LQlXcmjTTAWzKFA5et az4A== X-Gm-Message-State: ACgBeo2Rwr3DbQ/3PTZ9oJ3YKg7T50PWeumlJ8lsIBjtpt2kf7lJKM8u z23LkvoVUEnz5ptLn92rjrhUbssE7VV9zAwAOaBxoO2+iVLvSAnvsiypa7Cj+SjXDxf39u6NX0l v9PrNp9W8jSZbrar/LPVldO7MYfYa+pf2pwfeqXq1K6iB X-Received: by 2002:a05:6102:35c:b0:381:5d05:4eed with SMTP id e28-20020a056102035c00b003815d054eedmr291718vsa.74.1660245026117; Thu, 11 Aug 2022 12:10:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fIp/rY8D97jEgLS//TfrCICxkbup/p/NhqJDS1P8SHF2f6jQwj5g6tmRAkZjERWUPn7iSzQ== X-Received: by 2002:a05:6102:35c:b0:381:5d05:4eed with SMTP id e28-20020a056102035c00b003815d054eedmr291705vsa.74.1660245025851; Thu, 11 Aug 2022 12:10:25 -0700 (PDT) From: Mauricio Faria de Oliveira To: xen-devel@lists.xenproject.org, grub-devel@gnu.org Cc: Daniel Kiper , =?UTF-8?q?Peter=20Gro=C3=9Fe?= Subject: [PATCH 1/2] templates/linux_xen: Properly load multiple initrd files Date: Thu, 11 Aug 2022 16:10:13 -0300 Message-Id: <20220811191014.139882-2-mfo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811191014.139882-1-mfo@canonical.com> References: <20220811191014.139882-1-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @canonical.com) X-ZM-MESSAGEID: 1660245073224100001 The linux_xen template can put multiple initrd files in the same multiboot[2] module[2] command, which is against specs. This causes ONLY the _first_ initrd file to be loaded; other files just have filenames in a "cmdline" string of the first initrd file and are NOT loaded. Fix this by inserting a module[2] command per initrd file. Before: # touch /boot/xen /boot/microcode.cpio # grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' multiboot /boot/xen ... module /boot/vmlinuz-5.4.0-122-generic ... module --nounzip /boot/microcode.cpio /boot/initrd.img-5.4.0= -122-generic After: # touch /boot/xen /boot/microcode.cpio # grub-mkconfig 2>/dev/null | grep -P '^\t(multiboot|module)' multiboot /boot/xen ... module /boot/vmlinuz-5.4.0-122-generic ... module --nounzip /boot/microcode.cpio module --nounzip /boot/initrd.img-5.4.0-122-generic Cause: The code was copied from the linux template, which is *apparently* equivalent.. but its initrd command grub_cmd_initrd() *supports* multiple files (see grub_initrd_init()), while module/module2 in grub_cmd_module() *does not* (see grub_multiboot[2]_add_module()). See commit e86f6aafb8de ("grub-mkconfig/20_linux_xen: Support multiple earl= y initrd images"): 'This is basically a copy of a698240d "grub-mkconfig/10_linux: Support multiple early initrd images" ...' Specs: Both multiboot and multiboot2 specifications mention support for 'multiple boot modules' (struct/tag used for kernel/initrd files): "Boot loaders don=E2=80=99t have to support multiple boot modules, but they are strongly encouraged to" [1,2] However, there is a 1:1 relationship between boot modules and files, more or less clearly; note the usage of singular/plural "module(s)". (Multiboot2, clearly: "One tag appears per module".) Multiboot [1]: "the =E2=80=98mods=E2=80=99 fields indicate ... what boot modules were loaded ..., and where they can be found. =E2=80=98mods_count=E2=80=99 contains the number of modules loaded" "The first two fields contain the start and end addresses of the boot module itself." Multiboot2 [2]: "This tag indicates ... what boot module was loaded ..., and where it can be found." "The =E2=80=98mod_start=E2=80=99 and =E2=80=98mod_end=E2=80=99 contain = the start and end physical addresses of the boot module itself." "One tag appears per module. This tag type may appear multiple times." And both clearly mention the 'string' field of a boot module, which is to be used by the operating system, not boot loader: "The =E2=80=98string=E2=80=99 field provides an arbitrary string to be associated with that particular boot module ... its exact use is specific to the operating system." Links: [1] https://www.gnu.org/software/grub/manual/multiboot/multiboot.html 3.3 Boot information format [2] https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html 3.6.6 Modules Fixes: e86f6aafb8de ("grub-mkconfig/20_linux_xen: Support multiple early in= itrd images") Signed-off-by: Mauricio Faria de Oliveira --- util/grub.d/20_linux_xen.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 4382303c17f0..50c62562b730 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -162,12 +162,12 @@ EOF message=3D"$(gettext_printf "Loading initial ramdisk ...")" initrd_path=3D for i in ${initrd}; do - initrd_path=3D"${initrd_path} ${rel_dirname}/${i}" - done - sed "s/^/$submenu_indentation/" << EOF + initrd_path=3D"${rel_dirname}/${i}" + sed "s/^/$submenu_indentation/" << EOF echo '$(echo "$message" | grub_quote)' ${module_loader} --nounzip $(echo $initrd_path) EOF + done fi if test -n "${xenpolicy}" ; then message=3D"$(gettext_printf "Loading XSM policy ...")" --=20 2.34.1