From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2085.outbound.protection.outlook.com [40.107.244.85])
	(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 D486373F02;
	Thu, 22 Feb 2024 21:24:03 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.85
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1708637045; cv=fail; b=m0FI5kTwCHqErdagDfQ+NGCvm86RcMV/0yFHeo4l0O/4ndbg9ene5YQjeMjMxOgkRoi3osBu1gJRAfQ5HT35HQvmvPWIZ1XD/Tzvq8GsjpBLF1KXk78NLm1g1dmxIzVMU0gFRb4y2uXj7D4LcwKeLyvx7b0Qa/kzpWxzvkX3yhg=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1708637045; c=relaxed/simple;
	bh=2VWHsO8eiZ+k512qv6/59xkYcqTSCCTn13EP0Ayb1C8=;
	h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=idmeMmucxBRhTZcv568c8XSDqGon61GMgEP6WnAdsBKvUvQKcJRkAXU/U+k3Us36iSqy1404IKchdI7HZJ+o9eq8CONqIx7/IRlXRs9pzQ+7Mki4FoaQQ9uYKGoGnwdiOxMmaNRdC2SXRen7SuP5Gphs/Al5l+MV/N8wrFDbBFw=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=fOlGns/z; arc=fail smtp.client-ip=40.107.244.85
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="fOlGns/z"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=cxXWTu4YkK1pdqEvsMEJ6tOOOJe3vvv0fPJLMCesstjFC/i93HjNUyzh/9WgdlYchxCLlP/Ifa0L7gnNQcsqopaFitnJLpiW4dZVgwwIAebY04niHaEanshCVXRDe2yCw5Pd9Edb0uY6zAE/1VniEfGfWTClz5zV8VqQ00FCmy03jLsnQOjJPotLJOe2xPLVNi47cSFdjlAlqp2d9ge5UDcSrGuDnsK3LDJ8AQfXJ/ZJn4H6kASj2oLoVGW83Zc92nLhaaIIEoS02Eg6HA5YY9Pltgg/oPZD7JfaAj47vg1WslPDHisUR5teBnBXad/FqWW5pK9GxvzHzlRUCVt7xw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=Do3tPKVoS0rIH2c8R0h09/5glxyQgXXZPq8L4axdOkU=;
 b=BMtd2U2jV8VQY6Uy0DCqg8Mr+JgMPk2RGEuHI3/O3eIVXWpuj1pLWmnGPn1OTCWmEayR88lWtx49VLoaTXCpFWm5qJsVWWudF+K+yDAh6K98dmzExEBqT5Zg9+PX3pJhWGl2C7XglODIx8J9L41GppwFKUadnufH88l+VrH6VZQ6qYUyhNRhej+UTA7PNYAfCwIU9mmwho5uSCyE4gNLDFYXpkx+t+4irM5v1WbEymZY31mbT7+HDhkvcDhQQO0XQtyBr+UyejBl3v3MD7T566IBE9oS05VcMXxKHYSQwM8XsO0UXjHYUfj8FdGKsaQfnXEn8TJjUcf9+L/mpNBNWw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.118.232) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=Do3tPKVoS0rIH2c8R0h09/5glxyQgXXZPq8L4axdOkU=;
 b=fOlGns/zRS+doCKo5VEj0mKqeoNavTfYbyWLMJwwUB2hKbn/iG28hXBAgrNZ/5AGrFNi2VfLzJct2vuq+wWuvK4SzD3nrOCoFp4tiVlhWqVh1+f7M7vTzB8u1z/jyO6Ul1WPppSR+9Avb+57E+aAvoaa+Xj7eBtSIiSsL2Gt21ZispF0xIhPqXaNle0Ld6dbgvm6UUdVjlA91D5XvUiKmlw5ow+f9zcOvyZHW2SoWUQIJhrZVMKGxaGu2mdXBQifU4yOH7Q7vr4K+SPxxwRhGr0Vf7D5/GOAjnA35BXKXI0bSb1NUPJQJmzo14bLYNkO/ssNkj87mlr1jof9ANiNCQ==
Received: from DS7P222CA0018.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::33) by
 PH7PR12MB6718.namprd12.prod.outlook.com (2603:10b6:510:1b1::11) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.24; Thu, 22 Feb
 2024 21:24:00 +0000
Received: from DS2PEPF00003443.namprd04.prod.outlook.com
 (2603:10b6:8:2e:cafe::6e) by DS7P222CA0018.outlook.office365.com
 (2603:10b6:8:2e::33) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.43 via Frontend
 Transport; Thu, 22 Feb 2024 21:24:00 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232)
 smtp.mailfrom=nvidia.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.118.232 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.118.232) by
 DS2PEPF00003443.mail.protection.outlook.com (10.167.17.70) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7292.25 via Frontend Transport; Thu, 22 Feb 2024 21:24:00 +0000
Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com
 (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 22 Feb
 2024 13:23:49 -0800
Received: from drhqmail202.nvidia.com (10.126.190.181) by
 drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.1258.12; Thu, 22 Feb 2024 13:23:49 -0800
Received: from Asurada-Nvidia.nvidia.com (10.127.8.11) by mail.nvidia.com
 (10.126.190.181) with Microsoft SMTP Server id 15.2.1258.12 via Frontend
 Transport; Thu, 22 Feb 2024 13:23:49 -0800
From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>
CC: <yi.l.liu@intel.com>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: [PATCH rc 0/3] iommufd: Fix three bugs found by Syzkaller
Date: Thu, 22 Feb 2024 13:23:44 -0800
Message-ID: <cover.1708636627.git.nicolinc@nvidia.com>
X-Mailer: git-send-email 2.43.0
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-NV-OnPremToCloud: ExternallySecured
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS2PEPF00003443:EE_|PH7PR12MB6718:EE_
X-MS-Office365-Filtering-Correlation-Id: 81e7e454-a64b-404a-acb4-08dc33ec960d
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101;
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 21:24:00.1138
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 81e7e454-a64b-404a-acb4-08dc33ec960d
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource:
	DS2PEPF00003443.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6718

Jason has been running Syzkaller that found three bugs.

Fix them properly.

Nicolin Chen (3):
  iommufd: Fix iopt_access_list_id overwrite bug
  iommufd/selftest: Fix mock_dev_num bug
  iommufd: Fix protection fault in iommufd_test_syz_conv_iova

 drivers/iommu/iommufd/io_pagetable.c |  9 ++++---
 drivers/iommu/iommufd/selftest.c     | 40 +++++++++++++++++++++-------
 2 files changed, 36 insertions(+), 13 deletions(-)

-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2047.outbound.protection.outlook.com [40.107.220.47])
	(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 F2BBB73F35;
	Thu, 22 Feb 2024 21:24:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.47
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1708637048; cv=fail; b=cBwAeOW26OJWuI8IOkPx7ly/uRT1Py1hvtpLwfzcrqGqBmM+ZF0o8i8MK8FXkV/p/CDWRzDsMWZ+quGqfpls2lCMnH2VFTbf+mRFgPcnPeMhXXWtJMPSpJJbLhO1I9tmFd8Vp9AsaxadXi+3Qo1eV8OMMi/z2Dzzrc+AAl6Bt08=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1708637048; c=relaxed/simple;
	bh=D8bCjACiAr3gyIL13jZY5k17i/XuVagx8K0yf/jCNxI=;
	h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=S1Mr51B/V/iknOL74HwnqmBulKCJams6VEORoL4uV441Y1UhcAvYkpX1jUJP3I4fRrydwggBJFEa/TNL8BOG3LI/94Y7O4menhBMEDP44eb+cpPLn49BkZu2vH4QdspbzmjfY+q/cBi1R4I4RyW8THwMJI3GNvfJJVeAud5NSzI=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=McFYw/77; arc=fail smtp.client-ip=40.107.220.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="McFYw/77"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=ITVgaiNJDDdaftPbPySrunCdtfA3Ss6MDbZ88/lnnaVPktxgbwFPiMYhhyl+qT4wN9KZulQ10Ga4PHg2dOoyDr7YTSSfvYArkLO+nwqcKQU35KdB8r36LiqM+1WxrZSQE6g3tNqRdF5PiWF+JNUmud3VehnayT2h7fI+oSVRcK3vrSmrev3chxu2+DqwA2OslP56AQwAPtXnNGRP9lDinxZF02LtOkjw4txGaJdmb0tSAke995nfKI6TQrWRAN2FWQv4zIKlYouDOiQojtT13Pm89Nz5vgGBz7bwZ+ECdx6Z0wFp1a+g4l/xdYZ5o0jbd8MV8D7Eh1qMd58WNMQSew==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=ORtLZL5Ga6nP2AjaBmDDZ/vU6ZMnsORJC3gdvFr6NOs=;
 b=HGLvVgUOQ71H3CdREkwvSFNXEj6ySz3xFBL1NsMscBB5d7OONT8sKX7x/q7yvaTeS5k9+VLOb66GlAyqqItkWQ4QME+1X80EK0JXC4ztuGZMFjEIaIfCbt+2n0qEVNTiW71fBQpSr/oOYUzVw7+a5gtyfbMCxZyJvBfG3eQUi4+/59E8ThDPy/EZWP9YfeGokeHIR4hy2fZMBLMZnYrKeFAHOrFgV6eTwFfcoqF5DEMGkMoPwQiU3cS6c9wrND/8JD8RpTbDqsPa1acR++scWjqZYD5n4u1YCzZ2o77cN2OhgqkyLYEtxqyNjuE37k7P+GgcmaXbYAzMrlW9YaCa5w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.118.232) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=ORtLZL5Ga6nP2AjaBmDDZ/vU6ZMnsORJC3gdvFr6NOs=;
 b=McFYw/77T7+m9qZLhac58G99fFCUw6UMaiNu9EV8ZSlWzcbdbFSvYbvN6JZpQm5rNrN5P+YsQ1Rb70vIVAC5Xsok7ogCqblEDKHhd3nvf+5Ig0ZG9TbegTI0+Bts9o7eZzRQBOCa11COki5eNsfIsc/FL0dJdincNyotcRQdBAg629q4+y47XUKiBEgqGAZQpEpCpjC2z540Pn/MrdWk1TSj04Eww/ITZ2/Nny7CxymrMNua60jBAXVCjG/7BLnWU0xPrCjT2YMYz+4GKOlNVDB8deTia4itIzvJi1tbhezgeHdloj0PCLrzATKrTYE0LAhlFJj5ab7QXM4tkeSZUQ==
Received: from DS7P222CA0027.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::35) by
 DM6PR12MB4546.namprd12.prod.outlook.com (2603:10b6:5:2ae::19) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7316.24; Thu, 22 Feb 2024 21:24:02 +0000
Received: from DS2PEPF00003443.namprd04.prod.outlook.com
 (2603:10b6:8:2e:cafe::11) by DS7P222CA0027.outlook.office365.com
 (2603:10b6:8:2e::35) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.43 via Frontend
 Transport; Thu, 22 Feb 2024 21:24:01 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232)
 smtp.mailfrom=nvidia.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.118.232 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.118.232) by
 DS2PEPF00003443.mail.protection.outlook.com (10.167.17.70) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7292.25 via Frontend Transport; Thu, 22 Feb 2024 21:24:00 +0000
Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com
 (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 22 Feb
 2024 13:23:50 -0800
Received: from drhqmail202.nvidia.com (10.126.190.181) by
 drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.1258.12; Thu, 22 Feb 2024 13:23:50 -0800
Received: from Asurada-Nvidia.nvidia.com (10.127.8.11) by mail.nvidia.com
 (10.126.190.181) with Microsoft SMTP Server id 15.2.1258.12 via Frontend
 Transport; Thu, 22 Feb 2024 13:23:49 -0800
From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>
CC: <yi.l.liu@intel.com>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: [PATCH rc 1/3] iommufd: Fix iopt_access_list_id overwrite bug
Date: Thu, 22 Feb 2024 13:23:45 -0800
Message-ID: <2dda7acb25b8562ec5f1310de828ef5da9ef509c.1708636627.git.nicolinc@nvidia.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1708636627.git.nicolinc@nvidia.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-NV-OnPremToCloud: ExternallySecured
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS2PEPF00003443:EE_|DM6PR12MB4546:EE_
X-MS-Office365-Filtering-Correlation-Id: 465afc7a-ad59-453e-cd9d-08dc33ec9690
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(230273577357003)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101;
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 21:24:00.9732
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 465afc7a-ad59-453e-cd9d-08dc33ec9690
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource:
	DS2PEPF00003443.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4546

Jason has been running Syzkaller that reported the following WARN_ON:
  WARNING: CPU: 1 PID: 4738 at drivers/iommu/iommufd/io_pagetable.c:1360
that is a bug of mismatched access pointers.

Call Trace:
 iommufd_access_change_ioas+0x2fe/0x4e0
 iommufd_access_destroy_object+0x50/0xb0
 iommufd_object_remove+0x2a3/0x490
 iommufd_object_destroy_user
 iommufd_access_destroy+0x71/0xb0
 iommufd_test_staccess_release+0x89/0xd0
 __fput+0x272/0xb50
 __fput_sync+0x4b/0x60
 __do_sys_close
 __se_sys_close
 __x64_sys_close+0x8b/0x110
 do_syscall_x64

The mismatch between the access pointer in the list and the passed-in
pointer is resulted from an overwrite at access->iopt_access_list_id,
in iopt_add_access(), called from iommufd_access_change_ioas(), when
xa_alloc() succeeds while iopt_calculate_iova_alignment() fails.

Add a new_id in iopt_add_access() and only update iopt_access_list_id
when returning successfully.

Fixes: 9227da7816dd ("iommufd: Add iommufd_access_change_ioas(_id) helpers")
Cc: stable@vger.kernel.org
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/iommufd/io_pagetable.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/iommufd/io_pagetable.c b/drivers/iommu/iommufd/io_pagetable.c
index 504ac1b01b2d..05fd9d3abf1b 100644
--- a/drivers/iommu/iommufd/io_pagetable.c
+++ b/drivers/iommu/iommufd/io_pagetable.c
@@ -1330,20 +1330,23 @@ int iopt_disable_large_pages(struct io_pagetable *iopt)
 
 int iopt_add_access(struct io_pagetable *iopt, struct iommufd_access *access)
 {
+	u32 new_id;
 	int rc;
 
 	down_write(&iopt->domains_rwsem);
 	down_write(&iopt->iova_rwsem);
-	rc = xa_alloc(&iopt->access_list, &access->iopt_access_list_id, access,
-		      xa_limit_16b, GFP_KERNEL_ACCOUNT);
+	rc = xa_alloc(&iopt->access_list, &new_id, access, xa_limit_16b,
+		      GFP_KERNEL_ACCOUNT);
+
 	if (rc)
 		goto out_unlock;
 
 	rc = iopt_calculate_iova_alignment(iopt);
 	if (rc) {
-		xa_erase(&iopt->access_list, access->iopt_access_list_id);
+		xa_erase(&iopt->access_list, new_id);
 		goto out_unlock;
 	}
+	access->iopt_access_list_id = new_id;
 
 out_unlock:
 	up_write(&iopt->iova_rwsem);
-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52])
	(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 E2BC873F34;
	Thu, 22 Feb 2024 21:24:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.52
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1708637048; cv=fail; b=IglMgbrFW8WhLk1n5GUZ5uoFrf1GDAteiGHhKfMKannij4WEbHOQlRqIcxmiMx3jF8ezZipzrCGGUFZYqPIvsBlnvQ2v1goJDeR1wQiAhphSpxVR+aQCHpoeDw+WCxCGQqKzvkAg5lq75J1l7hjzZ+gE7tY33au96zF/yYcKst8=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1708637048; c=relaxed/simple;
	bh=7gYb/Pa7F+IchcPJNpoDmvFaA7AMFCi/jgZyJuMVPwQ=;
	h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=hq4i2Gd94fNcfWWSDuobCC778OoIkOzLU8UIGEKeJmPuLsgWzxmCxgjMIu4/JKzmzk0OGEeWrMWkQFYgoQDNQP9RcrGbzyKdPqAuqXOuDi2O+A0l50G1RyL7f75rLAPJ2oCzFT1qULL5+sYnKy+Ke8wHU/Le2tJfmAtiFYtXGaY=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=JP0Zkfhw; arc=fail smtp.client-ip=40.107.93.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="JP0Zkfhw"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=IxckmzUV6okaYIWjIf5OqGx5ILoxW68QF9amqsDqv8cpur5b9PURopVclu0F+2cQ2u08S2NmrAUWLgFd93DQCxrRhIg9qMmTi/YBUr37mcQBG4s/HGRB9qkIT7fndbz0/f1z8VLyYrVBobfD7O5kEGI8DA2L/H3h24HDxJYo+TOqwnssJLxQrfN4SgACGo9j9PInNqxiWSamTaK2phBNAQS/h+oKdLjcL0VbINAr2qlNH1/p9OX23P74oDcQngFuOyXfMon+HXC4YwMvaBQbTd+lqTdXGpSscBnKf/saT38/kiYM+UUlAmvz17EC7e/fnm468yvZN2ZucmEZtbnIjQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=LNjD251+po3w/LiQLxpp7IMemVrG4UuyMR7gGkw2Xmo=;
 b=lXZXJMmQGypAhR+aSL5YanJDkiVStU0tFH0/m7VYcpKFFU4MmBlqY2kldWMb8GrxlVA54yWjI4wtzZCt4XLK32NQAkDeT7rIk4/hT6bVdSiQ6HaplWG7QnKRFO6ouFx+5jyi+lnNhPuWvTljT02gNLVuezMq37ZhJDrm5/jPAmkbNG88EYbAV0fVKlswwJK0JvrNNUuc8D/Jdo/oISv0nTs8bN/Wxz1Cez3eoRxb35koNLJU8JstehisWbotGXHuHwu2wVqcs7SjUSx9d24bs8a21wAs9bgndxYaFpmGY2jZWKpydRr1/UiJLXE/VGOKVj5q2ahHWMGHZwLEyTbzmw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.118.233) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=LNjD251+po3w/LiQLxpp7IMemVrG4UuyMR7gGkw2Xmo=;
 b=JP0ZkfhwGjQ0EexCBcyMINq1YczHlNcjUQfIwbJ8gT3kClhYVYsfTR08kn0IqGTb6TqIzOgb4ja3tDygApGg+5wtXmYwbRBJm3WbrvQXuVZJu6C/JhAlySrWvl2PkNOG+jtNgxnEZrGfYsjtHCWVhLg6qt4LrdK0i6PVLZ9+4lbDu2H55grRo3eC65TQbH1bYOogP66rYdz+I5ccfp+vNGgZ4/IBFxrjMaeQkl+25akksYqBcgt7aJvnmzYWoMhhUdz/Ec+2Namqhp0Ip93yWeXQZVZ9C9XL8RFIdauCGIBYUc6lACVr++0ujso6rNWvcCrGo9Nfdvx7t+OSVwus8A==
Received: from BN9PR03CA0150.namprd03.prod.outlook.com (2603:10b6:408:fe::35)
 by IA1PR12MB7734.namprd12.prod.outlook.com (2603:10b6:208:422::11) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.26; Thu, 22 Feb
 2024 21:24:03 +0000
Received: from BN3PEPF0000B06A.namprd21.prod.outlook.com
 (2603:10b6:408:fe:cafe::63) by BN9PR03CA0150.outlook.office365.com
 (2603:10b6:408:fe::35) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.43 via Frontend
 Transport; Thu, 22 Feb 2024 21:24:03 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233)
 smtp.mailfrom=nvidia.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.118.233 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.118.233) by
 BN3PEPF0000B06A.mail.protection.outlook.com (10.167.243.69) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7339.0 via Frontend Transport; Thu, 22 Feb 2024 21:24:03 +0000
Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com
 (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 22 Feb
 2024 13:23:51 -0800
Received: from drhqmail202.nvidia.com (10.126.190.181) by
 drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.1258.12; Thu, 22 Feb 2024 13:23:50 -0800
Received: from Asurada-Nvidia.nvidia.com (10.127.8.11) by mail.nvidia.com
 (10.126.190.181) with Microsoft SMTP Server id 15.2.1258.12 via Frontend
 Transport; Thu, 22 Feb 2024 13:23:50 -0800
From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>
CC: <yi.l.liu@intel.com>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: [PATCH rc 2/3] iommufd/selftest: Fix mock_dev_num bug
Date: Thu, 22 Feb 2024 13:23:46 -0800
Message-ID: <5af41d5af6d5c013cc51de01427abb8141b3587e.1708636627.git.nicolinc@nvidia.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1708636627.git.nicolinc@nvidia.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-NV-OnPremToCloud: ExternallySecured
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06A:EE_|IA1PR12MB7734:EE_
X-MS-Office365-Filtering-Correlation-Id: 2c5be1af-520d-48c8-d335-08dc33ec980a
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101;
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 21:24:03.4037
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 2c5be1af-520d-48c8-d335-08dc33ec980a
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource:
	BN3PEPF0000B06A.namprd21.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7734

Jason has been running Syzkaller that reported the following bug:
  sysfs: cannot create duplicate filename '/devices/iommufd_mock4'

Call Trace:
  sysfs_warn_dup+0x71/0x90
  sysfs_create_dir_ns+0x1ee/0x260
  ? sysfs_create_mount_point+0x80/0x80
  ? spin_bug+0x1d0/0x1d0
  ? do_raw_spin_unlock+0x54/0x220
  kobject_add_internal+0x221/0x970
  kobject_add+0x11c/0x1e0
  ? lockdep_hardirqs_on_prepare+0x273/0x3e0
  ? kset_create_and_add+0x160/0x160
  ? kobject_put+0x5d/0x390
  ? bus_get_dev_root+0x4a/0x60
  ? kobject_put+0x5d/0x390
  device_add+0x1d5/0x1550
  ? __fw_devlink_link_to_consumers.isra.0+0x1f0/0x1f0
  ? __init_waitqueue_head+0xcb/0x150
  iommufd_test+0x462/0x3b60
  ? lock_release+0x1fe/0x640
  ? __might_fault+0x117/0x170
  ? reacquire_held_locks+0x4b0/0x4b0
  ? iommufd_selftest_destroy+0xd0/0xd0
  ? __might_fault+0xbe/0x170
  iommufd_fops_ioctl+0x256/0x350
  ? iommufd_option+0x180/0x180
  ? __lock_acquire+0x1755/0x45f0
  __x64_sys_ioctl+0xa13/0x1640

The bug is triggered when Syzkaller created multiple mock devices but
didn't destroy them in the same sequence, messing up the mock_dev_num
counter. So, fix it with a mock_dev_ida.

Fixes: 23a1b46f15d5 ("iommufd/selftest: Make the mock iommu driver into a real driver")
Cc: stable@vger.kernel.org
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/iommufd/selftest.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 8abf9747773e..2bfe77bd351d 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -36,7 +36,7 @@ static struct mock_bus_type iommufd_mock_bus_type = {
 	},
 };
 
-static atomic_t mock_dev_num;
+static DEFINE_IDA(mock_dev_ida);
 
 enum {
 	MOCK_DIRTY_TRACK = 1,
@@ -123,6 +123,7 @@ enum selftest_obj_type {
 struct mock_dev {
 	struct device dev;
 	unsigned long flags;
+	int id;
 };
 
 struct selftest_obj {
@@ -631,7 +632,7 @@ static void mock_dev_release(struct device *dev)
 {
 	struct mock_dev *mdev = container_of(dev, struct mock_dev, dev);
 
-	atomic_dec(&mock_dev_num);
+	ida_free(&mock_dev_ida, mdev->id);
 	kfree(mdev);
 }
 
@@ -653,8 +654,12 @@ static struct mock_dev *mock_dev_create(unsigned long dev_flags)
 	mdev->dev.release = mock_dev_release;
 	mdev->dev.bus = &iommufd_mock_bus_type.bus;
 
-	rc = dev_set_name(&mdev->dev, "iommufd_mock%u",
-			  atomic_inc_return(&mock_dev_num));
+	rc = ida_alloc(&mock_dev_ida, GFP_KERNEL);
+	if (rc < 0)
+		goto err_put;
+	mdev->id = rc;
+
+	rc = dev_set_name(&mdev->dev, "iommufd_mock%u", mdev->id);
 	if (rc)
 		goto err_put;
 
-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2074.outbound.protection.outlook.com [40.107.93.74])
	(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 C0CF412D1F7;
	Thu, 22 Feb 2024 21:24:08 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.74
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1708637050; cv=fail; b=WLaOexFS4e6ZSw3Gn2Egq0jPUuqBoIlMo6NwL8sV5kaS0IcCUeBqvwIFfCQZMA541v9hKWZ5pn0gEiXDuZNZlWfIjjA7/7I+O3W/1vmvRouHKV0QJs/cwsas+ydcqIC+P3AeVaxDHsD0xmMSve8IwnoJCUsfze3fhhcm8N9yEOM=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1708637050; c=relaxed/simple;
	bh=nxuqavFmUafOV6nwxMr7abbtQryf0eGGYq17hFLNDCk=;
	h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=gKTfduv/76LFnEtXEqm1mZH5YJwOsX+vnLkAYEayOczGx6toYYUl+D1H2PNLVNGPKnd+NtpTmcloXffwqT5q2V74No+VSf04fZAfgJKulyU3NNeK1FLgkK5S75XMc1vwUHR+HKev4/7PS0X62gDZpstt6zNrdsIffUPVdd7NApQ=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tEuxKpka; arc=fail smtp.client-ip=40.107.93.74
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tEuxKpka"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=jMCyPh4GvuzawHSEliSoexW0STIQcNVyuvrg4WUcRpfz+V7VOhFflGIhL5tqoR8tYEEIv4yWQsfL6MnCN/gEIqirBiEyOirYiL5qffRLxuZtcVDjAD8pSfQQWK1IQfV4Mx9p5z8ltM/GN8QPoxGjcg1IBusbkfQvKu//tZxCamo1YjO7Wn0rdk5m0CgvUQQKbJKZ5LpVhw7cBH8xfh46TFlk2gVbS7CPBrOP+nKD9K8tWSCcRw4+EUq59j2KK3ClRe4jFeA8gsPEEekmq0v/I3vNbSEfOFF22Gtuy0cNghdmAjA7ifwYlk6tCtucWVrzQVQeT+qy7jeX6BOaECDiHg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=nqVQ5ptS5EIYcKnMPZL8+89QjJAIM06thQdPpK2WrR8=;
 b=EdfelgKvbOC+I45+4TzMoj8kA4dIModWNP5Cw3iJKNLtEoXXcMcQ4dYbvbPNhMCBSSJCWqkyln8MbXPU1eZFoaO0h+Iy2fOcPV0t8iwMkjUIJBHDCqemXzG3hl3ZeYuvc8C6rgPzWclMHzIOBg2NFGF2iFUe+QN3y3psx0kpvmav104r4F6xlWsRGN2FLG3Szw2hQ9OkFuB//evzGkbIVpRIp+ETKEVm87NwGy7NPRHiaeFuE5dIx6YmjFgbvsZIq24nFlXIz9BaQfZMC9fYC4yzXvxPxG4Ob4qbwumgZwxiqeQgy3Yz9VfgUOlm5uVdLvG+9MqZ6kTrrrsADxvfAw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.118.232) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com;
 dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;
 dkim=none (message not signed); arc=none (0)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=nqVQ5ptS5EIYcKnMPZL8+89QjJAIM06thQdPpK2WrR8=;
 b=tEuxKpkae12Z3uUUg1Vd7oeFiJT+Zt5VxOApVPRzVvfiBNo+AFvk11dCk81vflQ032+r9vFnPNd4UgYmYkcXw290qpD+rOop52ia8ajCN5VAUaME1TqQ+oXJ8RNJSMbiutmuP1Bams0jFE1KlNzwZA4dPZd2Iz5mIKRskuCVmdtpa7pRblw3sZ8eoeAPoLKkBTdj6WU5q5QTa7cIXoAuXtHGQ/ucMwraFqBQaj71Sogx67+zhuBGWwBG/gmg/cU8yKvMUI8UHnLzgHlm/OYr4ROxrV8mAm7a4AA6G9iwIOJmGcQhAA0qEVoJOZTClizoBkhKuTiTmZDt1wNT3es49Q==
Received: from DS7P222CA0026.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::32) by
 DS0PR12MB8786.namprd12.prod.outlook.com (2603:10b6:8:149::17) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7316.20; Thu, 22 Feb 2024 21:24:05 +0000
Received: from DS2PEPF00003443.namprd04.prod.outlook.com
 (2603:10b6:8:2e:cafe::e3) by DS7P222CA0026.outlook.office365.com
 (2603:10b6:8:2e::32) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.43 via Frontend
 Transport; Thu, 22 Feb 2024 21:24:05 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232)
 smtp.mailfrom=nvidia.com; dkim=none (message not signed)
 header.d=none;dmarc=pass action=none header.from=nvidia.com;
Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates
 216.228.118.232 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.118.232) by
 DS2PEPF00003443.mail.protection.outlook.com (10.167.17.70) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7292.25 via Frontend Transport; Thu, 22 Feb 2024 21:24:05 +0000
Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com
 (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 22 Feb
 2024 13:23:52 -0800
Received: from drhqmail202.nvidia.com (10.126.190.181) by
 drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.2.1258.12; Thu, 22 Feb 2024 13:23:51 -0800
Received: from Asurada-Nvidia.nvidia.com (10.127.8.11) by mail.nvidia.com
 (10.126.190.181) with Microsoft SMTP Server id 15.2.1258.12 via Frontend
 Transport; Thu, 22 Feb 2024 13:23:51 -0800
From: Nicolin Chen <nicolinc@nvidia.com>
To: <jgg@nvidia.com>, <kevin.tian@intel.com>
CC: <yi.l.liu@intel.com>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	<patches@lists.linux.dev>
Subject: [PATCH rc 3/3] iommufd: Fix protection fault in iommufd_test_syz_conv_iova
Date: Thu, 22 Feb 2024 13:23:47 -0800
Message-ID: <3f1932acaf1dd494d404c04364d73ce8f57f3e5e.1708636627.git.nicolinc@nvidia.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1708636627.git.nicolinc@nvidia.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-NV-OnPremToCloud: ExternallySecured
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS2PEPF00003443:EE_|DS0PR12MB8786:EE_
X-MS-Office365-Filtering-Correlation-Id: 1f5ae20d-19ac-4a97-2423-08dc33ec9931
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101;
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2024 21:24:05.3794
 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5ae20d-19ac-4a97-2423-08dc33ec9931
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource:
	DS2PEPF00003443.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8786

Jason has been running Syzkaller that reported the following bug:
  general protection fault, probably for non-canonical address 0xdffffc0000000038: 0000 [#1] SMP KASAN
  KASAN: null-ptr-deref in range [0x00000000000001c0-0x00000000000001c7]

Call Trace:
 lock_acquire
 lock_acquire+0x1ce/0x4f0
 down_read+0x93/0x4a0
 iommufd_test_syz_conv_iova+0x56/0x1f0
 iommufd_test_access_rw.isra.0+0x2ec/0x390
 iommufd_test+0x1058/0x1e30
 iommufd_fops_ioctl+0x381/0x510
 vfs_ioctl
 __do_sys_ioctl
 __se_sys_ioctl
 __x64_sys_ioctl+0x170/0x1e0
 do_syscall_x64
 do_syscall_64+0x71/0x140

This is because the new iommufd_access_change_ioas() sets access->ioas
to NULL during its process, so the lock might be gone in a concurrent
racing context.

Fix this by doing the same access->ioas sanity as iommufd_access_rw and
iommufd_access_pin_pages functions do.

Fixes: 9227da7816dd ("iommufd: Add iommufd_access_change_ioas(_id) helpers")
Cc: stable@vger.kernel.org
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 drivers/iommu/iommufd/selftest.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 2bfe77bd351d..d59e199a8705 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -63,8 +63,8 @@ enum {
  * In syzkaller mode the 64 bit IOVA is converted into an nth area and offset
  * value. This has a much smaller randomization space and syzkaller can hit it.
  */
-static unsigned long iommufd_test_syz_conv_iova(struct io_pagetable *iopt,
-						u64 *iova)
+static unsigned long __iommufd_test_syz_conv_iova(struct io_pagetable *iopt,
+						  u64 *iova)
 {
 	struct syz_layout {
 		__u32 nth_area;
@@ -88,6 +88,21 @@ static unsigned long iommufd_test_syz_conv_iova(struct io_pagetable *iopt,
 	return 0;
 }
 
+static unsigned long iommufd_test_syz_conv_iova(struct iommufd_access *access,
+						u64 *iova)
+{
+	unsigned long ret;
+
+	mutex_lock(&access->ioas_lock);
+	if (!access->ioas) {
+		mutex_unlock(&access->ioas_lock);
+		return 0;
+	}
+	ret = __iommufd_test_syz_conv_iova(&access->ioas->iopt, iova);
+	mutex_unlock(&access->ioas_lock);
+	return ret;
+}
+
 void iommufd_test_syz_conv_iova_id(struct iommufd_ucmd *ucmd,
 				   unsigned int ioas_id, u64 *iova, u32 *flags)
 {
@@ -100,7 +115,7 @@ void iommufd_test_syz_conv_iova_id(struct iommufd_ucmd *ucmd,
 	ioas = iommufd_get_ioas(ucmd->ictx, ioas_id);
 	if (IS_ERR(ioas))
 		return;
-	*iova = iommufd_test_syz_conv_iova(&ioas->iopt, iova);
+	*iova = __iommufd_test_syz_conv_iova(&ioas->iopt, iova);
 	iommufd_put_object(ucmd->ictx, &ioas->obj);
 }
 
@@ -1161,7 +1176,7 @@ static int iommufd_test_access_pages(struct iommufd_ucmd *ucmd,
 	}
 
 	if (flags & MOCK_FLAGS_ACCESS_SYZ)
-		iova = iommufd_test_syz_conv_iova(&staccess->access->ioas->iopt,
+		iova = iommufd_test_syz_conv_iova(staccess->access,
 					&cmd->access_pages.iova);
 
 	npages = (ALIGN(iova + length, PAGE_SIZE) -
@@ -1263,8 +1278,8 @@ static int iommufd_test_access_rw(struct iommufd_ucmd *ucmd,
 	}
 
 	if (flags & MOCK_FLAGS_ACCESS_SYZ)
-		iova = iommufd_test_syz_conv_iova(&staccess->access->ioas->iopt,
-					&cmd->access_rw.iova);
+		iova = iommufd_test_syz_conv_iova(staccess->access,
+				&cmd->access_rw.iova);
 
 	rc = iommufd_access_rw(staccess->access, iova, tmp, length, flags);
 	if (rc)
-- 
2.43.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11])
	(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 B717538385;
	Tue, 27 Feb 2024 03:34:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.11
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1709004862; cv=fail; b=s1c1fWmR1Y0caCIiEZTmPvqAy9n+8dSUI0zmnUWJbkr2lx4OvHqolnxBE4Svc7IYsFtv/nIDc26lVPHs+I76SqOru2ATn6zc691UcJ62F7z8nPewDpDwMPttjyehZ0Xb4GuWXh1JR22OlEorG5KVh3PNAlIq0gOr6Bb7RHiT8oM=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1709004862; c=relaxed/simple;
	bh=LTUYgsk0aE65MJ4jqB4lAzQ26LTVQkuqHW6foD+ZcLo=;
	h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:
	 Content-Type:MIME-Version; b=LXjxr2o/MBJo87uNvAKJ5bI2oLn6OFUWm34wc79iFX88Q8OpDEE4xGN5YEXpzgsnJNvV+8BlIGjmS8UD9JfFohENrdvm9YTyS36Cmf4T+9EjHSsPI0MgYhndvtmI44eOzrfwFabF1QSqk0iXeG0IzVPtZeQZQUSYHnQfMgDa/iA=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZhyCqCst; arc=fail smtp.client-ip=192.198.163.11
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZhyCqCst"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
  t=1709004861; x=1740540861;
  h=from:to:cc:subject:date:message-id:references:
   in-reply-to:content-transfer-encoding:mime-version;
  bh=LTUYgsk0aE65MJ4jqB4lAzQ26LTVQkuqHW6foD+ZcLo=;
  b=ZhyCqCstfdG1IZD8KIA3uYf2Mhr0UT+gA/R1ythJM+lq7qtO166gV1Jg
   W5MjKSl3y/GjDF7ABa+joiDV4tWHrFq12AnAYe7zD4Vj0ltggwqSG5A8A
   JB0D3xzEDnO6EM5uND0O3W+fBJvtzxp/V6d+x3lMb90aB66vgQ3sR0eob
   TeZ8dms71DfPZvF6sPgeHDAL3XcT9ugjUE/Br5r+t+Jo6yTj+GH8xwSQP
   +hkRO9rgUx7oNAY90e8p/i1CKtAYY12UAgrn2lI9M4UmyjNA6rymKJMta
   UXRy0gO1cWxQlmq+uj5SKj9ysvuz1VGRouNKmlJz4j0JI2CmiGIK59oU2
   A==;
X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="13970529"
X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; 
   d="scan'208";a="13970529"
Received: from fmviesa003.fm.intel.com ([10.60.135.143])
  by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 19:34:20 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; 
   d="scan'208";a="11489048"
Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83])
  by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Feb 2024 19:34:20 -0800
Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by
 fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35; Mon, 26 Feb 2024 19:34:19 -0800
Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by
 fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35; Mon, 26 Feb 2024 19:34:19 -0800
Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by
 fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35 via Frontend Transport; Mon, 26 Feb 2024 19:34:19 -0800
Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169)
 by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2507.35; Mon, 26 Feb 2024 19:34:19 -0800
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=G0aFlx/5MLNn1bLzap+Gz3W6M27sn2OL+yRZtCPpNEHX3csfOIeXN+ZL2OvIjDJYKX5qitpzKQf1ieGcF56gga0HE1Ej5pH3mzmWeBcspsj8kNZ40kI/LOHVPOA3u+ldiVkvxjc1edWgBbmIVSo+6NzwGm/8vAbWNKA5LL77e4FmO/BCSCF5QDWt4ZA678lViKYQyakCpRNNxbvS/7npL1gwuAoNgW8rZUMkSHCuaIEKJ8TgQd0IGo2Txy1YaLJWqN76ZsRvDJ0TxVqm8BOgbpVS4Z5k/UxvjLs5D3b/VRdloxwaz/iRgkInvPfa0nC730pMZTBYNSr321dX+lM3Vw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=2wM/GOuErGftR5sFv9YdolKc5hwle7DpXnCYqLButIA=;
 b=dkYEJCbZfj4481PPUzzGDRfIXRBZyNwQSf+91XVlvACf7gPz0WvTPBHlb01qifF+4JafrlC5/KByQ1PeIOs/iKjlotqIwuZ9Dk6FHaSTEjzV5b3LoPvvtqvxVRO9QVuDOBwDhxpBhTybz3nL/5jSHOa9SerXwJf2o2AF1IKT5bM4osJGwyhAbkYwO/luPKzOYG1IArsdusT9YYKN3HKferX6SA8Rw/DlMNUHloC/Jn8/9PEi+xnZDC7ueubeY56MTHSGZujdQuaXAhjRCTwW7OL/8ygXh83pHmh9yALT/fCGfqEsOAFv99x5e8bp2YTL+vFz+B24cW95G3GcBJrHiw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
Received: from BN9PR11MB5276.namprd11.prod.outlook.com (2603:10b6:408:135::18)
 by LV2PR11MB6069.namprd11.prod.outlook.com (2603:10b6:408:17a::9) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.23; Tue, 27 Feb
 2024 03:34:12 +0000
Received: from BN9PR11MB5276.namprd11.prod.outlook.com
 ([fe80::b0e3:e5b2:ab34:ff80]) by BN9PR11MB5276.namprd11.prod.outlook.com
 ([fe80::b0e3:e5b2:ab34:ff80%7]) with mapi id 15.20.7339.024; Tue, 27 Feb 2024
 03:34:11 +0000
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Nicolin Chen <nicolinc@nvidia.com>, "jgg@nvidia.com" <jgg@nvidia.com>
CC: "Liu, Yi L" <yi.l.liu@intel.com>, "iommu@lists.linux.dev"
	<iommu@lists.linux.dev>, "linux-kernel@vger.kernel.org"
	<linux-kernel@vger.kernel.org>, "stable@vger.kernel.org"
	<stable@vger.kernel.org>, "patches@lists.linux.dev" <patches@lists.linux.dev>
Subject: RE: [PATCH rc 0/3] iommufd: Fix three bugs found by Syzkaller
Thread-Topic: [PATCH rc 0/3] iommufd: Fix three bugs found by Syzkaller
Thread-Index: AQHaZdV8g+XNcunpKkezRrlyZ7gcfLEdj3Nw
Date: Tue, 27 Feb 2024 03:34:11 +0000
Message-ID: <BN9PR11MB5276D622986E55465C3977CB8C592@BN9PR11MB5276.namprd11.prod.outlook.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
In-Reply-To: <cover.1708636627.git.nicolinc@nvidia.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=intel.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: BN9PR11MB5276:EE_|LV2PR11MB6069:EE_
x-ms-office365-filtering-correlation-id: 0ddbe47d-663e-4d25-66b1-08dc3744f6e4
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:  
x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5276.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38070700009);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?My1iFKcoAWC3AWyl7HCCVm/9X3BwvmkYyNNoQAmy9wBSdDfU5ijQTqtDeyqi?=
 =?us-ascii?Q?QwKIweN9fN6sp4QR8XchKUoRQTPsMPPkiOIC+CLYy+j7gruljLZc1peCwcY+?=
 =?us-ascii?Q?s8ELe9uohqG+CuQbpGaFGtbJfxZxeok7EJEJGk4Ft/Ajr14lc5go4TTCw8OV?=
 =?us-ascii?Q?6Koa+GGandbudLM2vE5zzYqq4XiV6IQWnGIve3evQ7mKLh90pa2/StxyNCqx?=
 =?us-ascii?Q?KyRcjQOK6beHCdLQZyl+g0AI5Ba5aheA9PiXjtdE2l1rwzH3rKiBZexl0v0/?=
 =?us-ascii?Q?uJysG7Qt/UmTb4xfzcGDIyiXAk0oefO4GHMplR3PvWbfZYHgiN9uOViwoElJ?=
 =?us-ascii?Q?vjvq8Z0sK1fhA13dIVotai4OAkDtlZX7QOtapCq3KWKOC1KWVX7Z/dOIefgJ?=
 =?us-ascii?Q?aLHrLQOMCCXt3V8Z0MGwA5jVnACya/6GiUrU7Xxtld53AQZrqyny0ZvqsNqO?=
 =?us-ascii?Q?WZbv11jXv7OoGj/S/UQVZ3SKGMpPqhnFxtoLYbLtRGpCitdIcpCP73w+cWCe?=
 =?us-ascii?Q?T1dq3fzMLkC0veyDWVZjCofHF3bwqyERgwxQdhDGFCaBKlJzUI4n2nNfiqNQ?=
 =?us-ascii?Q?VHqkl3nuk09aqLt58ZGIghH/lTaUpwFC9BwtJXfxWWoDqBPIWxoj0aFLRgqr?=
 =?us-ascii?Q?+6khbStUK/g1nsTlRmmxW8NB4r1o+Z9A10j2Hu+j197JZMC4oyr9R1ekwYBN?=
 =?us-ascii?Q?xlbc3dVR181rw/HdM2tumySQdAwH/puk/poQvTKsjwb3Lz5Mr9De5CxV/VS1?=
 =?us-ascii?Q?EMo/mkIAlu8tuiKFU4g9DzWqcREiB7OlhrSS7ZjxgcdNEnJn9m8bhCbR2lcN?=
 =?us-ascii?Q?ArHCiVg3zOO8AKNtwTx6GkE29wNpk1l4p4CUat9GEmUx1l3ArxmZHOeUpGVf?=
 =?us-ascii?Q?gZZu7oRXQ+hT/SLEzR3qpN+0BF6wc4STRbZGQcqvIDVsfdXkWOyrqF6wEMtX?=
 =?us-ascii?Q?rtoRSwytcx+iYsgNLY8TDGEl/JyNeGSWjTGOmW1gfA+6EE9dyTYvBnYChUC2?=
 =?us-ascii?Q?GgLCvPU1O2iK8ShsiZEp6PmlPrjSRKM8/slvQcxwOVM06QjQX3TdjrYq31hv?=
 =?us-ascii?Q?6TMpu5p8BS/Op7oRiXGKWKfiAOI7nP8zLH4ATogFQh4Vubp0xQoP6nYEsUu/?=
 =?us-ascii?Q?M8Cbxn+E5DYoxQV48eoOVYsiHoOf/ywrTAufT7fl6KUAScfiIRVQ/69GWLUf?=
 =?us-ascii?Q?m/nev7QpDzntAW+Y7vD81GHmkbYDfVR5pvqdLjmTfzwTzYLvQve1+QMkaZiY?=
 =?us-ascii?Q?jYOel6AY/0c3Bb/70cuyoau9n5q1QTbilbl5geUBdmTegwo/eWmaBPv8S3uj?=
 =?us-ascii?Q?ghqtBDsRvz1QN7p8eRJXqlwVZEvbCdwl3ijV3lNPu9RUCPkktg6FCmgnqLmB?=
 =?us-ascii?Q?Jc5VYnycXo+Miw0NuLOaIF2C33sO0YYaPG+acbwBKVOx9vGNDlj/9YufCwNX?=
 =?us-ascii?Q?Xl1I/GscwmD2N1kN8RpAPr6qK4zs/b367ODn2CVyiy9y14rXaOQbqwWV9Pha?=
 =?us-ascii?Q?h/mCkJs4HZ7eKh3fuPHRTdPhJqg2/L29wiHM/fkDdBuRlBCPUB1Ih4wilrns?=
 =?us-ascii?Q?ci6KCdu1pCM5M6tgWygLlSf593FvyT5Pk3ld1yQD?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5276.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 0ddbe47d-663e-4d25-66b1-08dc3744f6e4
X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Feb 2024 03:34:11.9144
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 54jp9W/zxKdxXchqoyDHVJvyGY+JQEL1xSHSBuQxUMXPDe+lUNDke2C96TR4mNLzNYNRBBdYQt4ereipEEPnbA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR11MB6069
X-OriginatorOrg: intel.com

> From: Nicolin Chen <nicolinc@nvidia.com>
> Sent: Friday, February 23, 2024 5:24 AM
>=20
> Jason has been running Syzkaller that found three bugs.

could you remove "Jason has been running" from all three patches?
Just say that Syzkaller found a bug.

>=20
> Fix them properly.
>=20
> Nicolin Chen (3):
>   iommufd: Fix iopt_access_list_id overwrite bug
>   iommufd/selftest: Fix mock_dev_num bug
>   iommufd: Fix protection fault in iommufd_test_syz_conv_iova
>=20
>  drivers/iommu/iommufd/io_pagetable.c |  9 ++++---
>  drivers/iommu/iommufd/selftest.c     | 40 +++++++++++++++++++++-------
>  2 files changed, 36 insertions(+), 13 deletions(-)
>=20

otherwise all look good to me:

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52])
	(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 3533F13D30C;
	Wed, 28 Feb 2024 22:59:33 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.52
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1709161176; cv=fail; b=KiY7cotv4HbJvlcrCCNp3gQqNyLbp4+NWP2qFUGbEY1WSAcdVfB7Qi8vxv9fIyYzEejctNQFrKuAYAK9nQWm3fOQj4xK+37+mAwOw+BVtDCaGIR0lNRzJsbk44tqbT5gDMBz7yiT6YgJ3W3puQVe8xoU1KTmDR6mFv0GzjRcrFo=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1709161176; c=relaxed/simple;
	bh=6c/qeXAkM4WTt+H5WPDa9HqIIaNyAqU2sAYoYJDTBys=;
	h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
	 Content-Disposition:In-Reply-To:MIME-Version; b=aTksa2vUntuSN4chJlH55iC2YjR5qSNvi04lF2srgT0xgs509qunicaBoo5aC6TqRydNL3Ts0HrTFrXvZEtUBmOBPrTKjI4ZL8kEHfZEQjuZpkFBwEMFwxhcvvww2SJ5D6+5Xb2l6yoHXS9MZOZB3HnB7DB2dsPRoXZo8skkEEo=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=M8pO9Xkp; arc=fail smtp.client-ip=40.107.237.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="M8pO9Xkp"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=kyABQSaTBV4ZvM3SLb5cVkk6kNeRYfEOqP2m+YzdzDLIdauTK+2v8sPEArL6/HF/izCCR1167SiQtlbZYv10pYFNhkzJrjZ2XxmEfIG1zXf1S6z7et23XzU/KeKp1r7/Aumzl3DQMKpGfPSh/rtwIaIquLzZ8oh5nZJmMfB8WwMzgcUjsuIGkFDJRObmhGkKELr4kF8+laOm+W6Mbv/aomgYX5DjSA+voWa63B1xnFL8bGYtYJ6ELeO3w+XpuQEcTY7p7MXyKjGABSW/JtOY53s2WFNnS5MZ3hHC6Cd2MtJohCNh10VGzeHwFnLue6rkbNSAnuQ+i0j+JWwEXSbDwg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=454o32wUhxMQJq4xDHQ/PpPJSgTNAAGKSfoUpoTO3xM=;
 b=hvnXJiKNAGQ37oz46BERzRia/U6d8CC+gS19rFqju5cbT5jXK4fe2KmTO8LOkUn86IPGVjsMc59WRiPnra85Scx+4EbDF04Vu1seQaAWtDLNHJ9E6tZcgsD57IqW6QuXFwBRRWZQd49OghicD66Iv5C3RmNrfvIrhe/lGsi0JouuhjL5Vpt6KUL3EZ8cTq7Jw0giOLpChJCQqOSxYjiiaf+dd0yylz4VBzQv1rd85g513sLud+RlYNQBhBmGn+n9yw8MI1vc+HDcYmPKnerib5tr6ysBnMR8jOTeKISMRKh8HZ9BIJ2soVee1gO20ZJUpBHOBbj05om/pqmezKNCpQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
 dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=454o32wUhxMQJq4xDHQ/PpPJSgTNAAGKSfoUpoTO3xM=;
 b=M8pO9Xkp4DcnGrcI7x5XDEMGThOrHr4FNet+gS8s8qBOLvDZki78BnILEjW4VLfFShYn6afMNc819uR+Db4bYNEycXGX4TAHplLFx7CF8mn/cvOtyXIwOTDpxQhNiLABSbhy9M72u1TiDgwHedA63RZukjW7cbcIR9ra58ufr11+hxvN1hWK0ZXZEpaTv8BYp11WiMWz5q+H/lJqlSzF89UuVy8OznDwgzpWjWFt8H1xCMsoCfPlqeoQDyG+TXKEUuJZaqwY2uW3637QqdIc9v3geojvh5wO5uruyjZxOL8U+pMys2OmtwQa7JHO00sdxoFxmlQUBYyueOTdELQ3DA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nvidia.com;
Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26)
 by SJ2PR12MB8848.namprd12.prod.outlook.com (2603:10b6:a03:537::6) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Wed, 28 Feb
 2024 22:59:31 +0000
Received: from DM6PR12MB3849.namprd12.prod.outlook.com
 ([fe80::2e3e:c7c0:84da:3941]) by DM6PR12MB3849.namprd12.prod.outlook.com
 ([fe80::2e3e:c7c0:84da:3941%6]) with mapi id 15.20.7316.037; Wed, 28 Feb 2024
 22:59:31 +0000
Date: Wed, 28 Feb 2024 18:59:29 -0400
From: Jason Gunthorpe <jgg@nvidia.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Nicolin Chen <nicolinc@nvidia.com>, "Liu, Yi L" <yi.l.liu@intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"patches@lists.linux.dev" <patches@lists.linux.dev>
Subject: Re: [PATCH rc 0/3] iommufd: Fix three bugs found by Syzkaller
Message-ID: <20240228225929.GR13330@nvidia.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
 <BN9PR11MB5276D622986E55465C3977CB8C592@BN9PR11MB5276.namprd11.prod.outlook.com>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <BN9PR11MB5276D622986E55465C3977CB8C592@BN9PR11MB5276.namprd11.prod.outlook.com>
X-ClientProxiedBy: SA9PR13CA0084.namprd13.prod.outlook.com
 (2603:10b6:806:23::29) To DM6PR12MB3849.namprd12.prod.outlook.com
 (2603:10b6:5:1c7::26)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|SJ2PR12MB8848:EE_
X-MS-Office365-Filtering-Correlation-Id: e4058933-0326-4cdf-39e1-08dc38b0ec4e
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?us-ascii?Q?cLp55OBzS7D9I/MVx0Bey+Fyacf8+yO3HXxDOlf3AqePbZfTKnI6EkyUYXAL?=
 =?us-ascii?Q?HvodTsPBXAc5mtU7Mj9gZDVEac4jTf4xf53QeIQ8lZRWrCYM80NakWvz+IW2?=
 =?us-ascii?Q?jkqSvkjPzJAh0p8L7o8UrXaT7lErguYVKEW98cPj0yNd/CFb619DOoBJJoHw?=
 =?us-ascii?Q?oE8kJ39T3mfp1uGKNBBd0xBeednNQk+Q3wXqC8R2qMlkFkKQ+ulemyqq0pbi?=
 =?us-ascii?Q?hrpH0Y4lIyafLxwJbd28nibfQuHSiWEYxGqPPkbSJqkHAtx/9Od6UvqDdVqj?=
 =?us-ascii?Q?naUcf1M0/SQzI6VlPwYLZ4v9nIm82iZvY8t/rQ+KhiAmFgZ59V0VJ/j06pZu?=
 =?us-ascii?Q?s1hqeTBcRlSkPhKA1Oil2rVqQYhiPhzxmCcK2cHn8+0C9usVzUIftPk8NO56?=
 =?us-ascii?Q?xRwONHQ79cCSscQMvqNMGvxBliSCesahkBdrDTYOEa7Dr18ciNhHIWN+H2gU?=
 =?us-ascii?Q?CEMdOUCm2Xp9ghIr56OQa9F4OshhMrvqHQBNTYG2A6lHvI4EmwhYEUcuR1mU?=
 =?us-ascii?Q?lZGnbiZEHNc7LogeEYXV15wGPhaZdIhA96kMZc+sk6WxJZ2gSZ640tg8Wq53?=
 =?us-ascii?Q?5kaVjulmC0tfqbWCUEutcUy1rBoaJZZDRscjvD7DLhNY9aPEWL6Wnuzq7cXt?=
 =?us-ascii?Q?a8t8rY9WnoqXIx/HQ/5dbiuWuPAXFO31Xqxnj9hcirwfSsvuHEzzopHBAdyS?=
 =?us-ascii?Q?h8c49bn0dg/2y9IpDA1TYtG+C/pKkCAd75xUyL7XJPhmLC38wlQNjrJ72ZPl?=
 =?us-ascii?Q?mBF77rn00J/4iHNDccZALTVcdDFjp3i+4Vgxtp4bUtcrzqgmgIv5ZsLKJc3e?=
 =?us-ascii?Q?3hfX5IWCKC4GX31vu7j4qWH6DAvXz24x0TpxdCGX+Z1Lm5K1vDxVdwjVNbuv?=
 =?us-ascii?Q?fCIenFbgD8xkkE63o/OXbWrMHzsBuKrPIAgj2GuQVT6RE+386muGrtZDe07j?=
 =?us-ascii?Q?yfegy4T04o4THXdzaTTEWMfvDgEV7ApodeRszf15++qVVrIojfao/KieVItv?=
 =?us-ascii?Q?NEPdLJzN25gO3O93SkGikbjzA1jy8OfN+PpRq9KR8KINd/fXLYtPYXS2payN?=
 =?us-ascii?Q?7CeHVY9yiR/263dHjhlS2ISNAgjXsPjd43qbekACrofxaloj2ULaPyEYd7TB?=
 =?us-ascii?Q?9eGiTwAiZVLPZU9QdV/HxifF9wiSRfH56cy7shPpnT1MRPtI6MzVNoDWjAZn?=
 =?us-ascii?Q?bu5wZUwAkUzmiiJw69VAQKUdGyJdUVQcPo3dn8YGY+7VVk6Nm+8fO40s2sVt?=
 =?us-ascii?Q?3GYpaJa81V2r/E8QQUlXNsxKo14qHfiWQFqU65qhEamNB2DqhJQIQPMXgODY?=
 =?us-ascii?Q?JbzXu+IVAOTPYVWtAKpIobTXiwMskRXo4rm4DtWULvlvArX1gwhO0+jA4dLh?=
 =?us-ascii?Q?BNDcZ1rydzCZNN8RSs8LcSXtvwgX0axybcxiJlIQepDGuGcHWHsB9pygLS1j?=
 =?us-ascii?Q?v4nIGcX9UowZvm4qS+SV2o8WrDp9NVZ7euxuDCmPqCstP0NzcQehgyPzM0nw?=
 =?us-ascii?Q?tSmUZG5RokGtmOxZsSibuXPZhr9AYcSbirQsVO92Mm8uEAXvNzyQwaEm677a?=
 =?us-ascii?Q?ZGMyjBcDmyeCezaUlko=3D?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e4058933-0326-4cdf-39e1-08dc38b0ec4e
X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 22:59:31.0931
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: i6Ut08zTqhTjeOt/aQxVeZk80Po+yIZvQF2LwrQT4KW+gQrVWshROTWDyyvDxSkq
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8848

On Tue, Feb 27, 2024 at 03:34:11AM +0000, Tian, Kevin wrote:
> > From: Nicolin Chen <nicolinc@nvidia.com>
> > Sent: Friday, February 23, 2024 5:24 AM
> > 
> > Jason has been running Syzkaller that found three bugs.
> 
> could you remove "Jason has been running" from all three patches?
> Just say that Syzkaller found a bug.

I will copy edit the commit messages

Thanks,
Jason

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2059.outbound.protection.outlook.com [40.107.95.59])
	(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 C174B7A154;
	Thu, 29 Feb 2024 15:59:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.59
ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1709222352; cv=fail; b=RTOY6dA6PmPEGfX+9Mg8SVmI4/ZQhGRvL3LVjHUkZBzJKsGapVnr1wX+pq9l2epvrCQlW8P8A+7tKwXw6a1U6hjKXSwTftuZ11bckRpWbeEXa8EPdO8bBWe+sN0nYLkuEGeFjmULpV+0x/71lDERsWGj0EfR9UKF4t3waXTaPQ8=
ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1709222352; c=relaxed/simple;
	bh=2aI58htm/wzmgto1zC3nAKWxhbBnwdvEE2qV+K3m6TI=;
	h=Date:From:To:Cc:Subject:Message-ID:References:Content-Type:
	 Content-Disposition:In-Reply-To:MIME-Version; b=HqbdrPNMxlP2VkXC7WXMEF9TjI/H8UWKXDQR18yP9vlA2ihgYHBqd5+z+IJY5wRF6QECL5e752q8HfGmg5xh5Yp9FDd9Z5zw/H0vmNIQalKmFzob3AkpXomlULffQSf8EdoiGcpnDfSM7JmbdGACpHSWck3gPJK5Te/9hkbXcZY=
ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=JAjabIoc; arc=fail smtp.client-ip=40.107.95.59
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com
Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="JAjabIoc"
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=mZeP/E2z5VP3Xh00Rr1FxpugHJ6hr3y3swfaHYXmj2JebGQEG5Jfx+Ecyr/W5QJoelfXqjc15LPLoZbadSg6cC2clhldlRm8EvWA7xEuq4uS2ot/7sUu5LFO647cqCtGsuyJxiKKnsHQLO/YHoGOKgI7MAghDPq9eNOOKaVivOCS/ms+DqmPltQDssyw9Im8KHhBIv6W6UxuMyIQ7s5tFFQBAq3oPzttRBcTrEN1UWzGom0yhG1TqnI1CqvYoWqUqi4UE65Vh7LKsIE+dh8E2WX3gW3HHas6+DTHDCUa0PXtfEukwBQ7I4t5WWNw3Ii4J60H1OQufNUlsnzIvk9s4Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=K1SzbiqgQ8envCdajNnj+pP+4ns6KZCzFXb+bcQGBWI=;
 b=cNYm7gOEDLxok0zn6x9ksaOzWMCUtloQiPOytsmV0FVpQj9Pn43E3JkrOH+QI+KkSDJA+25zmm+qdukpezNRAtdSVrDwBcl9smRVjgRCPATwA8GstS1E876y81VbIlvR3l/JDH2UWq8SrK5SEcfFAvJwcGQvn5pHU9HQLUqnjbOZLsDTrz4B7+WFiE1McajAjChVzwooya/A0s7x9u+qho+Jz4EybkzrAM1tl3eQY7qECq16rA8qeWA22oa0Ntom2/hKOgihO75TPIE1W6Bnkn6CzL24DFXx17cXF7B15BTCbwpqqPoPx9xDzXErMh50lFBYHtahuATmCT02T1chTQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;
 dkim=pass header.d=nvidia.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=K1SzbiqgQ8envCdajNnj+pP+4ns6KZCzFXb+bcQGBWI=;
 b=JAjabIoc9kYfofjoEbiyhUoVRU3Lw+tUagL/6wHhv98+/fS2HCufzLhBegjmNWRpVGoaJaPdCwNuVg+EP0xuIW0226BarSfWAtpu+9j7ZyWm6ZVH0kPbY+ZahG1FOqYfSzV5KG+rvYc3WDa3SEK9R8Yxy/q0EXAOVavGPjoY422or5Ckz/Wtj0f2Bb/3QdTzfXVGZQGlPFO5+nCwmqSJugZJSo4kKCBKOq1a88FuOFTmUtPvQRJa+HZnBwiebH/9sAFKR/L3gqCr4nzxR6E5wXL5zpUVu8TCTeg0V1Mwo8p23guoy4SFFI2JbF+cL+PKWCL+eOSg5ROJk/S45PdvEA==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=nvidia.com;
Received: from DM6PR12MB3849.namprd12.prod.outlook.com (2603:10b6:5:1c7::26)
 by IA1PR12MB8077.namprd12.prod.outlook.com (2603:10b6:208:3f4::12) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb
 2024 15:59:07 +0000
Received: from DM6PR12MB3849.namprd12.prod.outlook.com
 ([fe80::2e3e:c7c0:84da:3941]) by DM6PR12MB3849.namprd12.prod.outlook.com
 ([fe80::2e3e:c7c0:84da:3941%6]) with mapi id 15.20.7316.037; Thu, 29 Feb 2024
 15:59:07 +0000
Date: Thu, 29 Feb 2024 11:59:06 -0400
From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: kevin.tian@intel.com, yi.l.liu@intel.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	patches@lists.linux.dev
Subject: Re: [PATCH rc 0/3] iommufd: Fix three bugs found by Syzkaller
Message-ID: <20240229155906.GI9179@nvidia.com>
References: <cover.1708636627.git.nicolinc@nvidia.com>
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <cover.1708636627.git.nicolinc@nvidia.com>
X-ClientProxiedBy: BL1PR13CA0221.namprd13.prod.outlook.com
 (2603:10b6:208:2bf::16) To DM6PR12MB3849.namprd12.prod.outlook.com
 (2603:10b6:5:1c7::26)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DM6PR12MB3849:EE_|IA1PR12MB8077:EE_
X-MS-Office365-Filtering-Correlation-Id: 8758b848-4570-4b41-38e2-08dc393f5c3b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info:
	 
X-Forefront-Antispam-Report:
	CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
	=?us-ascii?Q?o9F2g2RwimkCTnJGTDKdh6AmkkAuWke5dZfYV/LIrkdG6k++8dypK+s1bX22?=
 =?us-ascii?Q?8aTfOqcSCfCgeL1uN0XwtTp3wre39P+jTjhPQaFcp5iiXZKZHSA7pO59CF70?=
 =?us-ascii?Q?FYkVchl+fmvuaqzp2DvLhxwpn8i3HRmThKlkBt1lTwUuzHpiY1Vmpa3h81Rv?=
 =?us-ascii?Q?cIdRxGVfwc0C5Po3/QwwXPFjvAiyvFZIOtzrH0TY3SsR1kqcw0UOYb7MG66k?=
 =?us-ascii?Q?8RIT3m4+b5n77sJ2EdNNHcN28ars81G0q/ezqAhMZlNp7wonn225iFHiujQO?=
 =?us-ascii?Q?qlytA0YPP1hnU9pyQPvgYapQIx4KNI7xFOTyfvxjx2nxjcIQy2zjzaN+J0yI?=
 =?us-ascii?Q?GmbXSnZ0iBkM3JZrWeEZBcHIYQKrB4F/GxpI00HNQODILcxlAJ0q/OvDbbPp?=
 =?us-ascii?Q?n8HnpGaCgddsB3s7ZkhuqnrZ6OEABNZ1nBi4rWOF+RZhwjwCzWMK6tVvPz5R?=
 =?us-ascii?Q?Gz2Ue8s4fBOowXlrAi8AR+OgadjAHTWmsIQIX46t6XrE9hbQRtMupltDSks3?=
 =?us-ascii?Q?spY/JIwuro6pzJqVwEFJIEGNrhTxiSjmPHIBit4phPqHiRcQmq9MVZsH1DfY?=
 =?us-ascii?Q?DD5KPn8kFSshvE/XZ/4HCrt2TbfYr/sHxIi+XGFC94VCvPh2jPKkp0mVqJOt?=
 =?us-ascii?Q?dDRxnB5RWOR0uNhlkr81mJcBxnHqQ9k7sI43qeqQdrXtRb4DEmWRg6Ioc4JT?=
 =?us-ascii?Q?oNlDxYx2LpT6jPB+Vr/gRHHRa0G3pMMP0YdJheIwTRD5wQPDlXMlAQjWLkph?=
 =?us-ascii?Q?Azq2H3RL1mzIyRCl8DDuGqGUsfUNEzReH7hjyRfK+rOnJrPMRyK0Y5jJKRNI?=
 =?us-ascii?Q?CyZ0uaU/ux06w3yw6oo+I0MINTcca6Kq1TEY5bO+XZxIT6cEluktgRXGiktS?=
 =?us-ascii?Q?/2++CTWnlG/dlPD/mpJU6gMrqMyqeSAa1sxFDxOjuqd0RrlhlW6400pxr1aM?=
 =?us-ascii?Q?ylRd6eO6jFW39JSCAM1JR7qP5SrH/IpSQvYB8OPMc5bSrO7jEkeP2isVMZL5?=
 =?us-ascii?Q?8S5TVZ6/K2fx9XtuT/tZlSEAjuf6rPhshQJot6iOV5PzV4jBtIJeWthPuKDw?=
 =?us-ascii?Q?upAbWtPSr7Dddka3GLkLSAOkBTkLMuTRN6Ir295b+jhLd78Hh83SMG2zPrBF?=
 =?us-ascii?Q?Tyl60xQgChtFf9wHyxQ54FuFSDvhtqXYOH2FTYE/VZKWWTEcObwdH7u0mj3L?=
 =?us-ascii?Q?Suu59oY1GiZlzAWOi1+0B+LqQ3+G26pkDh81XqWjuWwqMnYTwY16yxAq7qfT?=
 =?us-ascii?Q?G/7r3BPJco8addRnCq59Wf1vDkbolxiYgbTy6N31kPOoyR7vhAMKvCQLd7bR?=
 =?us-ascii?Q?4f1IG6YM/l+0aV7ZwqJCfR47/u+ACAIOVJUugMDN7HY6PBP8U3S42YUdTe/E?=
 =?us-ascii?Q?n+yMxhACeMYDTffRwCxHmAJZPpoGl90Yvm7XMnJ27kuw6oT03LtUPBBLyGw9?=
 =?us-ascii?Q?hZcpAzy64lWM9A2UU0aoZi9z06IxOoR/p3KVWEbEJssL/9a2XcCGvcz7dEGr?=
 =?us-ascii?Q?1DWFW850+AkobI8TFEHeuLvbQzGGytgKV7kBEeK1YJgf/PMQ4LjVI3rrOS8j?=
 =?us-ascii?Q?A1yWRZkIXwqqiugE3qyI3DP0jsLOOAtVaZeCNDtc?=
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 8758b848-4570-4b41-38e2-08dc393f5c3b
X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3849.namprd12.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 15:59:07.4422
 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: dUFQTkXrZLFU78iPMtXQ2yiMgQvQEfF5s5wO2tDevpa+KgHmqY1bdXtnRrhV739p
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8077

On Thu, Feb 22, 2024 at 01:23:44PM -0800, Nicolin Chen wrote:
> Jason has been running Syzkaller that found three bugs.
> 
> Fix them properly.
> 
> Nicolin Chen (3):
>   iommufd: Fix iopt_access_list_id overwrite bug
>   iommufd/selftest: Fix mock_dev_num bug
>   iommufd: Fix protection fault in iommufd_test_syz_conv_iova
> 
>  drivers/iommu/iommufd/io_pagetable.c |  9 ++++---
>  drivers/iommu/iommufd/selftest.c     | 40 +++++++++++++++++++++-------
>  2 files changed, 36 insertions(+), 13 deletions(-)

Applied to for-rc

Thanks,
Jason 

