Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26774424rwd; Mon, 3 Jul 2023 14:57:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+ibgxOYnR+cph4U903j7ytyW2QfbhKZ3NbIX8f+i8t4B1KM4zqu1wVSRjIBQjxgiYBer/ X-Received: by 2002:a17:902:e743:b0:1b5:1654:96d4 with SMTP id p3-20020a170902e74300b001b5165496d4mr11135421plf.4.1688421466641; Mon, 03 Jul 2023 14:57:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688421466; cv=pass; d=google.com; s=arc-20160816; b=msbmr51pYCFhULr1bj9OSlHjD45PwrX35i7cVj/TcymIRA1+3NlQ8NITMCIuNncqqA 7Zd9ZzXSJGt5DRXWm7bi87EUgoEx6OSrjGG9v9ktHwIFARddycbmYL/cKhwmS6kC994f y3l+aysfmjUcVDoSMB4pM1HmimZaYkPMwrTEgUHogT9UNiYrQ/Pumq1T/DokfyPrwcCg esdg9ard53Z/nXTmL0hqEdT3nWSDMYl6Z/qSMjZriwwfgcu4U1xSotyk7P1GY1XV8DKN 4ba5GjEX8XL2bbPlWOG1HfRxNp3vh1RALk6ESLyTwGcaz3b5Z/r6yqlA5aR2CeGFHzVP gt+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=FmJWX6ok5cR9Q8LpoVmaVhutsyqzMmeKj/CRXMAW/4k=; fh=g7DSsizYAotKJ3zaBmekbDh8fn4Xrjw6GOgMLBhSBDg=; b=g0PpXeRd5stUK9ei26VPT+jw7/J6gggEo18vn7RRNVZN9pU3I2TbjFt7SJVA/RuM0o cTanGsR92xM7cmgz7yXPp3zRyG5Kx9g3C5I/IBFTN8/FsnxBb7g11lXUDtvTAqwmHE+1 Pa1GEhagtTjiaQQyoqdUxbvL30Clzc5ZPB3XsKUo+MeRNKUySO3cDU8C84uhe8B9YtJK nAZrusc1hVA7p7uQpJkYw+t4Fb63g+pRRpC+htTmc0HZXPvlbZNPk36fUhz/rL4czvvz BOzDWQvBmHGnfPLvGNVyt2qRsTUiGM/EmntfdfnfH1r1UFJnN1hyG7v+xoMSNTYH7fNw 5pXQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=IeQIH4Cu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MuOauN2n; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a170902b70300b001ae67aab6a6si18633195pls.172.2023.07.03.14.57.34; Mon, 03 Jul 2023 14:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=IeQIH4Cu; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MuOauN2n; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbjGCVkk (ORCPT + 99 others); Mon, 3 Jul 2023 17:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjGCVkj (ORCPT ); Mon, 3 Jul 2023 17:40:39 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E73C1188 for ; Mon, 3 Jul 2023 14:40:37 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 363G8MeM022942; Mon, 3 Jul 2023 21:39:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=corp-2023-03-30; bh=FmJWX6ok5cR9Q8LpoVmaVhutsyqzMmeKj/CRXMAW/4k=; b=IeQIH4Cuaawdlt0m3hLaUN2r134RrNbGWNsW4oI5fbFFkz91g76JYbd0XNa5DZAtml/9 3Ap2+Rh3nvXn5Ku22l4ZMsbm5NSnEHkUHQTCFqJ8tdZuUbn0PX/LznfdYys6DsK0xASu TD8nQHc9sXTv6FwPQrJTrrsISEO8hE3xsk8hiryq6LBcorPc6bTU//60t68EYdYFVkGB IcGSsIi0a3RFiT+NvovkDE9nCbppT8xEg7+MuexIIpzI3fDH34wET+vdRLvGFaR+xXsu a82xJbqUmxV+QAHEni+pq8+hKTfzzjEgMDPiCfvOBv2zUA+5I+Jqji+gnsi9Sx1vvPY0 Wg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rjb2bkg76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Jul 2023 21:39:54 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 363L1bVG020765; Mon, 3 Jul 2023 21:39:53 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak3kag4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 03 Jul 2023 21:39:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2vIsSOeU/F3jetvQZ48Tb4wOqr8Q/wH9DTbRohnYCPm9wfyLaMtKapj8pE0oJepNq8gTfoJHlfiiZLEKBKrTu/FB56DzZ7jeu4j1epRXrOFgn6fUTN/iVFjuRptGdJIdDrFvmdx4YPtTLW5yATgsNNu7Ug78NFQXHwSglwKh5iCHAS3TwJ8bL+Ew/gjJ9vopwkqYLBue/dk7ujmjfd6U8ZnvKUbQXg591lniTKhF++z6JeZoGmlWsLXCtAt1Lvjk34Yo3GfUlmTKWU8mdAhIbbRWcuuDK9RXPCzVFDnkvjtZc/BAYu4LP2LDxYccPaoanXbPJ+QBikZywyqbIHnCg== 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=FmJWX6ok5cR9Q8LpoVmaVhutsyqzMmeKj/CRXMAW/4k=; b=V5QHgwjLK2FbX8NlWECcg9nbnRa7TLKGXig+VO11XxKMbN29hJs57/liicTlrFwcjxZcDxSklWh1L/L47u0GyTyjBVNY+1zeV9KW/EF3MDH6yY5yOJ0tBjrJK7zmdzcF6+K/zO/dPVOicHJJujgHKhtgXquqAwMdOFPVFlglftBAMRRx0jCB6WE+Pyou4FcFEIImhdweV95IH6hiCRzzgQPOzzI43togAc8mhXFbEg45MnC25YAOCkuKWNTJ6yPJ1U7FRXBDNW2OfNY+RwFXFDqAhbhtiwYUIIdruiaRQYSjORyKpX2KWRyFZJQSeMM61LhoulAaYMPsh+pKSKjhGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FmJWX6ok5cR9Q8LpoVmaVhutsyqzMmeKj/CRXMAW/4k=; b=MuOauN2nQSo8nb+/vxdf7GxYPRHEgWeFvfvEIE2Cjz7l9HFOODSmi8DNoboIdeFRx/ZKl162hVmgeCVw8M5mPQKuOFFerEzGOVFF9GOexo2c2++CetNWHOTRRlB9tm7mr9KiNAeIHjVAc6DEs9vGeETPHTFdEWn2IuCX5w0xWmA= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by DM4PR10MB6231.namprd10.prod.outlook.com (2603:10b6:8:8e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 21:39:50 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::4a17:13b0:2876:97f2%7]) with mapi id 15.20.6544.024; Mon, 3 Jul 2023 21:39:50 +0000 Date: Mon, 3 Jul 2023 14:39:46 -0700 From: Mike Kravetz To: John Hubbard Cc: Andrew Morton , LKML , linux-mm@kvack.org, Adrian Hunter , Al Viro , Alex Williamson , Alexander Potapenko , Alexander Shishkin , Andrey Konovalov , Andrey Ryabinin , Christian Brauner , Christoph Hellwig , Daniel Vetter , Dave Airlie , Dimitri Sivanich , Dmitry Vyukov , Ian Rogers , Jason Gunthorpe , Jiri Olsa , Johannes Weiner , "Kirill A . Shutemov" , Lorenzo Stoakes , Mark Rutland , Matthew Wilcox , Miaohe Lin , Michal Hocko , Mike Rapoport , Muchun Song , Namhyung Kim , Naoya Horiguchi , Oleksandr Tyshchenko , Pavel Tatashin , Roman Gushchin , Ryan Roberts , SeongJae Park , Shakeel Butt , Uladzislau Rezki , Vincenzo Frascino , Yu Zhao Subject: Re: [PATCH] mm/hugetlb.c: fix a bug within a BUG(): inconsistent pte comparison Message-ID: <20230703213946.GE4378@monkey> References: <20230630013203.1955064-1-jhubbard@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230630013203.1955064-1-jhubbard@nvidia.com> X-ClientProxiedBy: MW4PR03CA0144.namprd03.prod.outlook.com (2603:10b6:303:8c::29) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|DM4PR10MB6231:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c5131da-66d5-4796-f81b-08db7c0e077c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /J9frey5u5XQEO5CoiFxNbGmhx4fWc7Q/Zvp+sqfS18W1rvz4rE81vYhRBNRWT6nC6Lqy6SQGwnBW9fyly+o/JqMg09OIlRZCB+3cSo0gFYiviGA7IYRvcgDqXDxqRKTvVRwYlxX8cGqcSsfT1+UtOVTOz1wyXfxi1xV6gfh/gUY4KL3Gse5FeXcXztN1YT0LSMVmNp4FPKCxW7velFUCtTrTC2uAdIher/9+XIjgIxYKLv7oNHW8ruYQS9xsel9f4STiOsabU9y6hz6zuU5BzOsnZUskN1O/1N2Tof+Rs2SBUemCmG5mVheOcbhDAux8IHvDSpL6/EPEV9WZuC/7tgNLsGnJlEo1ZwA+kzStH1pQ8RjUmM/uto5WNMlE56gVBekW2DI89x4sKif2QaxdNDCKSngIFvUJmrJZ9qaFb8vfixUDWTjmOUM/Vj+37fdYbIz5HevtZLHpD5d1hfi6xo91zFHgK6FxBuGahL2Qe1gTsgd0DsUKrSX/F0oXkahXdpdpvGPiL8osBqGvAS6mTlxAtkujp87B1uHXaPIK6AMSe7nWDm2OQl6vXTqZNcF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(396003)(366004)(136003)(346002)(376002)(39860400002)(451199021)(316002)(66946007)(6916009)(66556008)(66476007)(26005)(4326008)(38100700002)(9686003)(6512007)(186003)(1076003)(6506007)(53546011)(33716001)(6486002)(6666004)(478600001)(54906003)(83380400001)(7406005)(7416002)(33656002)(8936002)(2906002)(5660300002)(86362001)(44832011)(8676002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NuL/7vAUh/zuyfkF3KNe8bHWF4hybzjd/hE4pHwdbNuD5gAIXqJb0z0b1X3J?= =?us-ascii?Q?71nTs+LHKFlQb3KgQADmILnovFzT3moYyxkYPXq0e5atDUT4vB4sWyXn31Da?= =?us-ascii?Q?l4CKMmsSGdx3anQHB/53d6dkoNAOtjHCpAkf0tW0YuRfwgEDvqcDGbfUL0Pt?= =?us-ascii?Q?c4kkLi4VEiR+kaKAA+jqi3jRJPR4v/Iy2nCQsO3+dRArg1Gt4PDEjea/v6v1?= =?us-ascii?Q?mYGaRCKMa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mzDlYz9RHr?= =?us-ascii?Q?mlAwFVOtVh7ibGYnbqfq1a8b3ce88OVhYDE3vTvE6LaHr+bJx4BQejgZ1rD4?= =?us-ascii?Q?Ml2t08fq8vESMWpkHiSg5TGam1jKR5n+xI0WbdcHLNHbc/mCLajxMLlKx7rm?= =?us-ascii?Q?TnGm2io2ynkoQchCOfcdvB2U/gE9z47cMQ3pRI0H3ywWyFimGb0rhxTKxSLc?= =?us-ascii?Q?YEXkVOzjrHH1v7CScKwbBh0NxBWjv5MQc1N0m89IAJ8M7TZ1AsmNXI2Rx27Q?= =?us-ascii?Q?BYeF3zy6x+SjkSxtqgjWbPLVgYqzPhfhjjLyRIYAld15zNVfxHiwaV702inH?= =?us-ascii?Q?fp6SDwAtmnOsf0UIqgN2Ql3hQ4nmssf+qbgLa6LaWTwKoV2F4SAeDJLnmlh7?= =?us-ascii?Q?cUJWBWr+m3vlcx34cPDLhmwL2MLSEIwzUSAMwimsjWxbtYN6kwHL/6pj5PYd?= =?us-ascii?Q?I6khNdK3YKGnoJOLMcRND8HRjtw+aIpHl4ppdbnsLKNmspfg3bcJvRMsdp+p?= =?us-ascii?Q?hQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?us-ascii?Q?3LGe2vQ4AzA4w1wLpK8EShEZnCU2nRDl1XIfdrn6iRpNTTifRzlkvf4nHWDA?= =?us-ascii?Q?lFk7nsZaDjPp71A0vQrh0IlIaazJgfIB3DAKPNf1QyNQWMLabYmt96DuZa9H?= =?us-ascii?Q?4tnwCRXx1J2IXsQe40hBPcL05JeGwokcOSmZe5V9jmlqBs8Cwa1dLjUrwlud?= =?us-ascii?Q?SY21CJAOZ7YaHj9R0N41GX7x1P1quvJeFyZ7mrzQY007KGtF1srnlDp1MacO?= =?us-ascii?Q?cjIpzoFjhq5tmHl4iyrzvo38FDyyO3Sdhh3+tjV2KVq8Degp5RPaMqMGoueh?= =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g2rxmyK6fK4OSRfVzNE/L5Y8L?= =?us-ascii?Q?3mNFA6QdIGWExsmeOQfUmsFZla+j843Rsmx/F0B8WH7ZnC4MPVau7g1HYv+c?= =?us-ascii?Q?XtDBOUbrLP5WSya6cmwdG4zr7K6330dXMcC2iGE7e0pXmbIhXqlgMfKSi7Z9?= =?us-ascii?Q?WOGKL1DBRSTJfIw3gytQ56cknM0aGSU9t45LaIEgpfjQqtIAyo4sNqe/Wk2a?= =?us-ascii?Q?hxrYkVqynWxYTF+F9VAY2YEFLVzL?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c5131da-66d5-4796-f81b-08db7c0e077c X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2023 21:39:50.1755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U1WLK2nApgHidRfhhav5JmclYUhtxCbV+CMVvZyUwskgcgkDAS0o/ZEbCirsktDL083XfLQvl1ewEuujm8Oq0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6231 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-03_15,2023-06-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307030198 X-Proofpoint-ORIG-GUID: tISttJnlDPbMbafnFV7OPdhzlYzR1aFs X-Proofpoint-GUID: tISttJnlDPbMbafnFV7OPdhzlYzR1aFs X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 06/29/23 18:32, John Hubbard wrote: > The following crash happens for me when running the -mm selftests > (below). Specifically, it happens while running the uffd-stress > subtests: > > kernel BUG at mm/hugetlb.c:7249! > invalid opcode: 0000 [#1] PREEMPT SMP NOPTI > CPU: 0 PID: 3238 Comm: uffd-stress Not tainted 6.4.0-hubbard-github+ #109 > Hardware name: ASUS X299-A/PRIME X299-A, BIOS 1503 08/03/2018 > RIP: 0010:huge_pte_alloc+0x12c/0x1a0 > ... > Call Trace: > > ? __die_body+0x63/0xb0 > ? die+0x9f/0xc0 > ? do_trap+0xab/0x180 > ? huge_pte_alloc+0x12c/0x1a0 > ? do_error_trap+0xc6/0x110 > ? huge_pte_alloc+0x12c/0x1a0 > ? handle_invalid_op+0x2c/0x40 > ? huge_pte_alloc+0x12c/0x1a0 > ? exc_invalid_op+0x33/0x50 > ? asm_exc_invalid_op+0x16/0x20 > ? __pfx_put_prev_task_idle+0x10/0x10 > ? huge_pte_alloc+0x12c/0x1a0 > hugetlb_fault+0x1a3/0x1120 > ? finish_task_switch+0xb3/0x2a0 > ? lock_is_held_type+0xdb/0x150 > handle_mm_fault+0xb8a/0xd40 > ? find_vma+0x5d/0xa0 > do_user_addr_fault+0x257/0x5d0 > exc_page_fault+0x7b/0x1f0 > asm_exc_page_fault+0x22/0x30 > > That happens because a BUG() statement in huge_pte_alloc() attempts to > check that a pte, if present, is a hugetlb pte, but it does so in a > non-lockless-safe manner that leads to a false BUG() report. > > We got here due to a couple of bugs, each of which by itself was not > quite enough to cause a problem: > > First of all, before commit c33c794828f2("mm: ptep_get() conversion"), > the BUG() statement in huge_pte_alloc() was itself fragile: it relied > upon compiler behavior to only read the pte once, despite using it twice > in the same conditional. > > Next, commit c33c794828f2 ("mm: ptep_get() conversion") broke that > delicate situation, by causing all direct pte reads to be done via > READ_ONCE(). And so READ_ONCE() got called twice within the same BUG() > conditional, leading to comparing (potentially, occasionally) different > versions of the pte, and thus to false BUG() reports. > > Fix this by taking a single snapshot of the pte before using it in the > BUG conditional. > > Now, that commit is only partially to blame here but, people doing > bisections will invariably land there, so this will help them find a fix > for a real crash. And also, the previous behavior was unlikely to ever > expose this bug--it was fragile, yet not actually broken. > > So that's why I chose this commit for the Fixes tag, rather than the > commit that created the original BUG() statement. > > Fixes: c33c794828f2 ("mm: ptep_get() conversion") > Cc: Adrian Hunter > Cc: Al Viro > Cc: Alex Williamson > Cc: Alexander Potapenko > Cc: Alexander Shishkin > Cc: Andrew Morton > Cc: Andrey Konovalov > Cc: Andrey Ryabinin > Cc: Christian Brauner > Cc: Christoph Hellwig > Cc: Daniel Vetter > Cc: Dave Airlie > Cc: Dimitri Sivanich > Cc: Dmitry Vyukov > Cc: Ian Rogers > Cc: Jason Gunthorpe > Cc: Jiri Olsa > Cc: Johannes Weiner > Cc: Kirill A. Shutemov > Cc: Lorenzo Stoakes > Cc: Mark Rutland > Cc: Matthew Wilcox > Cc: Miaohe Lin > Cc: Michal Hocko > Cc: Mike Kravetz > Cc: Mike Rapoport (IBM) > Cc: Muchun Song > Cc: Namhyung Kim > Cc: Naoya Horiguchi > Cc: Oleksandr Tyshchenko > Cc: Pavel Tatashin > Cc: Roman Gushchin > Cc: Ryan Roberts > Cc: SeongJae Park > Cc: Shakeel Butt > Cc: Uladzislau Rezki (Sony) > Cc: Vincenzo Frascino > Cc: Yu Zhao > Signed-off-by: John Hubbard > --- > mm/hugetlb.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) Thanks for catching this and the detailed explanation. Acked-by: Mike Kravetz -- Mike Kravetz > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index bce28cca73a1..73fbeb8f979f 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -7246,7 +7246,12 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, > pte = (pte_t *)pmd_alloc(mm, pud, addr); > } > } > - BUG_ON(pte && pte_present(ptep_get(pte)) && !pte_huge(ptep_get(pte))); > + > + if (pte) { > + pte_t pteval = ptep_get(pte); > + > + BUG_ON(pte_present(pteval) && !pte_huge(pteval)); > + } > > return pte; > } > > base-commit: bf1fa6f15553df04f2bdd06190ccd5f388ab0777 > -- > 2.41.0 >