Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp776067rwb; Wed, 14 Dec 2022 02:36:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf5v+dIFE3EQn4fV0voXrQS94Z1a2XhCiJ9ojGl6oZ6OgZ6+yK/90DhtMu6YbUrZxJyvsH6L X-Received: by 2002:a17:906:f1cb:b0:7c1:2529:b25e with SMTP id gx11-20020a170906f1cb00b007c12529b25emr22025465ejb.43.1671014216856; Wed, 14 Dec 2022 02:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671014216; cv=none; d=google.com; s=arc-20160816; b=DUWiMhgwetFxiTw0CL04QzE7bm7HefjlhS5Yfo1WELvyxdiB+vrTgPzp2ObuyKi+Ho lH54rQBdmexqQW504V1x36d8I+8A/JEnor0lJ2EekHAUL+D+ZwDB1tixmCOlIBY6mj8Q Hkp/id8jcpeiLPu45E2poXXVGsePDQ8SjrkS1Eg6Az0IwMeHOm+eRJhASi4Tv5UQLs1c 6K1S/i/dekir6jiaWfTiE5HLiQSfPTsGTdRUDjfYirfvHtAo35tFkYX3Ad9tCrOpftr/ uv7NnqRuCPyaoHl4w1hfZHGCtFCvf+IyFc+dTYrom1jS327cGYyDa5YovfL9lpGZw+WO guhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=544IA+HseoOivKLCFCXsHZ8fGORfEXd0qp5EbhCrxqA=; b=yWiBysv6NCZWt1HEwmWewKIWTWKKIRdhrHeIResDx13zrE3m+QZHqOdijPpiK5F+W8 EczVT8sC/hz4szEnRjij24rH6ZlZVCRzpgReKxWFLgeYhkSeQw9J7xNir8PL9hO/c8my DNfZ36y6ZHhudG9CxPmU0CJ/VPVBkgxskEs/NoEg+yMkcFhNrtNCNBdXJE2HwOvcnfEu UB7Medxp0ogSdie7c3uVIXQyzVzCCPbgAFmHcvn+sF19xbpLPoCPey1p3auroT/5ky7V 8SxvxQF/fBAqscdgeXk9wvZUq4i1Np4X73JNHCtwDDR0dflAlQzqG/ptUwviyVh/xEDG ijoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=us6Gg4Fs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx8-20020a05640222a800b00468f9f21c11si10822950edb.245.2022.12.14.02.36.40; Wed, 14 Dec 2022 02:36:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=us6Gg4Fs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238067AbiLNKMa (ORCPT + 70 others); Wed, 14 Dec 2022 05:12:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238188AbiLNKMD (ORCPT ); Wed, 14 Dec 2022 05:12:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836E8233A4; Wed, 14 Dec 2022 02:09:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4FBF618BB; Wed, 14 Dec 2022 10:09:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4041FC433D2; Wed, 14 Dec 2022 10:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671012585; bh=9Fl50pE2AYKpTZsVNJkvTqaiaCa/zyH+CxC4HbLrEc4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=us6Gg4Fst8ebLkXk4Lwbh7ogPG0TKCnlNHahABCkMmP9P6gNNcVwn1ULzek49Iswv yPhQ5njxsxzRcWf/iDEIkJq8Bm++1YJHpRFqteYft0ufTlBqKKv7Xk+5t6HBi1HPJI 8nzn/19o5ImHLoYuVLict5Gmq+XOtvXoTU4SR17lgQdokLYoiZIwTvgNuyXTX7lISF tu7L5Wd9g3bjqm+PbBJewJ2Wpxq7L8B2Hw9FwCWUjV2FrgA+MtMJkEJwh2hKGUunr6 p9fDZ6GwEgD6wAZMEJ5KhUhTNpDCjDcVidboIwP/NZwLqXhzGNqj/RiHySh/CChTmt UI/bqSa5rjRGQ== Received: by mail-lf1-f46.google.com with SMTP id bp15so9544956lfb.13; Wed, 14 Dec 2022 02:09:45 -0800 (PST) X-Gm-Message-State: ANoB5pllTxM5x5rSyqBNFIvqiVUmKkbcnGN/6wl0zmLPu1VDp3hvutLC rJGoyJbstMUKHS/t+Dt75n7sIK41F7IfrYadNwg= X-Received: by 2002:a05:6512:3082:b0:4b5:964d:49a4 with SMTP id z2-20020a056512308200b004b5964d49a4mr3831362lfd.637.1671012583304; Wed, 14 Dec 2022 02:09:43 -0800 (PST) MIME-Version: 1.0 References: <20221213180317.qoy2l3mcpjparocq@redhat.com> <20221213181336.fjyxagxkjtq3jchl@redhat.com> In-Reply-To: From: Ard Biesheuvel Date: Wed, 14 Dec 2022 11:09:32 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 00/24] x86_64: Improvements at compressed kernel stage To: Evgeniy Baskov Cc: Peter Jones , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Dec 2022 at 23:16, Evgeniy Baskov wrote: > > 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. > Happy to see this is converging. Please rebase onto latest mainline as well - some cleanups to the early boot code have landed there yesterday.