Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1531186rdb; Wed, 20 Sep 2023 11:41:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTw9Lyy8XNpYcQfOsZYiaeDOhZVVOsER1GO7XX1+sgnUikkU8FJjo935sYS+zPvOSkLIKi X-Received: by 2002:a05:6a21:999e:b0:137:4fd0:e2e6 with SMTP id ve30-20020a056a21999e00b001374fd0e2e6mr3750758pzb.6.1695235306335; Wed, 20 Sep 2023 11:41:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695235306; cv=pass; d=google.com; s=arc-20160816; b=0w5xfj86DDyyGrGCQHLAmQTImueS6R+sQ72ZCsjKSsK8Dob1mqTpNzgnL2Gd1tN44R 5+LEMKYGMI5cnJFYZteAJH4U/8Ls/jJY17hVNH/+DL2b0K/YD8zi6soWAKSZiKk1AQo9 QdC1M882nmbCNCjNwGy537hzDU8Mmg2exY5KuByF1DG2IzIBzopgnTzhse2rHg2EGlhB 57cemHGCJkSao/4bYzTHiD2Bln7BiCITNbfNHih1FQO04jWSYpkSXSmlGHx/DsayOjmI hL3br0HVDtSJ0+vVPf024aaAoqFxEZHGWeBc8fyRwDS+Qm86AHc6dCRfUJK5SdAgsZGN fRkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yIG/Gq5YZPbCV92/HN+i3wEWEJiFnj6txDrJHePjssI=; fh=EMUvp6C3Q3HZLr3vQ2Vvay1OxhtpSVKZRa9HY2LXjGU=; b=qg99a1k3cG6i8xPrpxMDYvhvSZTNYX9A2u8rNbMTetNmXWNDDhe12nnWAkmY1KdK2y ZgDlqF2lQP7fpmrzPzsm9I0CA3Qf61nL2Kg1C34iICs7FNC6tumPJ7Wvts+IzE36lQvw jCoTNW4+48sV35bicy1uBBGf9dmJYQsZGlp4s30tHG7G/oxVlLJOy7gHUn9PJ5dqJyQ3 DWm8IazXRU9tUWWs1+M257BGP7LEcC9xUbCSkwZay5SEx8/9R9pKpGUz6G7/+84C5nEH 9OJWoM6UJaav/vCiEuup62Wq6y4DqACdS1Zn9RBg/QKrQHoRSlvrL91Sw4ImPvmBRICG d1qg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Y9GzWAjk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a16-20020a056a001d1000b0068e47f319d9si12297518pfx.280.2023.09.20.11.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 11:41:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Y9GzWAjk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CC79480384C8; Wed, 20 Sep 2023 07:03:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235165AbjITODF (ORCPT + 99 others); Wed, 20 Sep 2023 10:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234978AbjITODA (ORCPT ); Wed, 20 Sep 2023 10:03:00 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A92BE0; Wed, 20 Sep 2023 07:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZLxeAbGMoe0MueMDiUeG7cAr3ofxm+KiMY0ulFs3FwJ8IHlNQ2dR615VoVjbFKloJxn0AVsfhWqp+dz5WTroCVwOsanITYQxg65cgGXqkNXdgg/NHpLHJ5He1pIz30HI1c7Xnf+XaZgjXSf47uULXZMpRwiQPgsw7+8xTqP12mhlrN+6ZyhLzWXjtRZO+n/yOAI8rcNCCVjX8Mv8fIGM6ipsckLNrGtu9LluTFSbfDbmw++ihPFeBwDMRtQhd3JUJE9yE2bYWHAAjBKFEDYz1R100CanfUczcl3uQDmmRbddqOE4UOoGigEs9khcP563t2xW3h7fXEE/eipt4HXAA== 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=yIG/Gq5YZPbCV92/HN+i3wEWEJiFnj6txDrJHePjssI=; b=PRn42Kud+MLQPYTNFFQI1P+isrIYgAcPFnfZdcOeytFvu/cqkI+DA96w4YcQ+cCH3K6Pw53yTUhUiMqqxCr7ieFjuwk0l1xKS2BGu2B3ipVf+24lcepxLSWXUjkvHrekCVRka7lV+CNa34bLKyieeByLWZFHBHy/z759LwEm/Dh2YY1Y2DKTOh7xC0FrMIgI6LPZUlwrmk5HDWmKKz3yh+/nC04MB+7rBjhsuGJeN5xW76YzbnqCDzH6SDXIN9uFp+pZkZlPga2YXJtZFMZa45ptCMm8GPP7XIPpmiImhFNKdoACxqmqGZJAcWLKrNZbVn79z/dHbAH7ar1KdcSY2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kvack.org 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 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=yIG/Gq5YZPbCV92/HN+i3wEWEJiFnj6txDrJHePjssI=; b=Y9GzWAjk0zyDHTmj9C4+Ek+E8jyGmU3ZtOtLpkL+FI7Jm/AT8wJBosRQpNqytJN4uDZeAJj0fGczqA08MJN+p0nwNNGKCYeXEp5t9DVvjIS9rOL/XDLz2E68bCDwGsx9V96g8KwXbpUDL2an7l9Vo78X4Mdewhe3CcAH03ZH/aEoY56fe0MjWcp9d/5AkJWMNpRbTdI8BbgInR99kj9PP69cM/kEoIQ/Ma1ulrojKJI0aNaFWVsat6u7X0gsPRqtf0L4rSOVmjphEY1TiKoq/pi3AUkhc61EriaxSa2Rf+7WJ8m60GdWyT5hp1xKnK41Ekas5MD+4/XLHruhsYLuRQ== Received: from CH2PR14CA0013.namprd14.prod.outlook.com (2603:10b6:610:60::23) by BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Wed, 20 Sep 2023 14:02:46 +0000 Received: from DS2PEPF00003443.namprd04.prod.outlook.com (2603:10b6:610:60:cafe::e8) by CH2PR14CA0013.outlook.office365.com (2603:10b6:610:60::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.29 via Frontend Transport; Wed, 20 Sep 2023 14:02:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) 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.6792.20 via Frontend Transport; Wed, 20 Sep 2023 14:02:46 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 20 Sep 2023 07:02:30 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 20 Sep 2023 07:02:30 -0700 Received: from sgarnayak-dt.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Wed, 20 Sep 2023 07:02:25 -0700 From: To: , , , , , , , CC: , , , , , , , , , , Subject: [PATCH v1 2/4] mm: Add poison error check in fixup_user_fault() for mapped pfn Date: Wed, 20 Sep 2023 19:32:08 +0530 Message-ID: <20230920140210.12663-3-ankita@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920140210.12663-1-ankita@nvidia.com> References: <20230920140210.12663-1-ankita@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003443:EE_|BY5PR12MB4130:EE_ X-MS-Office365-Filtering-Correlation-Id: cbb806d4-28ed-438c-0c44-08dbb9e24445 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O/SSvjLpNYBbgXSacNhW9nrr0LphHgHDkpLTK4rTXsP3MT9kYoUOF6Wie8AIIDQ5m/36KOfqfOi9Yk1iF0BwezREN/+oQRBvZSo205Wl4sgLmffcOtGrln1kSzyc/mA+Iy/sPxWYXrZiO0lZxufXNZp5NRSWVco7CgmzEt/vWxe2ApXtOhEFMT/T5W+ubtNT98dp9EMvQC/ME9D5gTkqShzlq5+/bdUfnsWYgd2XdbHqKjSx0Dhp+sHRIfehuso3ePJ42c4ElEpNnpV7ao9Q5Upx7s8RxQul1TA8/an5AtzXcXYfzvwj/SVgNGs5w9Nl0eZkpjalk1064th+nRnv+neERZwmnqBs4UD2dIAboFun++qt8//YV36Ghg9/IHcffIJgHRplcDGyEUBLeSbXtURyFgBdFId7o67/rNUQX6E1y2E174Y/StcnpPCPJMn9mTgcknAFkPJdHXRRLE1sVD0sl32WVc7p3bIlACo33edc2CLjPcag9QZZQKGEDqq2qTKKDbyTKyyA8vyE4eAsqRvcitUFh9ywFgxJdGRsPTo6+e1+EtWM131ha6v9K6Nq1CZQf7dilWSxrAJHs/l9UGCE9tm+Ye6/CO0qT4K0Pr9vMrypfDmNleamcL2x9umv41r0cniN+hVA1cNWHkVyAC3uzxCcOgP57kFBSDgy2i4TAKvKkgEMrudLwf5ZBV+rVadwlbZtxmViQ6JzNFfafjGv/khT/o+vhFcXFqsWiDzmDnJqSQme5Ivddbi2jUp9cD0QXgTKmZ3spAujCCn4Xw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(136003)(39860400002)(376002)(82310400011)(1800799009)(186009)(451199024)(46966006)(36840700001)(40470700004)(478600001)(7696005)(6666004)(83380400001)(47076005)(26005)(1076003)(2616005)(426003)(336012)(2876002)(70586007)(54906003)(70206006)(316002)(8676002)(110136005)(7416002)(41300700001)(5660300002)(4326008)(8936002)(2906002)(40460700003)(36860700001)(40480700001)(86362001)(36756003)(356005)(82740400003)(7636003)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2023 14:02:46.0617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cbb806d4-28ed-438c-0c44-08dbb9e24445 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];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: BY5PR12MB4130 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 07:03:09 -0700 (PDT) From: Ankit Agrawal The fixup_user_fault() currently does not expect a VM_FAULT_HWPOISON and hence does not check for it while calling vm_fault_to_errno(). Since we now have a new code path which can trigger such case, change fixup_user_fault to look for VM_FAULT_HWPOISON. Also make hva_to_pfn_remapped check for -EHWPOISON and communicate the poison fault up to the user_mem_abort(). Signed-off-by: Ankit Agrawal --- mm/gup.c | 2 +- virt/kvm/kvm_main.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 2f8a2d89fde1..fe469326dbe6 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1414,7 +1414,7 @@ int fixup_user_fault(struct mm_struct *mm, } if (ret & VM_FAULT_ERROR) { - int err = vm_fault_to_errno(ret, 0); + int err = vm_fault_to_errno(ret, FOLL_HWPOISON); if (err) return err; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 486800a7024b..2ff067f21a7c 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2731,6 +2731,12 @@ kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool interruptible, r = hva_to_pfn_remapped(vma, addr, write_fault, writable, &pfn); if (r == -EAGAIN) goto retry; + + if (r == -EHWPOISON) { + pfn = KVM_PFN_ERR_HWPOISON; + goto exit; + } + if (r < 0) pfn = KVM_PFN_ERR_FAULT; } else { -- 2.17.1