On Wed, Aug 31, 2016 at 1:43 PM, Pavel Machek <pa...@ucw.cz> wrote: > On Wed 2016-08-31 13:07:31, Pavel Machek wrote: >> On Wed 2016-08-31 02:27:53, Rafael J. Wysocki wrote: >> > On Monday, August 29, 2016 12:35:40 AM Chen Yu wrote:
[cut] >> > > >> > > +#define MD5_DIGEST_SIZE 16 >> > > + >> > > struct restore_data_record { >> > > unsigned long jump_address; >> > > unsigned long jump_address_phys; >> > > unsigned long cr3; >> > > unsigned long magic; >> > > + u8 e820_digest[MD5_DIGEST_SIZE]; >> > > }; >> > > >> > > #define RESTORE_MAGIC 0x123456789ABCDEF0UL >> > >> > You're changing the image header format, so RESTORE_MAGIC needs to be >> > updated >> > too. >> >> With !CONFIG_HIBERNATION_CHECK_E820, magic nothing changes in on-disk >> format. (Unused space is now used). >> >> If there's hibernation kernel is CONFIG_HIBERNATION_CHECK_E820, and >> restore kernel is !CONFIG_HIBERNATION_CHECK_E820, we won't check the >> E820, and that should be acceptable. >> >> If there's hibernation kernel is !CONFIG_HIBERNATION_CHECK_E820, and >> restore kernel is CONFIG_HIBERNATION_CHECK_E820, we'll fail the E820 >> check, and refuse to resume. That is also acceptable (and similar >> result we'd get with RESTORE_MAGIC).. but the message will be >> confusing. >> >> Ok, so I guess we should change the magic. > > Actually, no, simply changing the magic is not enough. I guess we > should change the magic, and either add "e820_digest_available" field, > or specify that e820_digest == {0,} means that no digest is > available. We should either ignore the digest in > CONFIG_HIBERNATION_CHECK_E820 case if it is not available, or fail > with different message. Something like that. Kernels with the same RESTORE_MAGIC have to use the same header format and interpret all of the fields in it in the same way. Thanks, Rafael