The hibernate check does:

bootdev_has_hibernate(void)
{
        return ((bootdev_dip->bios_info.flags & BDI_HIBVALID)? 1 : 0);


Someone could have a boot.conf that changes their default disk because
they want to boot from a non-standard disk.  Hibernate store will occur
to swap on the non-standard disk.  They want to resume from that same
non-standard disk.  I have not tested this configuration, but it is
plausible.

However by checking for BDI_HIBVALID against the wrong disk, the hibernate
will fail for them.

So you've fixed something you don't like, and broken a different
configuration.



Theo de Raadt <[email protected]> wrote:

> that is a demo.
> 
> It breaks hibernate.  Lots of things in boot.conf could break hibernate.
> Why is that so surprising?  You haven't explained why you need to use
> boot.conf
> 
> But furthermore, you want to skip boot.conf parsing entirely, in the
> hibernate case.  I believe you have ignored the potential consequences
> of that upon others.
> 
> [email protected] wrote:
> 
> > My justification is documented in the boot.conf manual:
> > 
> >      Remove the 5 second pause at boot-time permanently, causing
> >      boot to load the kernel immediately without prompting:
> > 
> >            # echo "boot" > /etc/boot.conf
> > 
> > Is the proposed behavior incorrect?
> > 
> > > Disagree.
> > > 
> > > There is no justification for what you have in /etc/boot.conf
> > > 
> > > [email protected] wrote:
> > > 
> > > > Hello tech@,
> > > > 
> > > > Currently unhibernating doesn't work with this configuration:
> > > > 
> > > > # echo "boot" > /etc/boot.conf
> > > > 
> > > > The original kernel is booted instead of the hibernated one.
> > > > This was fixed a few years ago for sysupgrade's /bsd.upgrade kernel but
> > > > unhibernation was overlooked at the time.
> > > > 
> > > > Before:
> > > > 
> > > >         unhibernate detected: switching to /bsd.booted
> > > >         booting sr0a:/bsd:...
> > > > 
> > > > After:
> > > > 
> > > >         unhibernate detected: switching to /bsd.booted
> > > >         booting sr0a:/bsd.booted:...
> > > > 
> > > > Index: boot.c
> > > > ===================================================================
> > > > RCS file: /cvs/src/sys/stand/boot/boot.c,v
> > > > retrieving revision 1.54
> > > > diff -u -p -r1.54 boot.c
> > > > --- boot.c      15 Jun 2020 14:43:57 -0000      1.54
> > > > +++ boot.c      8 Sep 2021 14:45:09 -0000
> > > > @@ -84,8 +84,6 @@ boot(dev_t bootdev)
> > > >                 isupgrade = 1;
> > > >         }
> > > >  
> > > > -       st = read_conf();
> > > > -
> > > >  #ifdef HIBERNATE
> > > >         int bootdev_has_hibernate(void);
> > > >  
> > > > @@ -94,6 +92,8 @@ boot(dev_t bootdev)
> > > >                 printf("unhibernate detected: switching to %s\n", 
> > > > cmd.image);
> > > >         }
> > > >  #endif
> > > > +
> > > > +       st = read_conf();
> > > >  
> > > >         if (!bootprompt)
> > > >                 snprintf(cmd.path, sizeof cmd.path, "%s:%s",
> > > >
> > 
> 

Reply via email to