From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164716AbdD1G7S (ORCPT ); Fri, 28 Apr 2017 02:59:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50712 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162383AbdD1G7K (ORCPT ); Fri, 28 Apr 2017 02:59:10 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 177537F4AD Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bhe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 177537F4AD Date: Fri, 28 Apr 2017 14:59:02 +0800 From: Baoquan He To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Dave Young , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Kees Cook , Yinghai Lu , Borislav Petkov , Dave Jiang , Thomas Garnier Subject: Re: [PATCH v2] x86/KASLR: Use old ident map page table if physical randomization failed Message-ID: <20170428065902.GE2649@x1> References: <1493278940-5885-1-git-send-email-bhe@redhat.com> <20170428062527.qx6wvh7ctdinzezs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170428062527.qx6wvh7ctdinzezs@gmail.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 28 Apr 2017 06:59:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/28/17 at 08:25am, Ingo Molnar wrote: > > * Baoquan He wrote: > > > Dave found kdump kernel with kaslr enabled will reset to bios immediately > > if physical randomization failed to find a new position for kernel. But > > kernel with 'nokaslr' option works in this case. > > > > The reason is kaslr will install a new page table for ident mapping, > > while it missed to consider building ident mapping for original area > > of kernel if kaslr failed on physical randomization. > > > > This only happens in kexec/kdump kernel. Since ident mapping has been > > built for kexec/kdump in 1st kernel for the whole memory by calling > > init_pgtable(). Here if physical randomizaiton failed, it won't build > > ident mapping for the original area of kernel but change to new page > > table '_pgtable'. Then kernel will reset to bios immediately caused by > > no ident mapping. > > > > While normal kernel won't be impacted because it comes here via > > startup_32() and cr3 will be _pgtable already. In startup_32() ident > > mapping is built for 0~4G area. In kaslr We just append to the existing > > area instead of entirely overwriting it for on-demand ident mapping > > building. So ident mapping for the original area of kernel is still > > there. > > > > So for fixing it, We just switch to the new ident mapping page table > > when physical kaslr succeeds. Otherwise we keep the old page table > > unchanged just like nokaslr does. > > > > Signed-off-by: Baoquan He > > Signed-off-by: Dave Young > > Acked-by: Kees Cook > > That's not a valid signoff chain. I made it: > > Reported-by: Dave Young > Signed-off-by: Baoquan He > Acked-by: Dave Young > Acked-by: Kees Cook > > (Let me know if that's not the proper authorship chain.) Yeah, this is fine, thanks. Next time I will notice this.