From patchwork Tue Jun 30 13:17:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 50481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC3C8229DF for ; Tue, 30 Jun 2015 13:18:22 +0000 (UTC) Received: by wguu7 with SMTP id u7sf3865861wgu.0 for ; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=JvAxZsgkwMJlyLCEaVCGCmFu53mmBeBqUFD2bSL6Njg=; b=lzGkxpbu9f5T3sTaEHcpMPvXSYlXNqvsxVyKeDAwQkxwhopXVt50E9ooSueSN9ZEda PGLAqwDoNNqol2lt7padvVi0sZ68xswj4u89mwrPzOUs2u1assFnlTv+bnPMau+bylGR GmC1gTROWNwqh0031pIGvN7AFM+OsLHRtdK7PlFlCx6XnBYrqal6TpBW/YSQiPuvcPNa 2OJWc5Lyh8mqCuveC+oUSymqtIQT+PZ+qD75prqvxHxEDSVNzVjWIbkKmA6PQ3pK+0t5 rgwHl3LeFFE2xyi1duDHtPjLERVpGVc6+Twn5QiKVJDm6LFhqrTp4TqppN6qofKG3fls cqNA== X-Gm-Message-State: ALoCoQmLTy1ZjH9ICGAWnVHMFWmvVOliLms96jq95CQNl54PsW4KEA7+XwvbO+8y//+BWgJwdGT6 X-Received: by 10.152.27.130 with SMTP id t2mr14077155lag.2.1435670301884; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.130 with SMTP id b2ls35447lah.97.gmail; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr19635373lbp.88.1435670301600; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id ot8si38104094lbb.177.2015.06.30.06.18.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 06:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by laar3 with SMTP id r3so13140313laa.0 for ; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr19990263lbb.35.1435670301479; Tue, 30 Jun 2015 06:18:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2444574lbb; Tue, 30 Jun 2015 06:18:20 -0700 (PDT) X-Received: by 10.107.3.41 with SMTP id 41mr30379060iod.48.1435670299903; Tue, 30 Jun 2015 06:18:19 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id hl2si23395824icc.18.2015.06.30.06.18.19 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 06:18:19 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z9vQO-0002AU-DI; Tue, 30 Jun 2015 13:18:08 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Z9vQO-0002AP-5Q for edk2-devel@lists.sourceforge.net; Tue, 30 Jun 2015 13:18:08 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.54 as permitted sender) client-ip=74.125.82.54; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f54.google.com; Received: from mail-wg0-f54.google.com ([74.125.82.54]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1Z9vQJ-0005UD-W2 for edk2-devel@lists.sourceforge.net; Tue, 30 Jun 2015 13:18:08 +0000 Received: by wgjx7 with SMTP id x7so9486924wgj.2 for ; Tue, 30 Jun 2015 06:17:58 -0700 (PDT) X-Received: by 10.194.75.132 with SMTP id c4mr36760378wjw.80.1435670277971; Tue, 30 Jun 2015 06:17:57 -0700 (PDT) Received: from localhost.localdomain ([185.13.106.91]) by mx.google.com with ESMTPSA id lk5sm16980848wic.24.2015.06.30.06.17.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jun 2015 06:17:57 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, jiewen.yao@intel.com Date: Tue, 30 Jun 2015 15:17:35 +0200 Message-Id: <1435670255-4106-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435670255-4106-1-git-send-email-ard.biesheuvel@linaro.org> References: <1435670255-4106-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1Z9vQJ-0005UD-W2 Cc: matt.fleming@intel.com Subject: [edk2] [PATCH 5/5] MdeModulePkg: enforce arch-specific alignment for split regions X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The splitting of memory regions into code and data regions violates architecture specific alignment rules by using a fixed alignment of 4 KB. Replace it with EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT, which is defined appropriately on each architecture. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c index 0232a3ce7d93..01ecca64ab0a 100644 --- a/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c +++ b/MdeModulePkg/Core/Dxe/Misc/PropertiesTable.c @@ -785,7 +785,7 @@ SetPropertiesTableSectionAlignment ( IN UINT32 SectionAlignment ) { - if (((SectionAlignment & (SIZE_4KB - 1)) != 0) && + if (((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) && ((mPropertiesTable.MemoryProtectionAttribute & EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA) != 0)) { DEBUG ((EFI_D_VERBOSE, "SetPropertiesTableSectionAlignment - Clear\n")); mPropertiesTable.MemoryProtectionAttribute &= ~EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA; @@ -1119,8 +1119,9 @@ InsertImageRecord ( } SetPropertiesTableSectionAlignment (SectionAlignment); - if ((SectionAlignment & (SIZE_4KB - 1)) != 0) { - DEBUG ((EFI_D_ERROR, "!!!!!!!! InsertImageRecord - Section Alignment(0x%x) is not 4K !!!!!!!!\n", SectionAlignment)); + if ((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) { + DEBUG ((EFI_D_ERROR, "!!!!!!!! InsertImageRecord - Section Alignment(0x%x) is not %dK !!!!!!!!\n", + SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10)); PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress); if (PdbPointer != NULL) { DEBUG ((EFI_D_ERROR, "!!!!!!!! Image - %a !!!!!!!!\n", PdbPointer));