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:19:56 +0100 Message-ID: <771c5511-c5ab-3dd1-d938-5dbc40396daa@de.ibm.com> References: <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> <6844ea47-8e0e-4fb7-d86f-68046995a749@de.ibm.com> <20200129170939.GA4277@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200129170939.GA4277@infradead.org> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Christoph Hellwig Cc: Christopher Lameter , Kees Cook , 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 , "David S. Miller" , Laura Abbott , Mark Rutland , "Martin K. Petersen" , Paolo Bonzini List-Id: linux-arch.vger.kernel.org On 29.01.20 18:09, Christoph Hellwig wrote: > On Wed, Jan 29, 2020 at 06:07:14PM +0100, Christian Borntraeger wrote: >>> 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). > > The normal way to allocate memory with addressing limits would be to > use dma_alloc_coherent and friends. Any chance to switch iucv over to > that? Or is there no device associated with it? There is not necessarily a device for that. It is a hypervisor interface (an instruction that is interpreted by z/VM). We do have the netiucv driver that creates a virtual nic, but there is also AF_IUCV which works without a device. But back to the original question: If we mark kmalloc caches as usercopy caches, we should do the same for DMA kmalloc caches. As outlined by Christoph, this has nothing to do with device DMA. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:4798 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgA2RUN (ORCPT ); Wed, 29 Jan 2020 12:20:13 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00THJdcL054083 for ; Wed, 29 Jan 2020 12:20:12 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xrvw94eu7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 29 Jan 2020 12:20:11 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Jan 2020 17:20:06 -0000 Subject: Re: [kernel-hardening] [PATCH 09/38] usercopy: Mark kmalloc caches as usercopy caches References: <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> <6844ea47-8e0e-4fb7-d86f-68046995a749@de.ibm.com> <20200129170939.GA4277@infradead.org> From: Christian Borntraeger Date: Wed, 29 Jan 2020 18:19:56 +0100 MIME-Version: 1.0 In-Reply-To: <20200129170939.GA4277@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Message-ID: <771c5511-c5ab-3dd1-d938-5dbc40396daa@de.ibm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Christoph Hellwig Cc: Christopher Lameter , Kees Cook , 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 , "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 Message-ID: <20200129171956.ONF-qTBqh9M9Ts_E7ZX264olpCKNXOsGjCC7UcOlVbk@z> On 29.01.20 18:09, Christoph Hellwig wrote: > On Wed, Jan 29, 2020 at 06:07:14PM +0100, Christian Borntraeger wrote: >>> 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). > > The normal way to allocate memory with addressing limits would be to > use dma_alloc_coherent and friends. Any chance to switch iucv over to > that? Or is there no device associated with it? There is not necessarily a device for that. It is a hypervisor interface (an instruction that is interpreted by z/VM). We do have the netiucv driver that creates a virtual nic, but there is also AF_IUCV which works without a device. But back to the original question: If we mark kmalloc caches as usercopy caches, we should do the same for DMA kmalloc caches. As outlined by Christoph, this has nothing to do with device DMA.