Message ID | 53ae7c223875633ee8246b6139b226aa16e0512e.1671098103.git.baskov@ispras.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp332223wrn; Thu, 15 Dec 2022 04:52:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf4p74uqWv9z5p/HUZjzFwPVcmtmDVtRCA4NzB/OcMqILfGmDqi8BQV6gkRnFZ8lsDUbBfNN X-Received: by 2002:aa7:d694:0:b0:46d:543:b4c7 with SMTP id d20-20020aa7d694000000b0046d0543b4c7mr24721003edr.17.1671108763452; Thu, 15 Dec 2022 04:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671108763; cv=none; d=google.com; s=arc-20160816; b=yTaXduGYIzWPklkKa1ebmO/MeaklSsU/ghfJE1mPWV+FzHKI8jzbzhvxDaVhvDJFdB skBZh6g87Zh28HPtc5nVLicrGRzvvoctNmMNheoNim46v5a4772Uu5eAMA00CGSQxN1Z gv7pwWEhPRSawyAYAtEPqB93HPFk96fCOU2hhnhAF4oYrx6F8SG08NbDvybGkKBYyd1e yq1yB5kf9GWb7IS0HSF9TZpznRfd3SN1Cw9t63LSJBxL+oA06vGwmhSK53vbTnu8kqPf 2KmP/k1SIRdS59ufK/9Wqb0yzfvamqtD9krvn0NiN7+dtYKYFkbKMZDYVRHZ7KurJzud NonA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=vztQ7u4MmeffEsRSTEqzIF242WNEvNuMgKhdYE1vtQI=; b=mHczwYXTU0trudBTokzpcGisQtsDMayzawTDx41W/C90l04fVOIVdGJ42VnixGU7l7 en5mNi1z3ghvOEZRlwxfHvt2eZp2UNS10aeILekKAMwmWJAf3aG653ZJYiR5VwSVYtzB V8QpZ1pANr5G6q0TSGZKGF8jpWuOEKOeIgs73xqyeJn+sypcGGrFw04apuMBrYiS/Azi h8pBFDUZuxLBjS3NonnOY9JHt2w57B6pfgL5MmACRDGogeIyyJ2V47JSRd2TTDOkcqcp BXym6SYJOSksQA313zsokLDCofODeHpQisj119+XB3WmvFo5Yg4ljok7MHsuGSP+lqzz FnYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b="ljb1/2po"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a056402280a00b0046baedff35bsi18124453ede.291.2022.12.15.04.52.18; Thu, 15 Dec 2022 04:52:43 -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="ljb1/2po"; 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 S230203AbiLOMni (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Thu, 15 Dec 2022 07:43:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229914AbiLOMnC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Dec 2022 07:43:02 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ACB820F59; Thu, 15 Dec 2022 04:42:30 -0800 (PST) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 0E73240737AF; Thu, 15 Dec 2022 12:42:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 0E73240737AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1671108147; bh=vztQ7u4MmeffEsRSTEqzIF242WNEvNuMgKhdYE1vtQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljb1/2povbonR9yWOyTDLbgWJV5pgA+tzHeC3kYznBneI1ff+TX9u3KbL4KlbUY0o CVKQpvvfHJSHqzxy1raMDEsLdy87oeyO1ISgSpUNdP9of8+qOFKStp+ZCj6Og70A+r bZmHgg3d8wTayX5rmBBclnRlkSpUNlSDX4wmG/rg= From: Evgeniy Baskov <baskov@ispras.ru> To: Ard Biesheuvel <ardb@kernel.org> Cc: Peter Jones <pjones@redhat.com>, Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Alexey Khoroshilov <khoroshilov@ispras.ru>, "Limonciello, Mario" <mario.limonciello@amd.com>, joeyli <jlee@suse.com>, lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v4 25/26] efi/x86: don't try to set page attributes on 0-sized regions. Date: Thu, 15 Dec 2022 15:38:16 +0300 Message-Id: <53ae7c223875633ee8246b6139b226aa16e0512e.1671098103.git.baskov@ispras.ru> X-Mailer: git-send-email 2.37.4 In-Reply-To: <cover.1671098103.git.baskov@ispras.ru> References: <cover.1671098103.git.baskov@ispras.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752284542670841274?= X-GMAIL-MSGID: =?utf-8?q?1752284542670841274?= |
Series |
x86_64: Improvements at compressed kernel stage
|
|
Commit Message
Evgeniy Baskov
Dec. 15, 2022, 12:38 p.m. UTC
From: Peter Jones <pjones@redhat.com> In "efi/x86: Explicitly set sections memory attributes", the following region is defined to help compute page permissions: /* .setup [image_base, _head] */ efi_adjust_memory_range_protection(image_base, (unsigned long)_head - image_base, EFI_MEMORY_RO | EFI_MEMORY_XP); In at least some cases, that will result in a size of 0, which will produce an error and a message on the console, though no actual failure will be caused in the boot process. This patch checks that case in efi_adjust_memory_range_protection() and returns the error without logging. Signed-off-by: Peter Jones <pjones@redhat.com> --- drivers/firmware/efi/libstub/mem.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/efi/libstub/mem.c b/drivers/firmware/efi/libstub/mem.c index b31d1975caa2..50a0b649b75a 100644 --- a/drivers/firmware/efi/libstub/mem.c +++ b/drivers/firmware/efi/libstub/mem.c @@ -249,6 +249,9 @@ efi_status_t efi_adjust_memory_range_protection(unsigned long start, efi_physical_addr_t rounded_start, rounded_end; unsigned long attr_clear; + if (size == 0) + return EFI_INVALID_PARAMETER; + /* * This function should not be used to modify attributes * other than writable/executable.