From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (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 E873B8217E for ; Fri, 24 Feb 2017 07:05:17 -0800 (PST) Received: by mail-wm0-x231.google.com with SMTP id v77so16586106wmv.0 for ; Fri, 24 Feb 2017 07:05:17 -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=52yooIEdiISiLV9Hy6Kl4VlCrQFT4xMyOMgF/FTqR78=; b=A1iuM5cQ/IdheTE14frlZY6OM7ZODaIo546/mqD1ANnIjVY9WdBGFoOKnDzUiF/5mS TFAWBNh+PR3Z3NAhWaufzihty+GOjhQOE204Aej68cRA5sX6oLAerUEREgN7MOv25ofD jqzu8VBYweAX8OcPqYJMnj8pUXQLxnbNYhoKk= 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=52yooIEdiISiLV9Hy6Kl4VlCrQFT4xMyOMgF/FTqR78=; b=O0aVgZvMerbzQMy00ABFm2JLAaLmdngKFG3UkZ+1TXHI+ftwrC6jqNLHF4x5oSKbob ZojSGOKNjCXatI+PVV4GLaeByd4NHAKw3Xcy7WlfdDbJw4UG54iQ4hLCHlp9n0RRD2JU IdByti0MVUfyFp3fw8kKqNncaSuMrywYkLLh/x4ZcwhCIWh6U2NUWA69fqHYFReR4eeJ yofVJbZJM3KlGn+RQ/+5Ncq/h/vM5NOLYbsjD+6BNmVSLNdL0Xxpwy3RDr0emCYF0XoE Ho/Tmp7utfUZTHAfMsTyKsQ//dmTevOwImoPHwoj1oNqCuIRwj7N6N/DJYxAAY34Mxa/ 10Fw== X-Gm-Message-State: AMke39nUIpphiF/p0hYapGVerift4lBQHsCteViJpeQd3BDuDKrhFfg8BAv49rDUkBWpnowU X-Received: by 10.28.45.213 with SMTP id t204mr3053192wmt.113.1487948715896; Fri, 24 Feb 2017 07:05:15 -0800 (PST) Received: from localhost.localdomain ([105.149.201.216]) by smtp.gmail.com with ESMTPSA id w207sm2687048wmw.1.2017.02.24.07.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 07:05:15 -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 Cc: lersek@redhat.com, feng.tian@intel.com, star.zeng@intel.com, Ard Biesheuvel Date: Fri, 24 Feb 2017 15:04:58 +0000 Message-Id: <1487948699-3179-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487948699-3179-1-git-send-email-ard.biesheuvel@linaro.org> References: <1487948699-3179-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH v2 4/5] MdeModulePkg: define PCD for DXE memory protection policy 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: , X-List-Received-Date: Fri, 24 Feb 2017 15:05:18 -0000 Define a new fixed/patchable PCD that sets the DXE memory protection policy: its primary use is to define which memory types should have their executable permissions removed. Combined with the image protection policy, this can be used to implement a strict W^X policy, i.e.. a policy where no regions exist that are both executable and writable at the same time. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/MdeModulePkg.dec | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 426634fbbd4d..ea64cdf3772d 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1107,6 +1107,22 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] # @ValidRange 0x80000002 | 0x00000000 - 0x0000001F gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x00000002|UINT32|0x00001047 + ## Set DXE memory protection policy. The policy is bitwise. + # If a bit is set, memory regions of the associated type will be mapped + # non-executable.

+ # BIT0 - EfiLoaderData.
+ # - EfiBootServicesData.
+ # - EfiRuntimeServicesData.
+ # - EfiConventionalMemory.
+ # - EfiUnusableMemory.
+ # - EfiPersistentMemory.
+ # - EfiACPIReclaimMemory.
+ # BIT1 - EfiReservedMemoryType.
+ # BIT2 - EfiACPIMemoryNVS.
+ # @Prompt Set DXE memory protection policy. + # @ValidRange 0x80000002 | 0x00000000 - 0x00000007 + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeMemoryProtectionPolicy|0x0000007|UINT32|0x00001048 + ## PCI Serial Device Info. It is an array of Device, Function, and Power Management # information that describes the path that contains zero or more PCI to PCI briges # followed by a PCI serial device. Each array entry is 4-bytes in length. The -- 2.7.4