[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/12] x86/boot: convert domain construction to use boot info


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Wed, 6 Nov 2024 20:13:51 -0500
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730942035; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=HqMJazsdIFaJ4mH78mQUuSonJ1WjNlhBuGlyCpIY5k4=; b=VGoE5bvehaWq4sZS0wcCBnUwjjexayKup9PzuMGPCrvSUkrboAy4QBmPObIHj2mQnAcj/Vcx/tKKZSaUZ2Dyt/Fq70msiFNGRHmzb/XxAAdbokRT6q+BGQf9D9CWLJE9Qbua7fLocQTJrTWH8Sf/xHaqCJTmG5hnrQJIa0m12A0=
  • Arc-seal: i=1; a=rsa-sha256; t=1730942035; cv=none; d=zohomail.com; s=zohoarc; b=a2RyTlskiuueu3mMb7uEzxMvbCKqEGZEnaxRAVxrUQMR20DBZsk5dl7dv/9NiuaJXbU8/l+GCFUOZ1MCZZq3jkXK2DyzW6hDtuM2vrpt/L+bIFnpmsWcA8453KZDwOtUQZ1VBbycAIQQsm4fHB1zip9EM/dWr3KetOp+0g5qrwQ=
  • Cc: jason.andryuk@xxxxxxx, christopher.w.clark@xxxxxxxxx, stefano.stabellini@xxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 07 Nov 2024 01:14:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11/6/24 19:43, Andrew Cooper wrote:
On 02/11/2024 5:25 pm, Daniel P. Smith wrote:
@@ -1301,16 +1302,25 @@ static void __hwdom_init pvh_setup_mmcfg(struct domain 
*d)
      }
  }
-int __init dom0_construct_pvh(struct domain *d, const module_t *image,
-                              unsigned long image_headroom,
-                              module_t *initrd,
-                              const char *cmdline)
+int __init dom0_construct_pvh(struct boot_info *bi, struct domain *d)
  {
      paddr_t entry, start_info;
+    struct boot_module *image;
+    struct boot_module *initrd = NULL;
      int rc;
printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id); + rc = first_boot_module_index(bi, BOOTMOD_KERNEL);
+    if ( unlikely(rc < 0 || rc > bi->nr_modules) )
+        panic("Missing kernel boot module for %pd construction\n", d);

Just noticed while experimenting.  The upper bound (for the error case)
should be >= because nothing good can come of being handed the Xen module.

Ack.

+
+    image = &bi->mods[rc];
+
+    rc = first_boot_module_index(bi, BOOTMOD_RAMDISK);
+    if ( rc > 0 || rc < bi->nr_modules )
+        initrd = &bi->mods[rc];

This range check is tautologically true.  You want && instead of ||.

Same elsewhere, although this goes away when the variable is unsigned
(and we remove assumptions about the dom0 kernel's index).

Ack.

v/r,
dps




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.