Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1871147imu; Fri, 14 Dec 2018 01:57:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7Hy7NgU9gysDT13yXBclvUq25sg3O3HwZa4SftITVRyDyelymIQMsCvbGklGKzOnDZ2bH X-Received: by 2002:aa7:8549:: with SMTP id y9mr2220037pfn.83.1544781421981; Fri, 14 Dec 2018 01:57:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544781421; cv=none; d=google.com; s=arc-20160816; b=JUiSGBgEgzSpRRrr/r6EyydIvj6mOv1v1TYE/kex8RRsPzBNzteli00hlgTXl3prLh TiQ00Nvq1kmftXXqb51EzfLnsbulur+NahqGPDgtpLgpIwuzqjb2TJltNpihm7CbAi+1 h3gcG4kTBjS6l9oTSn9sxNim6Kv5wmdthjDW+8mzthFtui3yAmtkhiF3oueId2X3X8kj Q+xB9yNqGfX2UgxLzJXLst1Vdr3oxNVoL50Ow/G64LIMiTxxIcHHLmy3oNlo2yG9ZaQw E6+fV7uhr05orewUQWUkz4KTM3qruwI6Su2VUDW0SNmA+qEvf4xmpoGcb5bUQFibDS4/ vB5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ThuXCDpz5CSLhhjoqBknKNp1QrnaV9y+p8Qap5dUeXs=; b=QKbRye5eyTAhJt/owAnqeKxtHyC6Bj3cL4dVTKBvpu6PdDtuyNYg5Mh5YDgVsEPHV1 08NSuOo7dlr6FYyyUsEPmWMyfRFlV+2HYOYaTlpbHb6AD53cbMfT+jhvRkv7tduLEFeK b0J04IECCHR2PoBuqqPdexx9I3y1J3ffQ7jyJliyMXPFinsx4KSulv+1oRprfAdQiyo6 RrbPkQHfLtuWIbzHBjtFZ1NkOyEw2cI9AAUNhbw4zNij47Gn+cm4WbIYw9N045dkWeUh qAao13IBVnvbRuQWyJ4wsIYSFehfKVikzjhBobghUrFTDSnwaIzxjJ5KNwf3TJENl2qk lMUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si3685814plc.153.2018.12.14.01.56.46; Fri, 14 Dec 2018 01:57:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729351AbeLNJzn (ORCPT + 99 others); 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-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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