NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-xen/59451: XEN3_DOM0 kernel finds the wrong root device
The following reply was made to PR port-xen/59451; it has been noted by GNATS.
From: Chuck Zmudzinski <frchuckz%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: port-xen/59451: XEN3_DOM0 kernel finds the wrong root device
Date: Sun, 1 Jun 2025 08:02:55 -0400
On 6/1/2025 1:55 AM, Michael van Elst via gnats wrote:
> The following reply was made to PR port-xen/59451; it has been noted by GNATS.
>
> From: mlelstv%serpens.de@localhost (Michael van Elst)
> To: gnats-bugs%netbsd.org@localhost
> Cc:
> Subject: Re: port-xen/59451: XEN3_DOM0 kernel finds the wrong root device
> Date: Sun, 1 Jun 2025 05:52:25 -0000 (UTC)
>
> frchuckz%gmail.com@localhost writes:
>
> >--- sys/arch/xen/xen/xen_machdep.c.orig 2023-10-18 12:53:03.000000000 -0400
> >+++ sys/arch/xen/xen/xen_machdep.c 2025-05-30 20:42:39.936253878 -0400
> >@@ -553,7 +553,10 @@
> > /* XXX check device_cfdata as in x86_autoconf.c? */
> > booted_partition = toupper(
> > xcp.xcp_bootdev[strlen(devname)]) - 'A';
> >+ /* Check that the value of booted_partition is sane */
> >+ if (booted_partition & 0xfffffff0)
> >+ continue;
> > DPRINTF(("%s: booted_partition: %d\n", __func__, booted_partition));
> > }
> > booted_device = dv;
>
>
> The code should check that the partition is between 0 and MAXPARTITIONS-1
> instead of using some bitmask and it shouldn't touch booted_partition
> before the value is validated.
I agree the actual fix should verify booted_partition using MAXPARTITIONS.
And YES I agree that booted_partition should not be touched before it is
validated. Even the current, unpatched code has that problem!
>
> It should also parse xcp_bootdev better (this was bad before and the
> x86 version of that code isn't really better).
YES again!
>
>
> However, nothing of that really helps to use wedges ("dkXX") as
> wedge unit numbers are a bit volatile.
>
>
> The better alternative is to not set "bootdev" but to pass the
> "root" command line option. The value is a string and interpreted
> by the MI part of the kernel as a device name (with partition
> for a disk) or as NAME=wedgename (or for compatiblity wedge:wedgename).
>
> E.g.:
>
> menu=Boot Xen Dom0:load /netbsd_xen console=pc root=NAME=my-root;multiboot /xen.gz
>
>
I think even in this code which is not in the MI part of the kernel the NAME= syntax
for bootdev or rootdev is supported. I did try that but could not get a successful
boot using NAME=wedgename.
Also, according to a message I received on netbsd-users from Manuel who AFAIK is
a port-xen maintainer, there is no difference in the arch/xen code between
bootdev= and rootdev=. What you say here puts that in doubt, though.
Do you want me to try NAME=wedgename again using root= instead of bootdev= ?
Kind regards,
Chuck
Home |
Main Index |
Thread Index |
Old Index