From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932704AbcGICJi (ORCPT ); Fri, 8 Jul 2016 22:09:38 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59472 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932868AbcGICIs (ORCPT ); Fri, 8 Jul 2016 22:08:48 -0400 From: Mitchel Humpherys To: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robin Murphy , Will Deacon , Marek Szyprowski Cc: Jordan Crouse , Jeremy Gebben , Patrick Daly , Pratik Patel , Mitchel Humpherys , linux-doc@vger.kernel.org Subject: [PATCH v2 4/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED_EXECUTABLE attribute Date: Fri, 8 Jul 2016 19:09:17 -0700 Message-Id: <20160709020919.6760-5-mitchelh@codeaurora.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160709020919.6760-1-mitchelh@codeaurora.org> References: <20160709020919.6760-1-mitchelh@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds the DMA_ATTR_PRIVILEGED_EXECUTABLE attribute to the DMA-mapping subsystem. Some architectures require that writable mappings also be non-executable at lesser-privileged levels of execution. This attribute is used to indicate to the DMA-mapping subsystem that it should do whatever is necessary to ensure that the buffer is executable at an elevated privilege level (by making it read-only at the lesser-privileged levels, for example). Cc: linux-doc@vger.kernel.org Signed-off-by: Mitchel Humpherys --- Documentation/DMA-attributes.txt | 9 +++++++++ include/linux/dma-attrs.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index e8cf9cf873b3..6a22d4307008 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt @@ -126,3 +126,12 @@ means that we won't try quite as hard to get them. NOTE: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM, though ARM64 patches will likely be posted soon. + +DMA_ATTR_PRIVILEGED_EXECUTABLE +------------------------------ + +Some architectures require that writable mappings also be non-executable at +lesser-privileged levels of execution. This attribute is used to indicate +to the DMA-mapping subsystem that it should do whatever is necessary to +ensure that the buffer is executable at an elevated privilege level (by +making it read-only at the lesser-privileged levels, for example). diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 5246239a4953..8cf4dff6185b 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h @@ -19,6 +19,7 @@ enum dma_attr { DMA_ATTR_SKIP_CPU_SYNC, DMA_ATTR_FORCE_CONTIGUOUS, DMA_ATTR_ALLOC_SINGLE_PAGES, + DMA_ATTR_PRIVILEGED_EXECUTABLE, DMA_ATTR_MAX, }; -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mitchel Humpherys Subject: [PATCH v2 4/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED_EXECUTABLE attribute Date: Fri, 8 Jul 2016 19:09:17 -0700 Message-ID: <20160709020919.6760-5-mitchelh@codeaurora.org> References: <20160709020919.6760-1-mitchelh@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160709020919.6760-1-mitchelh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Robin Murphy , Will Deacon , Marek Szyprowski Cc: linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jeremy Gebben , Patrick Daly , Jordan Crouse , Pratik Patel List-Id: iommu@lists.linux-foundation.org This patch adds the DMA_ATTR_PRIVILEGED_EXECUTABLE attribute to the DMA-mapping subsystem. Some architectures require that writable mappings also be non-executable at lesser-privileged levels of execution. This attribute is used to indicate to the DMA-mapping subsystem that it should do whatever is necessary to ensure that the buffer is executable at an elevated privilege level (by making it read-only at the lesser-privileged levels, for example). Cc: linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Signed-off-by: Mitchel Humpherys --- Documentation/DMA-attributes.txt | 9 +++++++++ include/linux/dma-attrs.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index e8cf9cf873b3..6a22d4307008 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt @@ -126,3 +126,12 @@ means that we won't try quite as hard to get them. NOTE: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM, though ARM64 patches will likely be posted soon. + +DMA_ATTR_PRIVILEGED_EXECUTABLE +------------------------------ + +Some architectures require that writable mappings also be non-executable at +lesser-privileged levels of execution. This attribute is used to indicate +to the DMA-mapping subsystem that it should do whatever is necessary to +ensure that the buffer is executable at an elevated privilege level (by +making it read-only at the lesser-privileged levels, for example). diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 5246239a4953..8cf4dff6185b 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h @@ -19,6 +19,7 @@ enum dma_attr { DMA_ATTR_SKIP_CPU_SYNC, DMA_ATTR_FORCE_CONTIGUOUS, DMA_ATTR_ALLOC_SINGLE_PAGES, + DMA_ATTR_PRIVILEGED_EXECUTABLE, DMA_ATTR_MAX, }; -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 From: mitchelh@codeaurora.org (Mitchel Humpherys) Date: Fri, 8 Jul 2016 19:09:17 -0700 Subject: [PATCH v2 4/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED_EXECUTABLE attribute In-Reply-To: <20160709020919.6760-1-mitchelh@codeaurora.org> References: <20160709020919.6760-1-mitchelh@codeaurora.org> Message-ID: <20160709020919.6760-5-mitchelh@codeaurora.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org This patch adds the DMA_ATTR_PRIVILEGED_EXECUTABLE attribute to the DMA-mapping subsystem. Some architectures require that writable mappings also be non-executable at lesser-privileged levels of execution. This attribute is used to indicate to the DMA-mapping subsystem that it should do whatever is necessary to ensure that the buffer is executable at an elevated privilege level (by making it read-only at the lesser-privileged levels, for example). Cc: linux-doc at vger.kernel.org Signed-off-by: Mitchel Humpherys --- Documentation/DMA-attributes.txt | 9 +++++++++ include/linux/dma-attrs.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index e8cf9cf873b3..6a22d4307008 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt @@ -126,3 +126,12 @@ means that we won't try quite as hard to get them. NOTE: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM, though ARM64 patches will likely be posted soon. + +DMA_ATTR_PRIVILEGED_EXECUTABLE +------------------------------ + +Some architectures require that writable mappings also be non-executable at +lesser-privileged levels of execution. This attribute is used to indicate +to the DMA-mapping subsystem that it should do whatever is necessary to +ensure that the buffer is executable at an elevated privilege level (by +making it read-only at the lesser-privileged levels, for example). diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 5246239a4953..8cf4dff6185b 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h @@ -19,6 +19,7 @@ enum dma_attr { DMA_ATTR_SKIP_CPU_SYNC, DMA_ATTR_FORCE_CONTIGUOUS, DMA_ATTR_ALLOC_SINGLE_PAGES, + DMA_ATTR_PRIVILEGED_EXECUTABLE, DMA_ATTR_MAX, }; -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project