From nobody Sat Nov 2 14:35:59 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 1488385926993444.0092973109438; Wed, 1 Mar 2017 08:32:06 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E36DE821E0; Wed, 1 Mar 2017 08:31:59 -0800 (PST) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 1238A821DF for ; Wed, 1 Mar 2017 08:31:59 -0800 (PST) Received: by mail-wm0-x234.google.com with SMTP id v186so114699748wmd.0 for ; Wed, 01 Mar 2017 08:31:59 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id 11sm7275292wrb.10.2017.03.01.08.31.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Mar 2017 08:31:56 -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=fcoPYGDZW1eh3Su3cCDfh0ExnK0mhtSmuisbusR7zIc=; b=av+33MgrMB09juEz3yXUkaqkChtfetHTu8peqWZqAmk98sFEfNyv/CAo+xBk9GmnDz hsCZlwy+ynW6vzmpUGr4CxpbP9Pa5Qm6PFqbGv3B+X9hEa3ZZo8yH+CurfYVoa3lOGhZ SUkzdrP7bFk3PAmCMb+wXx5IaEzOuWXF4Li9g= 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=fcoPYGDZW1eh3Su3cCDfh0ExnK0mhtSmuisbusR7zIc=; b=cKSC7NgozdWGY5Unt49QdxSiKlor0/mKoFeScjkzHdze/J6dJQWMqIs3HkmtTIwVfG VgEzxlxBVLjmS0oj3uWPz3fuUwur1xZuKyucg8yXBjWVFpnCTzhUaop1TP29uIcyVjrA loymj2xMgOnh83h5WTn7mLDMjWIYToZGVGtdtrtuRBmVvxZQc/XKmwVIl5gqCYg54dDp rZnV1XqosA+qWY7l4gk4MPslh795urvItszRlvjua4BMWnRCHJQne+9b7bB7POyW4rFg CX3lDJIQPZei7GNioymv6lZMNvLDOEyQRM/UCbn0M8WK7nkwEJIBoMfGOLU/Y6uOCvkR Xlqg== X-Gm-Message-State: AMke39kN/3Mpheq64M1uYScygTtr8eTogrTXjc7oMn8nZj1QfA0tSrOInrglSinGSZ2aUYr6 X-Received: by 10.28.109.214 with SMTP id b83mr4155916wmi.21.1488385917612; Wed, 01 Mar 2017 08:31:57 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Date: Wed, 1 Mar 2017 16:31:42 +0000 Message-Id: <1488385903-30267-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488385903-30267-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488385903-30267-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 4/5] ArmPkg/ArmMmuLib ARM: implement memory permission control routines 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: 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" Now that we have the prerequisite functionality available in ArmMmuLib, wire it up into ArmSetMemoryRegionNoExec, ArmClearMemoryRegionNoExec, ArmSetMemoryRegionReadOnly and ArmClearMemoryRegionReadOnly. This is used by the non-executable stack feature that is configured by DxeIpl. NOTE: The current implementation will not combine RO and XP attributes, i.e., setting/clearing a region no-exec will unconditionally clear the read-only attribute, and vice versa. Currently, we only use ArmSetMemoryRegionNoExec(), so for now, we should be able to live with this. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/= ArmMmuLib/Arm/ArmMmuLibCore.c index 1112660b434e..55601328d93e 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -761,40 +761,40 @@ ArmSetMemoryAttributes ( return Status; } =20 -RETURN_STATUS +EFI_STATUS ArmSetMemoryRegionNoExec ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length ) { - return RETURN_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_XP); } =20 -RETURN_STATUS +EFI_STATUS ArmClearMemoryRegionNoExec ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length ) { - return RETURN_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, 0); } =20 -RETURN_STATUS +EFI_STATUS ArmSetMemoryRegionReadOnly ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length ) { - return RETURN_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_RO); } =20 -RETURN_STATUS +EFI_STATUS ArmClearMemoryRegionReadOnly ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length ) { - return RETURN_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, 0); } =20 RETURN_STATUS --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel