From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::241; helo=mail-io0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (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 0784B21B00DC1 for ; Thu, 16 Nov 2017 01:20:45 -0800 (PST) Received: by mail-io0-x241.google.com with SMTP id n79so4584463ion.3 for ; Thu, 16 Nov 2017 01:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=z6DRycyXkB1qEuAjvCdsDPqNa8AUGI1OgvRx8hgayKI=; b=CjINbto1IbrEfOHhm2n8anJFYbYMqV582OjmPopigl4HgJWpeiUGP1Ohnw1FwhXXsS 5pNbAeAEkzCZpgEJAqjHHDbMg8KzxL9el7PqDDxmc7M3AJ4Va8Zw4UkRjJUOxqOPpSPc a0KKrGvP9CHeYkTRRk7tIpLPLwvOA7kACBA6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=z6DRycyXkB1qEuAjvCdsDPqNa8AUGI1OgvRx8hgayKI=; b=LfOagY1m/jNrizHu8xKNnzeWlRyOOYodmzflvTQ+lEX9V+K3RqvGdumBGpClg68XN6 XvxpDFgG9nxXNzeQ2QM5Ac+L6oWs6ruZjoo4nJ88DJq1I48YbwReqePGsNT/QXuFDZsY EUx0wtErWvrLH3QfDaYtfDNepfu5YpDXsZrXgPAWaPjFomiN1tEbdKqGOwZ24h4qrfj/ QwBMZJA7yEg3EOk36yhaHLOKd1+kCD9njdPAi6eNueQ64ZJiu140bhxFvM2L+bz2gAaZ T36A8nnTBJKAV2Udxv83b9wa2VOCI6f2C8S1tEVelj0SwLin8l0tv6cSZeBS9jgy9wB9 EMLw== X-Gm-Message-State: AJaThX7xGqv6QSgQWQTrUIHnJmgtoSyPdvDE7eLm/5ntARnVro1ZOPuK DPohneKsiBTezE7UWP3bMyN2eu5yk/OWtqg4RBIDdA== X-Google-Smtp-Source: AGs4zMYwrTAe6QcRrOv6xJqkUDpQc2bSv9BBUu14k66aENcIIaQvz66uhQUfOQbMMcVaveVLH24NBmVA6cpx0/xxGqI= X-Received: by 10.107.2.137 with SMTP id 131mr1041897ioc.186.1510824294535; Thu, 16 Nov 2017 01:24:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.104.3 with HTTP; Thu, 16 Nov 2017 01:24:54 -0800 (PST) In-Reply-To: <20171116072700.11456-2-jian.j.wang@intel.com> References: <20171116072700.11456-1-jian.j.wang@intel.com> <20171116072700.11456-2-jian.j.wang@intel.com> From: Ard Biesheuvel Date: Thu, 16 Nov 2017 09:24:54 +0000 Message-ID: To: Jian J Wang Cc: "edk2-devel@lists.01.org" , Jiewen Yao , Star Zeng , Laszlo Ersek Subject: Re: [PATCH v6 1/2] MdeModulePkg/DxeCore: Filter out all paging capabilities X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Nov 2017 09:20:46 -0000 Content-Type: text/plain; charset="UTF-8" On 16 November 2017 at 07:26, Jian J Wang wrote: > Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really > set attributes and change memory paging attribute accordingly. > But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by > value from Capabilities in GCD memory map. This might cause > boot problems. Clearing all paging related capabilities can > workaround it. The code added in this patch is supposed to > be removed once the usage of EFI_MEMORY_DESCRIPTOR.Attribute > is clarified in UEFI spec and adopted by both EDK-II Core and > all supported OSs. > > Cc: Jiewen Yao > Cc: Star Zeng > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > MdeModulePkg/Core/Dxe/Mem/Page.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c > index c9219cc068..783b576e35 100644 > --- a/MdeModulePkg/Core/Dxe/Mem/Page.c > +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c > @@ -1829,6 +1829,23 @@ CoreGetMemoryMap ( > // > BufferSize = ((UINT8 *)MemoryMap - (UINT8 *)MemoryMapStart); > > + // > + // WORKAROUND: Some OSs will treat EFI_MEMORY_DESCRIPTOR.Attribute as really > + // set attributes and change memory paging attribute accordingly. > + // But current EFI_MEMORY_DESCRIPTOR.Attribute is assigned by > + // value from Capabilities in GCD memory map. This might cause > + // boot problems. Clearing all paging related capabilities can > + // workaround it. Following code is supposed to be removed once > + // the usage of EFI_MEMORY_DESCRIPTOR.Attribute is clarified in > + // UEFI spec and adopted by both EDK-II Core and all supported > + // OSs. > + // > + while (MemoryMapStart < MemoryMap) { > + MemoryMapStart->Attribute &= ~(UINT64)(EFI_MEMORY_RP | EFI_MEMORY_RO | > + EFI_MEMORY_XP); Why is EFI_MEMORY_WP missing here? > + MemoryMapStart = NEXT_MEMORY_DESCRIPTOR(MemoryMapStart, Size); > + } > + > Status = EFI_SUCCESS; > > Done: > -- > 2.14.1.windows.1 >