Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp904907rwb; Wed, 14 Dec 2022 04:26:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf7BFs+51E97Bh376KyEjwoFy6yVveaLOjYcCheKwHyYduq+7Hp/1NKWs9+AKwFNF/7jzhDP X-Received: by 2002:a17:906:683:b0:7ad:b865:d3b7 with SMTP id u3-20020a170906068300b007adb865d3b7mr19513725ejb.21.1671020798493; Wed, 14 Dec 2022 04:26:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671020798; cv=none; d=google.com; s=arc-20160816; b=Vddn6RKGQ8ztjabY4PyLumvpd5hqtDEHtUewVFGv3SRSGtVkllGHnvgdJxRWpITFuw EAOcE3eJpv7O5OdNRudiQPMu3DVmsBEJj0eMpmU7D/E8IxQwEHGayRFg5jdr8AcuRyjw V6eNxIsQmk0GNajnvXRgsGBNuSf3dtfKf+j+qsYzvGYBEtIwJYgSOaKwLrsISqEuLXAS rlAOyeAxUWEZV2jr8KNFF3ByjK/sm9Tf2cU9ma0LOx3Nt038D7DR25MuECcWFRbMGWC+ O3cvLOBKY4fiUoP3uVjtgPLtW/Ywbjd1/3iElJD84zYAIMH19vAW92idIe5rcKaRRanj x9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version :dkim-signature:dkim-filter; bh=bh8Zdc2f3HMlsvorMmpYM+UbWvlZb6yMDnwhRqB5YZ0=; b=AwqYYjudxBklCYTfmvBriiOuCUCefSB0fQ2iwrAvwl9EU3eFQbwMA1c97ClfpJW8Ti AHoUBpomHFqU2VEpaV/H1M8UxbU4H5kELy6VWntZ5avZ7QQgBHmmMzSR39MJYTH+kSnO CFJBxrfbm95FEisQQZX0cK33yGT8SgKrH5GEgVvib+SwvWYNWNQ+DeJyq12iIyEgaY4w rRZ2tUjouAreuPwnQ4wvcE9q4W/IDF2ZywaMPupXa2x7tlAkrNdBhXUgkY/sX3fmpodm lDCV6h95dsK2DxQpttFcxmgK3wgfRRWLlAJIu0gbxI6i+KfrWy9fIcHaLDliT/ngQsXj 0/9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=JIgI7XPC; 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=ispras.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw18-20020a170906479200b007ae832c0b69si11803854ejc.512.2022.12.14.04.26.21; Wed, 14 Dec 2022 04:26:38 -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=@ispras.ru header.s=default header.b=JIgI7XPC; 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=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237784AbiLNLtH (ORCPT + 70 others); Wed, 14 Dec 2022 06:49:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbiLNLtF (ORCPT ); Wed, 14 Dec 2022 06:49:05 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C8D826D; Wed, 14 Dec 2022 03:49:03 -0800 (PST) Received: from mail.ispras.ru (unknown [83.149.199.84]) by mail.ispras.ru (Postfix) with ESMTPSA id 1A7E4419E9DE; Wed, 14 Dec 2022 11:49:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 1A7E4419E9DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1671018541; bh=bh8Zdc2f3HMlsvorMmpYM+UbWvlZb6yMDnwhRqB5YZ0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JIgI7XPCbzQnmchfdKs0F74i6cRbzRZ9Du10xt1fD8Os9GI7+pw1RtdpdxJUwPW6z dvaOI/+eNaVta8pv2akqBHipPjuggxrdvcjWceGVNoFek5llgH8S2UKNXQvTksOd0H MffLmfwy+PIdoEgcB9CYpwW51vWD0b0XIxCpNaQ0= MIME-Version: 1.0 Date: Wed, 14 Dec 2022 14:49:01 +0300 From: Evgeniy Baskov To: Ard Biesheuvel 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 Subject: Re: [PATCH v3 00/24] x86_64: Improvements at compressed kernel stage In-Reply-To: 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 2022-12-14 13:09, Ard Biesheuvel wrote: > 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. Will do, thanks!