From patchwork Fri Apr 29 07:44:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 66936 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp640667qge; Fri, 29 Apr 2016 00:44:19 -0700 (PDT) X-Received: by 10.98.48.71 with SMTP id w68mr26735292pfw.18.1461915857276; Fri, 29 Apr 2016 00:44:17 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id r7si14987319pfa.99.2016.04.29.00.44.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 00:44:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; 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 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9697C1A1F6F; Fri, 29 Apr 2016 00:44:16 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (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 E5C051A1F6E for ; Fri, 29 Apr 2016 00:44:14 -0700 (PDT) Received: by mail-wm0-x22f.google.com with SMTP id n129so16560464wmn.1 for ; Fri, 29 Apr 2016 00:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=aFfG2u5LVR5Laz1qad3hj6JB8JtWRxW5nNc/7yp/aTk=; b=UlB43n4FmWB0pDAO99VLzZpZbkpOpZQfCAGII+1QRWZNNXmonNHg1BliPoVAlUVXnM 3ZJTZs5og7/BGk/D3tIcbAY4unvcMQ7mVHDPCzc98qEx+oma8iuUpOt4LWr1mlaaFW6z ROBRbxYm9llk5Olf4mGzP3D5oL+FUoCipDkHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aFfG2u5LVR5Laz1qad3hj6JB8JtWRxW5nNc/7yp/aTk=; b=hTDaeXT9FcLrUVWYw34AXjlktpLhSj4K8o342DXjaxQhDDd8qzmfF7jZ1GXvSutz0z SzBRRWdoGho3NjY3jJsOjuCpCd/i5i0knCy/LLeGm9g9uqz3cBIjo6v9ch3yht+8Ah1v H3QPpPOR9V68UqURO64UcvAhdZnkQPKmxLA1Pir2ZxCKCVDRdYzuV+XFK3wOWbd5EQSS EjmpTMdkTi5m5vy+Oue2xVTvh3JoSyVeRnunLtSGKFs+Cgoob3fk1JG8ySf6sr0ABx/t p1y2ol2M8wtvvWXCA3MLB9CtmFHgs61A9bsbd2v0IgAJLb7Ke2nIqtsbtMZUPRAd6JU4 rLyA== X-Gm-Message-State: AOPr4FW9+IQlGZV2GGb7s7NfijZgz90BOXhaU7FwtIsuXHsl+LVJXL41t9653NvgNTYBsSmy X-Received: by 10.194.175.36 with SMTP id bx4mr19950072wjc.35.1461915853142; Fri, 29 Apr 2016 00:44:13 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id u4sm13468842wjz.4.2016.04.29.00.44.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Apr 2016 00:44:12 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, feng.tian@intel.com, star.zeng@intel.com Date: Fri, 29 Apr 2016 09:44:08 +0200 Message-Id: <1461915848-29339-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: set ImageContext Handle and ImageRead() fields X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Set the ImageContext.Handle and ImageContext.ImageRead() fields so that PeCoffLoaderRelocateImageExtraAction() can invoke PeCoffLoaderGetImageInfo or PeCoffLoaderGetPeHeader if desired to obtain additional metadata. We will use this to create a PeCoffLoaderRelocateImageExtraAction() implementation that applies boot time strict mapping permissions to PE/COFF modules. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 ++ 1 file changed, 2 insertions(+) -- 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/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c index 70a283bc2ba2..c34067e11845 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -315,6 +315,8 @@ DxeMain ( if (Status == EFI_SUCCESS) { ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint; } + ImageContext.Handle = (VOID *)(UINTN)gDxeCoreLoadedImage->ImageBase; + ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory; PeCoffLoaderRelocateImageExtraAction (&ImageContext); //