From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754051AbaFMRh6 (ORCPT ); Fri, 13 Jun 2014 13:37:58 -0400 Received: from terminus.zytor.com ([198.137.202.10]:50908 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753488AbaFMRh4 (ORCPT ); Fri, 13 Jun 2014 13:37:56 -0400 Message-ID: <539B36B2.8090701@zytor.com> Date: Fri, 13 Jun 2014 10:36:50 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Kees Cook , Pavel Machek CC: LKML , Randy Dunlap , Thomas Gleixner , Ingo Molnar , "x86@kernel.org" , "Rafael J. Wysocki" , Len Brown , Wei Yongjun , "linux-doc@vger.kernel.org" , linux-pm@vger.kernel.org Subject: Re: [PATCH 0/2] make kASLR vs hibernation boot-time selectable References: <1402602419-27934-1-git-send-email-keescook@chromium.org> <539A0422.9010000@zytor.com> <539A0DC2.1010203@zytor.com> <20140613105135.GA4876@amd.pavel.ucw.cz> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/13/2014 10:32 AM, Kees Cook wrote: >> >> x86-64 can resume from different kernel that did the suspend. kASLR >> should not be too different from that. (You just include kernel text >> in the hibernation image. It is small enough to do that.) > > Oooh, that's very exciting! How does that work (what happens to the > kernel that booted first, etc)? I assume physical memory layout can't > change between hibernation and resume? Or, where should I be reading > code that does this? > "Give me a lever and a place to stand, and I shall move the world." Reshuffling memory in an arbitrary or near-arbitrary way really isn't all that hard. The exact data structures you need depends on if you have any kind of page alignment you can rely on (makes it easier) and how much spare memory you have (in case of hibernation, there is usually tons of unused memory as it doesn't make sense to hibernate clean pages.) -hpa