From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752363AbdGDOAU (ORCPT ); Tue, 4 Jul 2017 10:00:20 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:48411 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbdGDOAT (ORCPT ); Tue, 4 Jul 2017 10:00:19 -0400 Date: Tue, 4 Jul 2017 16:00:16 +0200 (CEST) From: Thomas Gleixner To: Baoquan He cc: linux-kernel@vger.kernel.org, x86@kernel.org, hpa@zytor.com, mingo@kernel.org, keescook@chromium.org, 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 In-Reply-To: <1499155442-17467-3-git-send-email-bhe@redhat.com> Message-ID: References: <1499155442-17467-1-git-send-email-bhe@redhat.com> <1499155442-17467-3-git-send-email-bhe@redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) 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 Tue, 4 Jul 2017, Baoquan He wrote: > +/* Marks if efi mirror regions have been found and handled. */ > +static bool efi_mirror_found; > + > +static void process_efi_entry(unsigned long minimum, unsigned long image_size) > +{ > + struct efi_info *e = &boot_params->efi_info; > + struct mem_vector region; > + efi_memory_desc_t *md; > + unsigned long pmap; > + char *signature; > + u32 nr_desc; > + int i; > + > + > +#ifdef CONFIG_EFI > + signature = (char *)&boot_params->efi_info.efi_loader_signature; > +#endif So if CONFIG_EFI=n you happily dereference the uninitialized signature pointer ... Why is process_efi_entry() invoked at all if EFI is not enabled? > + if (strncmp(signature, EFI32_LOADER_SIGNATURE, 4) && > + strncmp(signature, EFI64_LOADER_SIGNATURE, 4)) > + return; > + Thanks, tglx