From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [kernel-hardening] [PATCH 09/38] usercopy: Mark kmalloc caches as usercopy caches Date: Wed, 29 Jan 2020 18:07:14 +0100 Message-ID: <6844ea47-8e0e-4fb7-d86f-68046995a749@de.ibm.com> References: <1515636190-24061-1-git-send-email-keescook@chromium.org> <1515636190-24061-10-git-send-email-keescook@chromium.org> <9519edb7-456a-a2fa-659e-3e5a1ff89466@suse.cz> <201911121313.1097D6EE@keescook> <201911141327.4DE6510@keescook> <202001271519.AA6ADEACF0@keescook> <5861936c-1fe1-4c44-d012-26efa0c8b6e7@de.ibm.com> <202001281457.FA11CC313A@keescook> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Christopher Lameter , Kees Cook Cc: Jiri Slaby , Julian Wiedmann , Ursula Braun , Alexander Viro , linux-kernel@vger.kernel.org, David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-xfs@vger.kernel.org, Linus Torvalds , Andy Lutomirski , Christoph Hellwig , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christoffer Dall List-Id: linux-arch.vger.kernel.org On 29.01.20 17:43, Christopher Lameter wrote: > On Tue, 28 Jan 2020, Kees Cook wrote: > >>> On the other hand not marking the DMA caches still seems questionable. >> >> My understanding is that exposing DMA memory to userspace copies can >> lead to unexpected results, especially for misbehaving hardware, so I'm >> not convinced this is a generically bad hardening choice. > > "DMA" memory (and thus DMA caches) have nothing to do with DMA. Its a > legacy term. "DMA Memory" is memory limited to a certain > physical address boundary (old restrictions on certain devices only > supporting a limited number of address bits). > > DMA can be done to NORMAL memory as well. Exactly. I think iucv uses GFP_DMA because z/VM needs those buffers to reside below 2GB (which is ZONA_DMA for s390). From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [kernel-hardening] [PATCH 09/38] usercopy: Mark kmalloc caches as usercopy caches References: <1515636190-24061-1-git-send-email-keescook@chromium.org> <1515636190-24061-10-git-send-email-keescook@chromium.org> <9519edb7-456a-a2fa-659e-3e5a1ff89466@suse.cz> <201911121313.1097D6EE@keescook> <201911141327.4DE6510@keescook> <202001271519.AA6ADEACF0@keescook> <5861936c-1fe1-4c44-d012-26efa0c8b6e7@de.ibm.com> <202001281457.FA11CC313A@keescook> From: Christian Borntraeger Date: Wed, 29 Jan 2020 18:07:14 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Message-ID: <6844ea47-8e0e-4fb7-d86f-68046995a749@de.ibm.com> Sender: owner-linux-mm@kvack.org To: Christopher Lameter , Kees Cook Cc: Jiri Slaby , Julian Wiedmann , Ursula Braun , Alexander Viro , linux-kernel@vger.kernel.org, David Windsor , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-xfs@vger.kernel.org, Linus Torvalds , Andy Lutomirski , Christoph Hellwig , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini , Christoffer Dall , Dave Kleikamp , Jan Kara , Luis de Bethencourt , Marc Zyngier , Rik van Riel , Matthew Garrett , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, Vlastimil Babka , Michal Kubecek List-ID: Message-ID: <20200129170714.H58N13ZWCNFEJU0-_a4tCMABByaNx-GWqq7lkAfvd90@z> On 29.01.20 17:43, Christopher Lameter wrote: > On Tue, 28 Jan 2020, Kees Cook wrote: > >>> On the other hand not marking the DMA caches still seems questionable. >> >> My understanding is that exposing DMA memory to userspace copies can >> lead to unexpected results, especially for misbehaving hardware, so I'm >> not convinced this is a generically bad hardening choice. > > "DMA" memory (and thus DMA caches) have nothing to do with DMA. Its a > legacy term. "DMA Memory" is memory limited to a certain > physical address boundary (old restrictions on certain devices only > supporting a limited number of address bits). > > DMA can be done to NORMAL memory as well. Exactly. I think iucv uses GFP_DMA because z/VM needs those buffers to reside below 2GB (which is ZONA_DMA for s390).