From nobody Sat Nov 2 14:38:11 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 1488876144747228.23944337662056; Tue, 7 Mar 2017 00:42:24 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0A0DA80354; Tue, 7 Mar 2017 00:42:18 -0800 (PST) Received: from mail-wr0-x22e.google.com (mail-wr0-x22e.google.com [IPv6:2a00:1450:400c:c0c::22e]) (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 E8EB580350 for ; Tue, 7 Mar 2017 00:42:15 -0800 (PST) Received: by mail-wr0-x22e.google.com with SMTP id l37so133865339wrc.1 for ; Tue, 07 Mar 2017 00:42:15 -0800 (PST) Received: from ards-macbook-pro.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id u41sm30097838wrc.24.2017.03.07.00.42.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Mar 2017 00:42:13 -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=ZJpVYrph+YZLStcGlcNs07zqB4hj07Q8mNmuYD796W8=; b=eRm+eQADcjAg/LrRaJEG/9k4ryGmTlJ9LHGXNNmqrgaTX/ZNK9XKP6H9H96ULz7UOX LC/pCVQ3L+L6zl+B6zcb7O2IEeCWHgOZpEcx+tFpJGQxfBMW6uqZYrXWScULn8fhaXAJ DrOvoE+qQeu0ifJTPkT/GV+sAkIcdUnM1nW0s= 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=ZJpVYrph+YZLStcGlcNs07zqB4hj07Q8mNmuYD796W8=; b=Y0J9GIfo87lqH0/iLWSW9dpaARpS+rMAZSQfah6x3/OhrS4G+cbFgDyN1tFJHaFLsI 3yl5XehZ51wUjckAHF7ACWGGol+xYAovBm5qHjdxBQN4GY9Dv8Yfmwl+TJOn2Fj9B8Xs LZrPEGSI59gC0x0UyP/lRUUiENBRG7ksk1d9L/Ul3y/AfwppyEcHHIDVVQd6I+rjwqmY tWxeUAo91445KlgOaHF8x21dXd/ibkKdltGE++OaM3VRDa2d0beEfQJdNW3eQBuu0u17 73+QYp+UT0MAk0O/QtSeLaD9pO1PexQuiL8u8BpyhUYfA9CFkNuuc9cozN28e4WfPEuV GEmQ== X-Gm-Message-State: AMke39my4upxfepbod2pN/IImrXTQmyBV2QTWBxbSA/B+kRql1UK/sQtmbcCDCCh8WSEjCyy X-Received: by 10.223.129.74 with SMTP id 68mr16764949wrm.183.1488876134573; Tue, 07 Mar 2017 00:42:14 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Tue, 7 Mar 2017 09:42:04 +0100 Message-Id: <1488876125-24396-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488876125-24396-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488876125-24396-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 3/4] 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: lersek@redhat.com, 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 Reviewed-by: Leif Lindholm --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/= ArmMmuLib/Arm/ArmMmuLibCore.c index 351b6c03a42c..b02f6d7fc590 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -37,6 +37,8 @@ #define ID_MMFR0_SHR_IMP_HW_COHERENT 1 #define ID_MMFR0_SHR_IGNORED 0xf =20 +#define __EFI_MEMORY_RWX 0 // no restrictions + #define CACHE_ATTRIBUTE_MASK (EFI_MEMORY_UC | \ EFI_MEMORY_WC | \ EFI_MEMORY_WT | \ @@ -797,7 +799,7 @@ ArmSetMemoryRegionNoExec ( IN UINT64 Length ) { - return EFI_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_XP); } =20 EFI_STATUS @@ -806,7 +808,7 @@ ArmClearMemoryRegionNoExec ( IN UINT64 Length ) { - return EFI_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, __EFI_MEMORY_RWX); } =20 EFI_STATUS @@ -815,7 +817,7 @@ ArmSetMemoryRegionReadOnly ( IN UINT64 Length ) { - return EFI_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, EFI_MEMORY_RO); } =20 EFI_STATUS @@ -824,7 +826,7 @@ ArmClearMemoryRegionReadOnly ( IN UINT64 Length ) { - return EFI_UNSUPPORTED; + return ArmSetMemoryAttributes (BaseAddress, Length, __EFI_MEMORY_RWX); } =20 RETURN_STATUS --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel