From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (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 1545E8034D for ; Tue, 7 Mar 2017 08:49:59 -0800 (PST) Received: by mail-wm0-x22c.google.com with SMTP id 196so25490208wmm.1 for ; Tue, 07 Mar 2017 08:49:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uDyP/Vu3ht43JEIOpZAroe+PK2g3xZoef8LLnte4sEU=; b=YlEfFvBpqwny9l9Wc343r7JgZd+I9CVrXJcAVAShvL4M+Sbh5QezxaAIGmcp72Ini4 GVjzfZbAVkoV/Aj9LFMiu+359rBSqpOocRaZJZhde8TwONUpBgIKDK+3+XqzHdbRQYLg Js1mc3zoaXYTMVVkM5/+FxEqoJjbBj0LXcoe4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uDyP/Vu3ht43JEIOpZAroe+PK2g3xZoef8LLnte4sEU=; b=PcVPd3yzalKFXb5BQiCpaVcNf6GjcmlQ5aH8fK525Xza7mdT/s+iPkpGxbPGzjYRbt Qhe31/+wrwTy9SCmE1IEYHHPmimaoYBMg2oa33i7W+ZgzrRZEog80yC6gPtTtnomwRdr RGKKGGaCC+bLJfkCZQtXBIM7AF7YZn2neUAiQOSL5bQYxAkokeaTKNii3pAxDYilJORZ BABn626ARzj3PPaA9VgIO4Ay4GgMk/MSxcXsssc6Hl3IxEM94T8LBedy9jaf80J2DFPE v70VYA8L0bqVY0dKhLPwi6TOI8jToBEmys80rqKr4oTZGKd7KFgNIrg0oNElG+xOs8PL XQfg== X-Gm-Message-State: AMke39nYAVQWb+EGmdAciFGYPeF06QrHAhoGR8fXCA+slBKvttfxQXC5OxWKx1cMisBnGBnu X-Received: by 10.28.142.73 with SMTP id q70mr1789007wmd.3.1488905397747; Tue, 07 Mar 2017 08:49:57 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id c9sm1228519wmf.18.2017.03.07.08.49.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 08:49:57 -0800 (PST) Date: Tue, 7 Mar 2017 16:49:55 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org Message-ID: <20170307164955.GW16034@bivouac.eciton.net> References: <1488283992-32104-1-git-send-email-ard.biesheuvel@linaro.org> <1488283992-32104-3-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1488283992-32104-3-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH 3/3] ArmPkg/UncachedMemoryAllocationLib: map uncached allocations non-executable 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: Tue, 07 Mar 2017 16:49:59 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 28, 2017 at 12:13:12PM +0000, Ard Biesheuvel wrote: > The primary use case for UncachedMemoryAllocationLib is non-coherent DMA, > which implies that such regions are not used to fetch instructions from. > > So let's map them as non-executable, to avoid creating a security hole > when the rest of the platform may be enforcing strict memory permissions > on ordinary allocations. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm > --- > ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c > index 0d8abad23433..b4fbfbcb362b 100644 > --- a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c > +++ b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c > @@ -154,7 +154,8 @@ AllocatePagesFromList ( > return Status; > } > > - Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages), EFI_MEMORY_WC); > + Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages), > + EFI_MEMORY_WC | EFI_MEMORY_XP); > if (EFI_ERROR (Status)) { > gBS->FreePages (Memory, Pages); > return Status; > -- > 2.7.4 >