From patchwork Wed Feb 22 18:24:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94359 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1041808qgi; Wed, 22 Feb 2017 10:25:11 -0800 (PST) X-Received: by 10.36.14.213 with SMTP id 204mr3246813ite.80.1487787911760; Wed, 22 Feb 2017 10:25:11 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id u131si2666512itf.72.2017.02.22.10.25.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Feb 2017 10:25:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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) 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) 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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.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 == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) { + if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0) && + !(NewType == EfiBootServicesCode && Entry->Type == EfiBootServicesData)) { DEBUG ((DEBUG_ERROR | DEBUG_PAGE, "ConvertPages: Incompatible memory types\n")); return EFI_NOT_FOUND; }