Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp630372lqc; Fri, 8 Mar 2024 07:28:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWMT7zkXi7l2Lvwbi6Dag2PViWnyQKjg1XRZRvPrB7fhLZPxZSDDheLpTfGDSsGGZP05QQMx7rYEhxMDOqhPalLxvGPeW+Q8QhaeN1CbA== X-Google-Smtp-Source: AGHT+IHJtVac5BSDZ7peunOBnoDgVaQXSnYYVJiYQ9AjzEbeBtFRU3qPcSTi80eDrxtQEeTUQjxi X-Received: by 2002:a17:906:ff53:b0:a43:5bc6:17f3 with SMTP id zo19-20020a170906ff5300b00a435bc617f3mr15785190ejb.6.1709911726395; Fri, 08 Mar 2024 07:28:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709911726; cv=pass; d=google.com; s=arc-20160816; b=O4b7a+tszBfB08gQg3FpRd+HRh7oHB9r29FBIGkHa1Wmj4f4uw4pe+fAhjIOAIyQbA egRpX7ezWGJK3FjBAXxaMUBX38aBwRiI2tl7kjvcZJJBZeNo+/VsIuD7MPEs438eU+os SgTLhjJz0epb9eqSPcYUsNRr3VQ7Yh08ookBOIL3kIlAE1EAdEKkCAtgxlnFvc7H4/hw 7Obfpt0jsi7I2PojWQEGS1791WMzuVkAS7tJ0uQ6/oYRsvwofINGIfLHNfZLuOmCN9rH lSo6A/rTawLzRJ1Syrbpbc7pY58Ah5K5/B3ErKc0qa3O+xpTTRxvZLXp3QiuHWGZ/+fz H1vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+aLgaHsDp8shJaMhhGMq7eVVgkewa0qW9fRX2GikWlA=; fh=E8F5/vp/nAcPVJWJwVt5RE8c2HME7kVqVeSMFxe8huE=; b=thRrEKeg1qY/Y5KBToZcGxjJpeYjM7rADPFP/42mlDC2gbuQsZ+aGWzi4/5Xi+bZSq Bz2U+5F5ZiIqDhmIXiOTA1WzDVe6/ABu7GwCGSnWQcdyn5akdHuMbfZWCKoQnDA6VSpb SowiTX0Brufmg/uAyyXD87l6/CbTn74ogX8voHNfxQbE5v2dNhj/rjviWals8Ux1uYs+ sAQLxm1T68jRCzkpp9Enoh/3OPUwLXriiMl/9juC3h2DqOSPRaifZJ16McD4gxzleDWc dDO2RsAaK9lrCGnUzV4Tz5N9zHbB9rs/djp8boyYulpF1Gbox7ERR5HtyKqZt2NXnfBP dNpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eYvFtZ2v; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f10-20020a17090624ca00b00a4550427c85si4555459ejb.876.2024.03.08.07.28.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 07:28:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eYvFtZ2v; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 238371F22E20 for ; Fri, 8 Mar 2024 15:28:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF4AA1EB35; Fri, 8 Mar 2024 15:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eYvFtZ2v" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4A795234; Fri, 8 Mar 2024 15:28:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709911720; cv=none; b=EbdZ1D9Dh3lL77hadZ5DLbCk/5elrLBOPuytCbCuC/pqVOx1F+WheRannc/HApMVVX9cjiyv9nBH3d6Vlk97Pt2pA6Q2/aNekAyDoUmnBruKmDlezwDSIPkHs8DoCKWgJ8P6PBnNR/myyKzOuiMzPyTx96DBZh7dHf9c+ShcuAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709911720; c=relaxed/simple; bh=dpGKlN2KaGZ30/KsUVnrfV0KTRmmZdACO4l8BVar75Q=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fYCtdZA4O4L97FXF1BwjXH/t6UemxHUI0SKGSmBo225iCkqOMN3oCYu9bN+K68oqYScgBBg1TqoJGl5LykqZfofmqH31LiYK8v1xJh2IQoU2q3+qoYhxlxPiTUxAixEy2xoxi1toRZTNX4cjYUVO6ACc30lWeeOmPjHjGBnkubE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eYvFtZ2v; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60A78C433F1; Fri, 8 Mar 2024 15:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709911719; bh=dpGKlN2KaGZ30/KsUVnrfV0KTRmmZdACO4l8BVar75Q=; h=From:To:Cc:Subject:Date:From; b=eYvFtZ2vlSSCilQVEn1E9lsGMUPpx52jS3qCTN2mHjiWwj90xGfTQMOHlic5ClGHr LskiwsTJhWmYpURnc83ZXYrHDmuXfDdxMg8bO2T05NbUrm24YP6Tbs270dQNyB60xC KYH95KO6WHGDAjn8mL0IdEfdNcvZd0tLBh9N3eYUEFVKbPxKBiNNnqhp6riRTHuokB lDMoBunsoIBJKGysHUtf3aOUKyMyHRaDP+HfvbHnwTuGU4F7jt+uR9ttJeA2rO9ssW jbYzPt+GHVvILVT+yecirHpYXg9yHaNqb+rjBzmjFqYOI9YI7IS1ccUzxXwFG9mBh/ x1GwhY7kLGbFg== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , iommu@lists.linux.dev, Christoph Hellwig , Marek Szyprowski , Robin Murphy , Petr Tesarik , Dexuan Cui , Nicolin Chen , Michael Kelley Subject: [PATCH v6 0/6] Fix double allocation in swiotlb_alloc() Date: Fri, 8 Mar 2024 15:28:23 +0000 Message-Id: <20240308152829.25754-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi again, folks, This is version six of the patches which I previously posted at: v1: https://lore.kernel.org/r/20240126151956.10014-1-will@kernel.org v2: https://lore.kernel.org/r/20240131122543.14791-1-will@kernel.org v3: https://lore.kernel.org/r/20240205190127.20685-1-will@kernel.org v4: https://lore.kernel.org/r/20240221113504.7161-1-will@kernel.org v5: https://lore.kernel.org/r/20240228133930.15400-1-will@kernel.org Changes since v5 include: - Rework the final patch to preserve page-alignment for streaming requests without a DMA alignment mask - Added Reviewed-by tags from Michael Cheers, Will Cc: iommu@lists.linux.dev Cc: Christoph Hellwig Cc: Marek Szyprowski Cc: Robin Murphy Cc: Petr Tesarik Cc: Dexuan Cui Cc: Nicolin Chen Cc: Michael Kelley --->8 Nicolin Chen (1): iommu/dma: Force swiotlb_max_mapping_size on an untrusted device Will Deacon (5): swiotlb: Fix double-allocation of slots due to broken alignment handling swiotlb: Enforce page alignment in swiotlb_alloc() swiotlb: Honour dma_alloc_coherent() alignment in swiotlb_alloc() swiotlb: Fix alignment checks when both allocation and DMA masks are present swiotlb: Reinstate page-alignment for mappings >= PAGE_SIZE drivers/iommu/dma-iommu.c | 9 ++++++++ kernel/dma/swiotlb.c | 47 ++++++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 13 deletions(-) -- 2.44.0.278.ge034bb2e1d-goog