From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752954AbeAQM21 (ORCPT + 1 other); Wed, 17 Jan 2018 07:28:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:58068 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520AbeAQM2X (ORCPT ); Wed, 17 Jan 2018 07:28:23 -0500 Subject: Re: [PATCH] x86/acpi: check rsdp address received via bootparams to be valid To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, x86@kernel.org, lenb@kernel.org, rafael.j.wysocki@intel.com, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com References: <20180116135730.19216-1-jgross@suse.com> <20180116154630.ke53suvokynj73qd@gmail.com> <432c21ab-24d8-1e70-a471-ad8a14357d4e@suse.com> <20180116163529.rc5j23oqmwk45rp5@gmail.com> From: Juergen Gross Message-ID: <4a8b0233-9bb8-3c95-0a08-93a5ceffc231@suse.com> Date: Wed, 17 Jan 2018 13:28:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180116163529.rc5j23oqmwk45rp5@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 16/01/18 17:35, Ingo Molnar wrote: > > * Juergen Gross wrote: > >> On 16/01/18 16:46, Ingo Molnar wrote: >>> >>> * Juergen Gross wrote: >>> >>>> There seem to exist several grub2 versions trashing >>>> boot_params.hdr.acpi_rsdp_addr. >>>> >>>> So don't just believe this address to be valid, but verify it pointing >>>> to a valid RSDP table. >>> >>> Exactly what kind of values do those Grub2 versions put into that field? Pointer >>> to something, or random noise? >> >> Looks like random noise. On Mike's system it was 0x000000000151. >> >>> Also, what exactly does 'validation' mean, how robustly does it filter out of spec >>> uses of the boot protocol? >> >> It validates the RSDP has the correct 8 byte eye catcher in it and >> the checksum of the structure is correct. Searching the RSDP by >> scanning memory is using the same checks, so I guess this ought to >> be okay. Odds are about 1 : 2^80 for false positives. > > Ok, this should work - but only because the RSDP is defined in such a robust > fashion. > > The boot protocol extension is still fragile: what I worry about is that if we > start relying on the extended boot protocol with widespread installed base of out > of spec Grub2 loaders, other extensions (which cannot be sanity checked) would be > less robust. > > Is there a way to detect the broken Grub2 versions somehow and just limit the boot > protocol for them? > > The other solution would be to just discontinue this boot protocol extension and > define a new one. I think the best way to do it would be to let grub2 report the version of the protocol it is honoring. This reported version should not be higher than that of the kernel. The kernel would then know which fields of setup_header are known by grub2 and thus can be trusted to be correct. I can modify my patch series to add the grub2 version information before the new rsdp_address field so this band-aid patch won't be required. What do you think? Juergen