From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7BB4C4332F for ; Tue, 13 Dec 2022 22:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236227AbiLMWQX (ORCPT ); Tue, 13 Dec 2022 17:16:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbiLMWQU (ORCPT ); Tue, 13 Dec 2022 17:16:20 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2086F261E; Tue, 13 Dec 2022 14:16:19 -0800 (PST) Received: from mail.ispras.ru (unknown [83.149.199.84]) by mail.ispras.ru (Postfix) with ESMTPSA id 3DA93419E9E1; Tue, 13 Dec 2022 22:16:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 3DA93419E9E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1670969773; bh=VHdI9Xh1NeCJLb26KKJ6iPHrz7yjmrTEO99iPDQ8hOs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mnxsAh0bWjBhi8jpakZlMTltzOdtMY8Hl7y+QB5nDB7Wy3p2vddA/8zfqAuPeGnwC hm5z/9G8k3w8+6vs9bkz5ej8HTm0j9TtIWT97YSArkyf7bDjXuOUFSPwLRYqF8EgFF 7BM9jXbNdmCPKFKU5BWgEKV3FdSP6X655J9mR6jc= MIME-Version: 1.0 Date: Wed, 14 Dec 2022 01:16:13 +0300 From: Evgeniy Baskov To: Peter Jones Cc: Ard Biesheuvel , Borislav Petkov , Andy Lutomirski , Dave Hansen , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Alexey Khoroshilov , "Limonciello, Mario" , joeyli , lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v3 00/24] x86_64: Improvements at compressed kernel stage In-Reply-To: <20221213181336.fjyxagxkjtq3jchl@redhat.com> References: <20221213180317.qoy2l3mcpjparocq@redhat.com> <20221213181336.fjyxagxkjtq3jchl@redhat.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: baskov@ispras.ru Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-12-13 21:13, Peter Jones wrote: > On Tue, Dec 13, 2022 at 01:03:17PM -0500, Peter Jones wrote: >> On Tue, Nov 22, 2022 at 02:12:09PM +0300, Evgeniy Baskov wrote: >> > This patchset is aimed >> > * to improve UEFI compatibility of compressed kernel code for x86_64 >> > * to setup proper memory access attributes for code and rodata sections >> > * to implement W^X protection policy throughout the whole execution >> > of compressed kernel for EFISTUB code path. >> >> Hi Evgeniy, >> >> I've tested this patch set on hardware and QEMU+MU firmware, and it >> works for me with a couple of minor issues: >> >> - on one machine that has the DXE protocol but not the EFI one, we get >> an error because the firmware doesn't support EFI_MEMORY_RP >> - on QEMU I'm seeing the size of "(unsigned long)_head - image_base" >> wind up as 0, which leads to an EFI_INVALID_PARAMETER on the >> clear_memory_attributes() call. >> >> In both cases the system winds up working, but with unnecessary >> console >> output. > > I just realized I've overstated here - I haven't actually hit the first > problem on x86, only on ARM, where we don't currently use this code. I > discovered it in grub, and checked your patch set to see if you had the > same issue I did. That said, "in both cases the system winds up > working" is probably still true - in that the edk2 code supports > EFI_MEMORY_RP on x86 but not ARM, so x86 won't hit the issue when using > DXE unless someone cooks up another implementation. Nevertheless I > believe the patch to fix it is correct and should be applied. > > Thanks! Hi, Thank you for testing and fixes! I have also discovered one issue with v3, that can only be hit when booting with grub -- there's one kernel_add_identity_map() missing in the get_acpi_srat_table() function, before header->length is read. So I'll prepare the v4 soon and include your new patches there. Thanks, Evgeniy Baskov