From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219AbcHIJYy (ORCPT ); Tue, 9 Aug 2016 05:24:54 -0400 Received: from twin.jikos.cz ([89.185.236.188]:46326 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbcHIJYw (ORCPT ); Tue, 9 Aug 2016 05:24:52 -0400 Date: Tue, 9 Aug 2016 11:23:07 +0200 (CEST) From: Jiri Kosina X-X-Sender: jikos@twin.jikos.cz To: "Rafael J. Wysocki" cc: Linux PM list , Thomas Garnier , the arch/x86 maintainers , Linux Kernel Mailing List , Yinghai Lu , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kees Cook , Pavel Machek , Kernel Hardening , Borislav Petkov Subject: Re: [Resend][PATCH] x86/power/64: Always create temporary identity mapping correctly In-Reply-To: <2206547.eDj3RJQyE5@vostro.rjw.lan> Message-ID: References: <2206547.eDj3RJQyE5@vostro.rjw.lan> User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Aug 2016, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > The low-level resume-from-hibernation code on x86-64 uses > kernel_ident_mapping_init() to create the temoprary identity mapping, > but that function assumes that the offset between kernel virtual > addresses and physical addresses is aligned on the PGD level. > > However, with a randomized identity mapping base, it may be aligned > on the PUD level and if that happens, the temporary identity mapping > created by set_up_temporary_mappings() will not reflect the actual > kernel identity mapping and the image restoration will fail as a > result (leading to a kernel panic most of the time). > > To fix this problem, rework kernel_ident_mapping_init() to support > unaligned offsets between KVA and PA up to the PMD level and make > set_up_temporary_mappings() use it as approprtiate. > > Reported-by: Thomas Garnier > Suggested-by: Yinghai Lu > Signed-off-by: Rafael J. Wysocki > Acked-by: Yinghai Lu > --- > > This is sort of urgent, because hibernation doesn't work with KASLR on x86-64 > in 4.8-rc1 AFAICS and this should make them work together again. > > Unless anyone sees any problems with it, I'll queue it up for 4.8-rc2. > > Thomas, would it be possible to test it with KASLR enabled, please? Unfortunately this applied on top of -rc1 still doesn't solve the reboot after reading hibernation image (I'd guess due to triple fault) with CONFIG_RANDOMIZE_MEMORY=y on my system. With CONFIG_RANDOMIZE_MEMORY=n, the system resumes correctly. -- Jiri Kosina SUSE Labs