On Thu, Jul 20, 2017 at 09:45:55PM +0900, YASUOKA Masahiko wrote:
> On Tue, 18 Jul 2017 15:48:48 -0600
> "Theo de Raadt" <dera...@openbsd.org> wrote:
> >> On Tue, Jul 18, 2017 at 08:40:53PM +0200, Theo Buehler wrote:
> >> > On Tue, Jul 18, 2017 at 11:10:00AM -0600, Theo de Raadt wrote:
> >> > > Possibly.
> >> > > 
> >> > > cc'ing yasuoka who helped me with this method of disk probing.
> >> > > 
> >> > > But anyways, beyond a code review we need someone to SHOW THEIR BOOT 
> >> > > LOADER
> >> > > OUTPUT, so that we can see the hibernate marker letter is missing.
> >> > 
> >> > Using FDE from MBR on my T420, I can confirm Natasha's findings.
> >> > 
> >> > Automatic kernel selection to unhibernate fails, but manually selecting
> >> > /bsd.booted works fine.
> >> > 
> >> > I see the exact same thing on reboot and on boot into unhibernate:
> >> > (manually transcribed, no & sign)
> >> > 
> >> > Using drive 0, partition 3.
> >> > Loading......
> >> > probing: pc0 mem[630K 511M 510M 2471M 486M a20=on]
> >> > disk: hd0+ sr0*
> >> > >> OpenBSD/amd64 BOOT 3.33
> >> > Passphrase: _
> >> 
> >> To compare, here my output on suspended boot for a laptop (i386)
> >> *without* FDE:
> >> 
> >> Using drive 0, partition 3.
> >> Loading......
> >> probing: pc0 pci mem[636K 2037M a20=on]
> >> disk: hd0+&
> >> >> OpenBSD/i386 BOOT 3.31
> >> unhibernate detected: switching to /bsd.booted
> >> boot> 
> >> booting hd0a:/bsd.booted: 8122376+....
> >> entry point at 0x2000d4
> >> ...
> >> 
> >> So here the & is present, and an explicit line is echoed.
> > 
> > I'll explain what is going on here, and what needs to probably be done.
> > 
> > The changes introduced into the bootloader are largely correct.  They
> > make the right decisions.  They just don't make them at the right
> > points in time.  The IO operations should be moved further forward, to
> > after the key operations.
> > 
> > Havinge done it this way, yasuoka and I were able to create a workable
> > model, but the operations need to be moved forward.
> > 
> > Someone want to dive in?
> 
> The diff is to support selecting bsd.booted for FED.
> 
>   disk: hd0 sr0*
>   >> OpenBSD/amd64 BOOTX64 3.33
>   Passphrase:                     <--- Enter the passphrase
>   unhibernate detected: switching to /bsd.booted
>   boot>
>   booting sr0a:/bsd.booted: xxxx...
> 
> we can't add "&" sign on the "disk" line.  Since the bootloader gets
> the passpharase after that line.
> 
> The boot codes other than BOOTX64.EFI are not tested yet.

I tried to pxeboot into bsd.rd to install a snapshot with your diff
(with FDE on MBR) and this leads to a hang after password entry.
Therefore I didn't dare to install the bootloader, as I need this
machine for work.

More precisely, it looks like check_hibernate() doesn't return on a
normally rebooted machine:

probing: pc0 pxe![2.1] mem[630K 511M 518M 2471M 486M a20=on]
disk: hd0+ sr0*
net: mac aa:bb:cc:dd:ee:ff, ip 192.168.10.11, server 192.168.10.10
>> OpenBSD/amd64 PXEBOOT 3.28
Passphrase:
start check_hibernate()
_


and the machine hangs here.

I used the following simple modification of your diff:

Index: libsa/biosdev.c
===================================================================
RCS file: /var/cvs/src/sys/arch/amd64/stand/libsa/biosdev.c,v
retrieving revision 1.30
diff -u -p -r1.30 biosdev.c
--- libsa/biosdev.c     18 Sep 2016 15:13:10 -0000      1.30
+++ libsa/biosdev.c     20 Jul 2017 17:21:05 -0000
@@ -548,6 +548,9 @@ biosopen(struct open_file *f, ...)
                        if (sr_getdisklabel(bv, &dip->disklabel))
                                return ERDLAB;
                        dip->bios_info.flags &= ~BDI_BADLABEL;
+                       printf("start check_hibernate()\n");
+                       check_hibernate(dip);
+                       printf("stop check_hibernate()\n");
                }
 
                bv->sbv_part = part + 'a';

Reply via email to