From nobody Sat Nov 2 16:28:24 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487787914182981.5409861724228; Wed, 22 Feb 2017 10:25:14 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 01E7C82226; Wed, 22 Feb 2017 10:25:11 -0800 (PST) Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6DEBC82226 for ; Wed, 22 Feb 2017 10:25:09 -0800 (PST) Received: by mail-wr0-x233.google.com with SMTP id 89so7939926wrr.3 for ; Wed, 22 Feb 2017 10:25:09 -0800 (PST) Received: from localhost.localdomain ([196.80.204.181]) by smtp.gmail.com with ESMTPSA id e73sm3504667wmi.32.2017.02.22.10.25.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Feb 2017 10:25:07 -0800 (PST) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=86tRaLXNh4jG5PH7v9lHRWgZoFiaBQ8bDbsNCKKwkys=; b=aWVNDte1Ees/jXQKZ67CLdQVAotFgvqb+aBIwXdfU1JLdSsbpmRrtZ8TA5hotjvcjX 2m1LqFJqvXv1ko8Q8/eyVov6jCe0we7K9fkum//zCqoHH94jUx+bBDHaI70BFayqDn54 YpbBz4acviZbixKF1I/j9rxnUKQkTbRApt4zQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=86tRaLXNh4jG5PH7v9lHRWgZoFiaBQ8bDbsNCKKwkys=; b=nJLGJIH6GmBQjiYr+EfH8f2wnBq1mlfwdwvQOvf5ZRPnCP9rlttiutNQkc1z1q1wyk 9wMb3S5cvrXqdZw0iGofe69HWRJBrfNX/t474tVYFNgPAvG+/aaArD/hnIgiQzDzNqKj d6wNFuiL/K2GllOKg4Q/yP2w6PypccsQihKlqD/PsQAm+e1HX60P7pfDGUYMVNQ1pQlI KnLIap3jZd3cghndCXXPMLiTxdB3vmzFfWv88TGbCDfQjg/lM3fm3ctCS8jtEMtbUb1L dgi6soPFXJuSQaUqzblYj+eb1t8QyYwA0HtcZcAsZ2F+G8fHuZMyyLOBikyDNeCqBzRw 6PDw== X-Gm-Message-State: AMke39kFVKj2lKZ3pOP/gxMaYOA6NWSy88tvD32GT+uxxNBtkCueRKORq39fOJh8S2xh3eyR X-Received: by 10.223.139.137 with SMTP id o9mr28192125wra.88.1487787908027; Wed, 22 Feb 2017 10:25:08 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, afish@apple.com, leif.lindholm@linaro.org, michael.d.kinney@intel.com, liming.gao@intel.com, jiewen.yao@intel.com Date: Wed, 22 Feb 2017 18:24:55 +0000 Message-Id: <1487787898-5222-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487787898-5222-1-git-send-email-ard.biesheuvel@linaro.org> References: <1487787898-5222-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [RFC PATCH 1/4] MdeModulePkg/DxeCore: allow BootServicesData->BootServicesCode conversion X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: feng.tian@intel.com, lersek@redhat.com, star.zeng@intel.com, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Unlike all other PE/COFF images loaded after it, the DXE core is loaded into BootServicesData memory rather than BootServicesCode memory, due to the fact that the PEI phase memory allocation routines only distinguish between boot-time and runtime. So in preparation of adding support for restricted permissions, allow the direct conversion of BootServicesData to BootServicesCode. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/Mem/Page.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/P= age.c index bda4f6397e91..b0939c596991 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -773,7 +773,8 @@ CoreConvertPagesEx ( // // Debug code - verify conversion is allowed // - if (!(NewType =3D=3D EfiConventionalMemory ? 1 : 0) ^ (Entry->Type = =3D=3D EfiConventionalMemory ? 1 : 0)) { + if (!(NewType =3D=3D EfiConventionalMemory ? 1 : 0) ^ (Entry->Type = =3D=3D EfiConventionalMemory ? 1 : 0) && + !(NewType =3D=3D EfiBootServicesCode && Entry->Type =3D=3D EfiBo= otServicesData)) { DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memo= ry types\n")); return EFI_NOT_FOUND; } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel