From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755451AbcHAXoe (ORCPT ); Mon, 1 Aug 2016 19:44:34 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:55054 "HELO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754508AbcHAXn4 (ORCPT ); Mon, 1 Aug 2016 19:43:56 -0400 From: "Rafael J. Wysocki" To: Thomas Garnier Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kees Cook , Yinghai Lu , Pavel Machek , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH v1 0/2] x86/power/64: Make KASLR memory randomization compatible with hibernation Date: Tue, 02 Aug 2016 01:48:13 +0200 Message-ID: <6770834.oEI2u9Z85J@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1470071280-78706-1-git-send-email-thgarnie@google.com> References: <1470071280-78706-1-git-send-email-thgarnie@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, August 01, 2016 10:07:58 AM Thomas Garnier wrote: > ***Background: > KASLR memory randomization for x86_64 was added when KASLR did not support hibernation. Now that it does, some changes are needed. > > ***Problems that needed solving: > Hibernation was failing on reboot with a GP fault when CONFIG_RANDOMIZE_MEMORY was enabled. Two issues were identified. > > The original fault was due to a wrong physical address assigned to cr3. The problem was introduced with __PAGE_OFFSET becoming a global variable when randomized. The fix uses a define to use the glbobal or immediate value based on config settings. > > The second isssue was that the temporary page table mapping did not support virtual addresses not aligned on PGD level. KASLR memory randomization will generated a random address aligned on PUD level. The fix correctly calculates the offset on all levels of the temporary page table. > > ***Parts: > - 01/02: Support unaligned addresses (second issue) > - 02/02: Fix __PAGE_OFFSET usage on assembly (first issue) Thanks a lot for taking care of this! Patch [2/2] looks good to me, but I'd to the [1/2] differently (more details will follow). Thanks, Rafael