From patchwork Fri Mar 31 15:32:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 13196107 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91201C761A6 for ; Fri, 31 Mar 2023 15:33:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbjCaPdO (ORCPT ); Fri, 31 Mar 2023 11:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbjCaPdN (ORCPT ); Fri, 31 Mar 2023 11:33:13 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E73F1DFA1 for ; Fri, 31 Mar 2023 08:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SEYvWJz+tdp5myoJyTkWyW5xwnl/BrJDlKUrc3OArewBQLoP5v2ovBZGh3NmoJxP5Qqq4DgUrRNATaPJ2/wKvRTJBFk4Qt0cYGHxGvmnjpdcs1ObAGfGK1S5o/zoBSrRoJXyuG1EIsEl5vV932ZhRjXtWbH38xd9A0iqS7HjAPN17HSCcYynmRvdLphtLvTvKW7J0DyKx3xzVTy0qMTLXIQQDrzzO0GJVh25vxk4jYjk7ViFCTrEEYbIF2ywCs/DalryXV/sXOjqLCrwicbu1yt3qu7vEZswQ3HZYejYJGS5kzDADiAzqMM4ilAI3soL/K1YEZ8lo6hDlN/hTzi86Q== 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=xCETgn10UD9azxn1n4NEWbXkKG7vD/mdwBqtnG3PTsg=; b=f+qtmRqCm5d0Qz+7sELBg2qrpl4uEPBEXch0uzEbgmlN6b6TXJPwxfiwtco8LV+D3Cjdi4CUjS6+W87ZWltjrgzpyNalhluwx2u21PNv7LuZLa/SX1U8q8ksjTlO7VsC+pEffqWEDHxhrMEOJnudflEk/EhYf9BolNGXQaHxuj9IU6zuT/4WdI8ZDuKeMMeyrxg+NwgTqvaKFXJ0MLqGCqXpj4izQTfi4GJE3G9d0yvwoZzG9DM1A8t90xB+zDwmhwLyk0HoNcL6SlNBVj0oW7LYBZfVzoqZ2Z9128xIbJO7fU7b5Z/OOshxk9LtXDEva+WC48098P9wBm6BhOb2nw== 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=xCETgn10UD9azxn1n4NEWbXkKG7vD/mdwBqtnG3PTsg=; b=D5mwm306HmpC2VJp/kOMWGZQDAPngljrFJJfaBhNNHLaitMsZi8IazCf5bacgXpLJfrRr+QXh5RaQiy4xPkwTzIxoa4DrJB0Svv3nJRRBu9GMc4V85sty9x+XE2SwKrYCEL4hgLp9Wgb4ieZNcVr84AXVUCTkYr8co7NC4V1nP/E9g+3PL7LljXzGi6zm6JszHVfTz19PXY78Eox7FJgovWo8aEJdD75Spju8jCOe+ZNL6vsZGE1oarlPEQ5NZ55bVBs4nmrhug5H5/dnKGhdjEwkIWcix5ti0by7Mf7bpNwTtLxgrCpMWPFAa4rXRjRtWEbLzpmKOJ6XRY4qV31CQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by BL1PR12MB5093.namprd12.prod.outlook.com (2603:10b6:208:309::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.24; Fri, 31 Mar 2023 15:32:30 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::ef6d:fdf6:352f:efd1%3]) with mapi id 15.20.6178.037; Fri, 31 Mar 2023 15:32:30 +0000 From: Jason Gunthorpe To: iommu@lists.linux.dev, Kevin Tian , linux-kselftest@vger.kernel.org Cc: Lixiao Yang , Matthew Rosato , Nicolin Chen , Pengfei Xu , Yi Liu Subject: [PATCH 0/4] Fix three syzkaller splats in iommufd Date: Fri, 31 Mar 2023 12:32:23 -0300 Message-Id: <0-v1-ceab6a4d7d7a+94-iommufd_syz_jgg@nvidia.com> X-ClientProxiedBy: BL1P223CA0028.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::33) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|BL1PR12MB5093:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f2e5dee-1ef4-499c-cb84-08db31fd23a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a0To093sPrD2LEV4H0bayaN3R9ThYItenGxuh5IHmYbn9gHbO8xkEF/+qAo9pIPxc+F9DVL3YvFrwmXT5FAMy7WRgk6AudhuJs8vL7IEBw+BbxkYfr6SH3jRw2kAw22WE3Jhlau1/XjvyRNeph0EvrRLMqyRRWqEwgnINd+vJa49FXr6e8xVRKJXwSXl4JrCo2q5wpwnsMPkTtj3AgFjzTN0nXxXu241pdMOjJFGRonvVDAM9RIppVxTW+SlRfnoW1sO1FhsSK//dSYe4YfK6hCNZkZfaaArIz9ohXYBwFcJKkA6qXmhVhXl3basxMtWxICmhw9SFfHwRAS3nV2x9uKzSXEWfkArjEcp8Z8UTLH7xf3wMuQip7bb8iajl9hFB9VHj9UHsOYcpnYZAeHHni4WQsysHDqwumPw3ydHRk0Ez3W4Car+zwWzxArIUoEaHTcbQeRVe72q4S2cYeZTRlZAMXOyFRb71POI+VyP5gkUqwt+W7yh3G8AtXeYJmCzGaxkN2gY8gy6tO8Y77CXKe6VPR04ZJGTAVxzL3iQknSRPM4Hqp730TTnnBdeMnASub5+vYrCh6tCoYrQxmYK9qfcYu5Mb7bdHxCOIw8Dd4o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(366004)(396003)(346002)(451199021)(8676002)(54906003)(316002)(6486002)(66556008)(66946007)(66476007)(4326008)(36756003)(6512007)(6506007)(6666004)(26005)(38100700002)(2616005)(186003)(83380400001)(5660300002)(41300700001)(8936002)(478600001)(86362001)(4744005)(2906002)(4216001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PgGD3wgyLU3zVCe0D6WqYIuKgYeaO4Cs8EV2msNLkOcM+d15O8I/7+ilQ/fXMvGTeEK8o9m2S9znoEOP1wIYtLp0enwxNiyaVKWbsB4kyya8W3905eDWtZaT4Db7E0Q+Rz8l5Lujk1LNlek8/n7Eyw3hnlvX1IkaeELdtk7CMAIByEJTs/iRXKuujNtsIq+ZKHW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xdFxrw3N/nVAjMnobwslYV/vFisOh0lhSaqVZkz80p07Gm6w7744ZdeQrNgglEek+DvyN2GHEPcm4uISZus033g+DBT9oPd4PLhM4AWzIy7XwbTBykH/e0IQeIdEvAIlbLP7DNIxA/8VqV3b9qflEQyZKJ9MAyJhctFzYdtXoaBxinQ/jsxzt6Ja3i8e8eyDgbrFFVmgsynxi2L3/QLbxZkxpa8iqYM8sIYWgloGLXs1R3iUw6X2ddRnT/m2bUzoqrBaesUkZoeR0M7hCGPl53AIY4uU7UWg+VGtbP5ctmAmHj2h4ImzPv2IDUuyScE1v/M8yu X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f2e5dee-1ef4-499c-cb84-08db31fd23a9 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 15:32:29.9280 (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: v533FgWJPK8i+hE8fW9XLRsgK2c4d+/EiOvyIyJ82AM9mPL30blA9026BgC8l/kS X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5093 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org All related to the pages code, and the latter are reproducible with a simple test. Jason Gunthorpe (4): iommufd: Check for uptr overflow iommufd: Fix unpinning of pages when an access is present iommufd: Do not corrupt the pfn list when doing batch carry iommufd/selftest: Cover domain unmap with huge pages and access drivers/iommu/iommufd/pages.c | 16 ++++++++++-- tools/testing/selftests/iommu/iommufd.c | 34 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) base-commit: 9c7d518b9b71f4d5ca3d12952cda3417ac6126c4