From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbdGDPgh (ORCPT ); Tue, 4 Jul 2017 11:36:37 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38296 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbdGDPgg (ORCPT ); Tue, 4 Jul 2017 11:36:36 -0400 Date: Tue, 4 Jul 2017 16:36:33 +0100 From: Matt Fleming To: Thomas Gleixner Cc: Baoquan He , LKML , x86@kernel.org, "H. Peter Anvin" , Ingo Molnar , Kees Cook , thgarnie@google.com, caoj.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com Subject: Re: [PATCH v2 2/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions Message-ID: <20170704153633.GA3149@codeblueprint.co.uk> References: <1499155442-17467-1-git-send-email-bhe@redhat.com> <1499155442-17467-3-git-send-email-bhe@redhat.com> <20170704143034.GA25192@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24+42 (6e565710a064) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 04 Jul, at 04:46:58PM, Thomas Gleixner wrote: > On Tue, 4 Jul 2017, Baoquan He wrote: > > > In fact I just referred to code in setup_arch(). Now I have a question, > > though CONFIG_EFI=y but efi firmware is not enabled, > > boot_params.efi_info.efi_loader_signature should be initilized to 0. > > Then below code is also problematic. > > > > #ifdef CONFIG_EFI > > if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, > > EFI32_LOADER_SIGNATURE, 4)) { > > set_bit(EFI_BOOT, &efi.flags); > > } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, > > EFI64_LOADER_SIGNATURE, 4)) { > > set_bit(EFI_BOOT, &efi.flags); > > set_bit(EFI_64BIT, &efi.flags); > > } > > > > if (efi_enabled(EFI_BOOT)) > > efi_memblock_x86_reserve_range(); > > #endif > > Indeed. Matt? It's possibly that I'm missing some context, but boot_params should be zero'd -- the x86 boot protocol requires that the entire data structure be zero'd on allocation. Have I missed something?