Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3036153pxk; Mon, 7 Sep 2020 00:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUTcp8j2R4pY3I0emanESUB+OCAk+c2THzxjRoWbc8AN0h6LCUS1qPorr3OHayCii2GYlY X-Received: by 2002:aa7:da89:: with SMTP id q9mr20300038eds.111.1599465142316; Mon, 07 Sep 2020 00:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599465142; cv=none; d=google.com; s=arc-20160816; b=YmiojXNI9G1Ci/lD1BGAwafcbW/KmL7XzDLiQdHa45zC/cSTBYTiSnYhs3g83ibdQK +my7MgLEeLAEB8gGn3qj1nHEjhKIyqMKpJLNEDhZYej8+xmBV07d9sJ5UM+gyGhxHsWb g+rvBOzldEuHPAfrq3PhtRO6KE4WP82+HnfIcVUCFFjHWD9H5uPgfUQiYOvY9V4IB5RR W/u7X49Vqd+cYgjsfqkz7ZQUrlNwsvm7mIC2CfvHCaH8GRXQgvE8x6wlEcfShDBiZr2f ca1nca1vTwo8CqsuLxVBoQTgkToqpEqdVyFtgSTJRIdOrFwMwqGazFGoSMiQPc6EvXid j2Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9dZwQriAMmtJ/UnLHDSJE7MTZVpx31yBXalgoAPJLJc=; b=dDmnAv6xh5KVQ4h3BmI/QJW/sTF25X9XL4BCN4O0G4kAKefjSKQ9vLxEQU+N+6itM/ RJuK3iF8xqUX6DsoofkihMY8frxo1HFRx+RU6+Tc5E9DY1v6OpUPBuvhkOO/lyEeJPn3 UT4LBCL4qAKBF66bqDREilHrlaIM/mPUWl1PX0gz+y+PFqvnOZBvIOnpaeXCdcBrxoO9 b/lFq4TsC3yzVenAAVpB3TqGDy/lK16MOcSbL0ZwQN4eiUtuff5Mo0c1klA4c7M6qzs3 f3kK1Gh57eUIX1yU2vL5jcMaTAnz1Q7isN8wG05nM74MoZSQdlAWYI5fSGRQFVuccd1i AJeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r26si8693675eds.384.2020.09.07.00.52.00; Mon, 07 Sep 2020 00:52:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbgIGHtO (ORCPT + 99 others); Mon, 7 Sep 2020 03:49:14 -0400 Received: from verein.lst.de ([213.95.11.211]:48064 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbgIGHtM (ORCPT ); Mon, 7 Sep 2020 03:49:12 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 1719868BEB; Mon, 7 Sep 2020 09:49:08 +0200 (CEST) Date: Mon, 7 Sep 2020 09:49:08 +0200 From: Christoph Hellwig To: Marek Szyprowski Cc: James Bottomley , Hillf Danton , Christoph Hellwig , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Kees Cook , Matthew Wilcox , linux-arch@vger.kernel.org Subject: Re: [PATCH] dma-direct: zero out DMA_ATTR_NO_KERNEL_MAPPING buf Message-ID: <20200907074908.GA20762@lst.de> References: <20200904152550.17964-1-hdanton@sina.com> <20200905073528.9464-1-hdanton@sina.com> <1599321042.11726.6.camel@HansenPartnership.com> <1eb4a2b0-2fd4-9f3c-e610-c8f856027181@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1eb4a2b0-2fd4-9f3c-e610-c8f856027181@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 07, 2020 at 09:02:34AM +0200, Marek Szyprowski wrote: > > That's not a reason ... that comment was put in for coherent mappings. > > What is the reason we should incur all this expense for clearing pages > > which aren't unmapped in the kernel, because we can update the comment? > > The usual rationale for kernel mapped pages is security, because they > > may leak information but unmapped pages shouldn't have this problem. > > Any dma_alloc_attrs() buffer might be mmaped to userspace, so the > security reason is still valid. Possible lack if kernel mapping was only > a hint that driver doesn't need it, so it might be skipped on some > architectures, where creating it requires significant resources (i.e. > vmalloc area). Yes. It seems actually mapping it to userspace in media/drm drivers seems to be one of the big use cases. There other one is memory not used by the host at all and just as an extra buffer for hardware so that the PCIe device can cut down on DRAM cost. For that could potentially skip the zeroing, but then again you'd need to trust the device, which with thunderbolt might not always be a good idea.