Hi,

(First sorry for the thread break, I have some problems in receiving
mails actually.)

I dig a bit inside the code of bootloader, and I think it is possible
that the bootloader is unable to see hibernate signature when FDE is in
use.

Taking boot(bootdev) as entrypoint (stand/boot/boot.c +60):

it calls machdep() (arch/amd64/stand/libsa/machdep.c +48)
and call each probe routines.

In the list of probe routines, there is diskprobe()
(arch/amd64/stand/libsa/diskprobe.c +246), which call:

 - hardprobe() (line 122),
 - and only after sr_probe() (line 270)

It is hardprobe() that will call check_hibernate():

  - allocating dip struct
  - running check_hibernate() to set BDI_HIBVALID if HIBERNATE_MAGIC is
    found.

To read the value, it uses dip->strategy() function.

arch/amd64/stand/libsa/diskprobe.c
   491          error = dip->strategy(dip, F_READ, (daddr32_t)sec, sizeof hib, 
&hib, NULL);
   492          if (error == 0 && hib.magic == HIBERNATE_MAGIC) {
   493                  /* Hibernate present */
   494                  dip->bios_info.flags |= BDI_HIBVALID;
   495                  printf("&");
   496          }

the actual code is biosstrategy() (arch/amd64/stand/libsa/biosdev.c +722)
which will call sr_strategy() if dip->sr_vol is not NULL.

arch/amd64/stand/libsa/biosdev.c
   721          /* Intercept strategy for softraid volumes. */
   722          if (dip->sr_vol)
   723                  return sr_strategy(dip->sr_vol, rw, blk, size, buf, 
rsize);


If I correctly understood the code, dip->sr_vol is initialized on first
biosopen() call. But at this point, we didn't call it. Additionally,
sr_probe() isn't called either.

So dip->strategy() will read the encrypted data and not decrypted one,
so it is unable to found HIBERNATE_MAGIC (as it is encrypted).

Thanks.
-- 
Sebastien Marie

Reply via email to