From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C008C67839 for ; Fri, 14 Dec 2018 09:55:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBF0520879 for ; Fri, 14 Dec 2018 09:55:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBF0520879 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-parisc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728269AbeLNJzn (ORCPT ); Fri, 14 Dec 2018 04:55:43 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:43553 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726494AbeLNJzl (ORCPT ); Fri, 14 Dec 2018 04:55:41 -0500 Received: by mail-vs1-f68.google.com with SMTP id x1so2997489vsc.10; Fri, 14 Dec 2018 01:55:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ThuXCDpz5CSLhhjoqBknKNp1QrnaV9y+p8Qap5dUeXs=; b=OmMKWXF9bV5yc9PSoa2IVbjqcgwKvzo+67onrcfPDnsJmoRdau6VE0Ulla2M9APmHP l/3NgaXMMo15BNW0rbfjzb4WZ5lcNFIDOz68Te/kxbtYjL7mB2xTgrgOR2bcMpdalVmK kY/DSg6zvUcPuV8g5KVcivjxqfhfMg9m88l12u/dNsL+VRmDTfLPseb4xCvQy6sPNuRE b4BtWdk+b09hUEaSEDLZligvc13mLnWfBPN/hnEl3ivJp/3JD3ALw1SHm0hGo+ATv7B7 NXpXjZ9ArkucY/PdRCZHoRMyiMxQmn9SHBmOOIxuHOhHzzhQ1OaAljrJwfa6VOD8H1S2 x6Ag== X-Gm-Message-State: AA+aEWayWHN0omDkbzsH/jqoBwWF7kVNT9yLgyFxtJVGpPZnp8mlV4vC djyJyEkgcxys5g2WlR5zlEotikEBIzEz5dhHM8A= X-Google-Smtp-Source: AFSGD/V3n/1TM+2yf4bgAfeH10M3EAUX09H19VWC7w1ulSBQvf8Trtj1/fBaKWP6qMPLPi5zwjqKKm4ZDeSXJk26JLs= X-Received: by 2002:a67:6002:: with SMTP id u2mr980067vsb.115.1544781340192; Fri, 14 Dec 2018 01:55:40 -0800 (PST) MIME-Version: 1.0 References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 14 Dec 2018 10:55:27 +0100 Message-ID: Subject: Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* To: Christoph Hellwig Cc: Linux IOMMU , Michal Simek , ashutosh.dixit@intel.com, alpha , arcml , linux-c6x-dev@linux-c6x.org, linux-m68k , Openrisc , Parisc List , linux-s390 , sparclinux , linux-xtensa@linux-xtensa.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common architectures, but some architectures don't do this > > yet, fix them up, either by passing GFP_ZERO when we use the normal page > > allocator or doing a manual memset otherwise. > > > > Signed-off-by: Christoph Hellwig > > Thanks for your patch! > > > --- a/arch/m68k/kernel/dma.c > > +++ b/arch/m68k/kernel/dma.c > > @@ -32,7 +32,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > > size = PAGE_ALIGN(size); > > order = get_order(size); > > > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() and > does an explicit memset(). As __get_free_pages() calls alloc_pages(), perhaps > it makes sense to replace the memset() by GFP_ZERO, to increase consistency? Regardless, for m68k: Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Fri, 14 Dec 2018 09:55:27 +0000 Subject: Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Message-Id: List-Id: References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christoph Hellwig Cc: linux-s390 , Michal Simek , linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, Parisc List , linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org, linux-m68k , Linux Kernel Mailing List , ashutosh.dixit-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, Linux IOMMU , Openrisc , alpha , sparclinux , arcml On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common architectures, but some architectures don't do this > > yet, fix them up, either by passing GFP_ZERO when we use the normal page > > allocator or doing a manual memset otherwise. > > > > Signed-off-by: Christoph Hellwig > > Thanks for your patch! > > > --- a/arch/m68k/kernel/dma.c > > +++ b/arch/m68k/kernel/dma.c > > @@ -32,7 +32,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > > size = PAGE_ALIGN(size); > > order = get_order(size); > > > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() and > does an explicit memset(). As __get_free_pages() calls alloc_pages(), perhaps > it makes sense to replace the memset() by GFP_ZERO, to increase consistency? Regardless, for m68k: Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: geert@linux-m68k.org (Geert Uytterhoeven) Date: Fri, 14 Dec 2018 10:55:27 +0100 Subject: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* In-Reply-To: References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> List-ID: Message-ID: To: linux-snps-arc@lists.infradead.org On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018@9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common architectures, but some architectures don't do this > > yet, fix them up, either by passing GFP_ZERO when we use the normal page > > allocator or doing a manual memset otherwise. > > > > Signed-off-by: Christoph Hellwig > > Thanks for your patch! > > > --- a/arch/m68k/kernel/dma.c > > +++ b/arch/m68k/kernel/dma.c > > @@ -32,7 +32,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > > size = PAGE_ALIGN(size); > > order = get_order(size); > > > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() and > does an explicit memset(). As __get_free_pages() calls alloc_pages(), perhaps > it makes sense to replace the memset() by GFP_ZERO, to increase consistency? Regardless, for m68k: Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* Date: Fri, 14 Dec 2018 10:55:27 +0100 Message-ID: References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Id: 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: Christoph Hellwig Cc: linux-s390 , Michal Simek , linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, Parisc List , linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org, linux-m68k , Linux Kernel Mailing List , ashutosh.dixit-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, Linux IOMMU , Openrisc , alpha , sparclinux , arcml On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common architectures, but some architectures don't do this > > yet, fix them up, either by passing GFP_ZERO when we use the normal page > > allocator or doing a manual memset otherwise. > > > > Signed-off-by: Christoph Hellwig > > Thanks for your patch! > > > --- a/arch/m68k/kernel/dma.c > > +++ b/arch/m68k/kernel/dma.c > > @@ -32,7 +32,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > > size = PAGE_ALIGN(size); > > order = get_order(size); > > > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() and > does an explicit memset(). As __get_free_pages() calls alloc_pages(), perhaps > it makes sense to replace the memset() by GFP_ZERO, to increase consistency? Regardless, for m68k: Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Date: Fri, 14 Dec 2018 10:55:27 +0100 Subject: [OpenRISC] [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_* In-Reply-To: References: <20181214082515.14835-1-hch@lst.de> <20181214082515.14835-2-hch@lst.de> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > > this on most common architectures, but some architectures don't do this > > yet, fix them up, either by passing GFP_ZERO when we use the normal page > > allocator or doing a manual memset otherwise. > > > > Signed-off-by: Christoph Hellwig > > Thanks for your patch! > > > --- a/arch/m68k/kernel/dma.c > > +++ b/arch/m68k/kernel/dma.c > > @@ -32,7 +32,7 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, > > size = PAGE_ALIGN(size); > > order = get_order(size); > > > > - page = alloc_pages(flag, order); > > + page = alloc_pages(flag | GFP_ZERO, order); > > if (!page) > > return NULL; > > There's second implementation below, which calls __get_free_pages() and > does an explicit memset(). As __get_free_pages() calls alloc_pages(), perhaps > it makes sense to replace the memset() by GFP_ZERO, to increase consistency? Regardless, for m68k: Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds