From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A10A178042A for ; Tue, 12 Sep 2023 09:07:22 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Zn/kvd2sXUP1IcSyWPfEAdVeAY+98j/3bMvtk034IOE=; c=relaxed/simple; d=groups.io; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1694509641; v=1; b=FmL6rwRhjfOyTGgll65GqNK4bd7flvZGAHXevNI2nREHcdPs1IKC3l3XfDJsMbJKY+nQ0xhR ZIqxAiCwf/DMusRFXxTL2Guolbb31SK+YZEkcqSRozXCxM9sMcyEPqoLjIXFSXKVml3hyOfAF5W JPeb/bYxYtuXLjCBhFI9lmiY= X-Received: by 127.0.0.2 with SMTP id kAIdYY7687511xsWcGFTGNsk; Tue, 12 Sep 2023 02:07:21 -0700 X-Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by mx.groups.io with SMTP id smtpd.web11.20060.1694504555839915332 for ; Tue, 12 Sep 2023 00:42:36 -0700 X-Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-3f42bcef2acso42058685e9.2 for ; Tue, 12 Sep 2023 00:42:35 -0700 (PDT) X-Gm-Message-State: Li3yWGSypB1K1Z8tvHDBI7Axx7686176AA= X-Google-Smtp-Source: AGHT+IEilWYtavwDNBzEvcMAiVp1xN2ybY/zPZlLM6gm8JcwshOTulKBmkVYv6Gd4zCouVaAftA5sbgK X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a7b:c8d1:0:b0:3fb:b8c7:c788 with SMTP id f17-20020a7bc8d1000000b003fbb8c7c788mr197051wml.5.1694504553908; Tue, 12 Sep 2023 00:42:33 -0700 (PDT) Date: Tue, 12 Sep 2023 07:42:30 +0000 Mime-Version: 1.0 Message-ID: <20230912074230.3980611-1-ardb@google.com> Subject: [edk2-devel] [PATCH] ArmPkg/ArmMmuLib: Drop buggy secure memory type check From: "Ard Biesheuvel via groups.io" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, Ard Biesheuvel , Jake Garver Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@google.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=FmL6rwRh; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ard Biesheuvel Jake reports that the IS_ARM_MEMORY_REGION_ATTRIBUTES_SECURE() macro is no longer accurate since commit 852227a9d52e3cb9 ("ArmPkg/Mmu: Remove handling of NONSECURE memory regions"). Fortunately, it only affects the NS bit in level 1 short descriptors, which is ignored when executing in non-secure mode. And given that running UEFI in the secure world is not a use case we aim to support, let's just drop this logic altogether. Reported-by: Jake Garver Signed-off-by: Ard Biesheuvel --- ArmPkg/Include/Library/ArmLib.h | 2 -- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h index fb1ae57b3522..6c5315d7f45f 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -45,8 +45,6 @@ typedef enum { ARM_MEMORY_REGION_ATTRIBUTE_DEVICE, } ARM_MEMORY_REGION_ATTRIBUTES; -#define IS_ARM_MEMORY_REGION_ATTRIBUTES_SECURE(attr) ((UINT32)(attr) & 1) - typedef struct { EFI_PHYSICAL_ADDRESS PhysicalBase; EFI_VIRTUAL_ADDRESS VirtualBase; diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 00c5f42cd91a..28e4cd9f1a77 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -169,7 +169,6 @@ PopulateLevel2PageTable ( // Overwrite the section entry to point to the new Level2 Translation Table *SectionEntry = (TranslationTable & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK) | - (IS_ARM_MEMORY_REGION_ATTRIBUTES_SECURE (Attributes) ? (1 << 3) : 0) | TT_DESCRIPTOR_SECTION_TYPE_PAGE_TABLE; } else { // We do not support the other section type (16MB Section) @@ -192,7 +191,6 @@ PopulateLevel2PageTable ( ZeroMem ((VOID *)TranslationTable, TRANSLATION_TABLE_PAGE_SIZE); *SectionEntry = (TranslationTable & TT_DESCRIPTOR_SECTION_PAGETABLE_ADDRESS_MASK) | - (IS_ARM_MEMORY_REGION_ATTRIBUTES_SECURE (Attributes) ? (1 << 3) : 0) | TT_DESCRIPTOR_SECTION_TYPE_PAGE_TABLE; } -- 2.42.0.283.g2d96d420d3-goog -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108522): https://edk2.groups.io/g/devel/message/108522 Mute This Topic: https://groups.io/mt/101311374/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-