From: "H. Peter Anvin" <hpa@zytor.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] PM / Hibernate / x86: Change RESTORE_MAGIC on x86_64
Date: Tue, 28 Sep 2010 16:28:01 -0700 [thread overview]
Message-ID: <4CA27A01.1080606@zytor.com> (raw)
In-Reply-To: <201009290112.11363.rjw@sisk.pl>
On 09/28/2010 04:12 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> On x86_64 the configuration and version of the kernel that
> hibernates and creates a system image may be different from the
> configuration and version of the boot kernel that loads the image.
> So long as both these kernels are built with the same value of
> RESTORE_MAGIC, the image created by one of them should be
> successfully loaded and restored by the other one.
>
> It wasn't necessary to modify RESTORE_MAGIC in the past, but now
> that we are adding compression to the in-kernel hibernate code,
> change the value of RESTORE_MAGIC so that earlier kernels don't
> try to load compressed images they can't handle.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> arch/x86/power/hibernate_64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/power/hibernate_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/power/hibernate_64.c
> +++ linux-2.6/arch/x86/power/hibernate_64.c
> @@ -137,7 +137,7 @@ struct restore_data_record {
> unsigned long magic;
> };
>
> -#define RESTORE_MAGIC 0x0123456789ABCDEFUL
> +#define RESTORE_MAGIC 0x0123456789ABCDF0UL
>
Two issues with this:
a) shouldn't we only set this when the image is actually compressed?
b) using systematic magics like this is pessimal in terms of collision
avoidance. It's much better to use a true random number.
Hence, I propose:
: anacreon 95 ; ranpwd -xc 16
0x4ddedd3236f1e6e1
-hpa
WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Nigel Cunningham <nigel@tuxonice.net>
Subject: Re: [RFC][PATCH] PM / Hibernate / x86: Change RESTORE_MAGIC on x86_64
Date: Tue, 28 Sep 2010 16:28:01 -0700 [thread overview]
Message-ID: <4CA27A01.1080606@zytor.com> (raw)
In-Reply-To: <201009290112.11363.rjw@sisk.pl>
On 09/28/2010 04:12 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
>
> On x86_64 the configuration and version of the kernel that
> hibernates and creates a system image may be different from the
> configuration and version of the boot kernel that loads the image.
> So long as both these kernels are built with the same value of
> RESTORE_MAGIC, the image created by one of them should be
> successfully loaded and restored by the other one.
>
> It wasn't necessary to modify RESTORE_MAGIC in the past, but now
> that we are adding compression to the in-kernel hibernate code,
> change the value of RESTORE_MAGIC so that earlier kernels don't
> try to load compressed images they can't handle.
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> arch/x86/power/hibernate_64.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/power/hibernate_64.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/power/hibernate_64.c
> +++ linux-2.6/arch/x86/power/hibernate_64.c
> @@ -137,7 +137,7 @@ struct restore_data_record {
> unsigned long magic;
> };
>
> -#define RESTORE_MAGIC 0x0123456789ABCDEFUL
> +#define RESTORE_MAGIC 0x0123456789ABCDF0UL
>
Two issues with this:
a) shouldn't we only set this when the image is actually compressed?
b) using systematic magics like this is pessimal in terms of collision
avoidance. It's much better to use a true random number.
Hence, I propose:
: anacreon 95 ; ranpwd -xc 16
0x4ddedd3236f1e6e1
-hpa
next prev parent reply other threads:[~2010-09-28 23:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 23:12 [RFC][PATCH] PM / Hibernate / x86: Change RESTORE_MAGIC on x86_64 Rafael J. Wysocki
2010-09-28 23:28 ` H. Peter Anvin [this message]
2010-09-28 23:28 ` H. Peter Anvin
2010-09-29 10:58 ` Rafael J. Wysocki
2010-09-29 20:05 ` Rafael J. Wysocki
2010-09-29 20:05 ` Rafael J. Wysocki
2010-09-29 10:58 ` Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2010-09-28 23:12 Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CA27A01.1080606@zytor.com \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.