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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1A77C46467 for ; Tue, 3 Jan 2023 14:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qeQds858bAMhoJwKuaHVpINQBnpzYLUxaZrPYwJl/+A=; b=1MHGQogfwdZeNm A2QBinHPyeGfkwmQ9xrpz8fFEsQpQoMyOUJk4kyRioZzoG1c/eb/geUV1iQ4gTWlysmtRhZ07PjF8 y+uP3uc9kVIOiLs2etqy7SuYxClaVvSa7LjR6AO+sf6+0lZynA60wVtMxhfU3qLU28oXj9UhzDavr fR1Xu+W/ovmuLhJGKeZKpv90RbKWp6a4sH/LTJGYkkKpuwSq1mKbwftIK3ZWKrdg/PyrT5+IeWGvx lm7bbkA3oK89Mz2jBJOu2kxdVOszWeLH1eLpEh9JYmlHQfb6q39sqk37to3B1z5YjBTRNfjJOOXo8 RhJzKFzzdS3pURNN5s+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCiiE-002Bgg-Jo; Tue, 03 Jan 2023 14:56:24 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pCdwz-000Xw1-1U for linux-arm-kernel@lists.infradead.org; Tue, 03 Jan 2023 09:51:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UReA0GcbImXPJjMHdixxp2/Qho2HPlkyMr6BQp2ajFI=; b=yfYfzTAYTGUnzLhcx0NbKYMkf9 wJhF9Bxy6gjtP5Ag4QqUwmDyPOQZLpJFcQdvXlifXi0GsPDhRQ2CxiwLkF0Dp1BmQQFyDpLFYKWk7 09199BZgj0hE8s90A+EMUSzY50ZR6tgdzsVBUymHePpgnzFyfughIXYI5zw4TTs+mL2qGMaVhmuBI lOT2yKkoUHtX6ZEMBewPOoaNNZ/4uwL5FOapeMu8cvd5FNHnIGVpn6ptuLUttMLWEJ7BgArN7TBPV FyhMqTbjxczL8BR5AOZaxU4KzT6m6bNU4HmnW0SllhWycoBdQVi36wQY7zwBC/mwVrM/zMfV4Mpku lV7ah/Bw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35900) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pCdwu-0005Ak-AK; Tue, 03 Jan 2023 09:51:11 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCdwr-0001xG-NH; Tue, 03 Jan 2023 09:51:09 +0000 Date: Tue, 3 Jan 2023 09:51:09 +0000 From: "Russell King (Oracle)" To: Igor Klochko Cc: Christoph Hellwig , iommu@lists.linux.dev, robin.murphy@arm.com, m.szyprowski@samsung.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arch/arm/mm/dma-mapping.c: fix __alloc_from_pool returning a dirty buffer Message-ID: References: <14dccd8c-e29a-fe93-5d4c-f0c3ff4f2430@gmail.com> <20221223143938.GA29147@lst.de> <43ef46fc-2fbc-31b7-d683-f7496b39dae5@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <43ef46fc-2fbc-31b7-d683-f7496b39dae5@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230103_015117_401695_8C1AC415 X-CRM114-Status: GOOD ( 18.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 23, 2022 at 11:51:43PM +0100, Igor Klochko wrote: > Thanks Christoph, > > Added fixes and a changelog. > This issue is present in all current LTS versions. > > ---- > Buffers allocated by __alloc_from_pool() should be zeroed out as done by other allocators. > Certain drivers expect a clean buffer and clearing the buffer is beneficial from the security point of view. > --- > Fixes: 36d0fd2198da3 (*arm: use genalloc for the atomic pool*) > Signed-off-by: Igor Klochko > --- > arch/arm/mm/dma-mapping.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index c135f6e37a00..bb2bb3ab497a 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -366,6 +366,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) > > *ret_page = phys_to_page(phys); > ptr = (void *)val; > + memset(ptr, 0, size); I'm not up to speed with the current structure of the DMA implementation on ARM, but isn't this going to make cache lines dirty for the returned buffer, which will corrupt DMA on non-coherent devices? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel