Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1031152imw; Fri, 15 Jul 2022 19:03:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sUkBu9n5T7+BqIRnfsJZlcESi9ha/vTLF8Bf12K3jqW77mJYJSN3j8G+TyaYMITNKGEEtH X-Received: by 2002:a05:6a00:1412:b0:528:47a6:8569 with SMTP id l18-20020a056a00141200b0052847a68569mr16692853pfu.39.1657936986660; Fri, 15 Jul 2022 19:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657936986; cv=none; d=google.com; s=arc-20160816; b=xdOmqaP3muaApRfzLFmAyaT4URgasUr22Tge3C5S8UinKlO0Q5CFq+wF5cq4VFT1vs liCiYNXhJPgJqmotRx02zvW2tohgPsaYu55Hl7ucuiYJOZq1NCDeJJ5Qrc5u5b6KLP7U QLb/ZgaTf9tsavPqC3qxZ5h3zHud/scMFuWpdgtTWBS/J2+xC9lcFpvHeRfUfws0yQK/ zI7cbyRREZ38MGziv5/e9kgLhagfgly61sMs3iYyeijOzuMqxA/yn6VR2f0vBJudZ09M kxtVEvDYpAsp8H5yi+1177JtD5xe8iptLjpODwFJb/Drh2JTa8K251rNPK8Re5IF0+KR giWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=9L6/VNTn9uVJgbv1Ui6Zpbbkfn3iuntmjTygnc2P9Es=; b=DKTw00cBeMWMCLRzoEwCplQEUlK7taYeS3C4cwAK1mwjHeXjG1gjaahSqiwa5u3ZRb 8WEiFXQvgjNhuimXq8f+xnr2z7cPKciMsBB286pPM2rAfICDo2TZd/jr4RTaegUkYhVA V3HXvvNmciXRjxcbEY/IZd6SCbqgETAil14uFlCPuWJ+AYWdfsz8F/m4PipEx0fwtaLP dAsuHdcg17YNhtLqk3cQ3QCjUludH48/8MkhciqAtFRJBud9wWXzre+8tiHiNSrNAHiT KYRYxxq3JD5yV0M2M2abPUZ/Upd5N3aTmeUugPfX/0IDnPexE5z03HGQrpEERaxYhqxM buQA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a17090ad25500b001d996a5c5e4si2160141pjw.128.2022.07.15.19.02.52; Fri, 15 Jul 2022 19:03:06 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbiGPBdB (ORCPT + 99 others); Fri, 15 Jul 2022 21:33:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbiGPBc7 (ORCPT ); Fri, 15 Jul 2022 21:32:59 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7464746D99 for ; Fri, 15 Jul 2022 18:32:57 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ll9fs6PGszlVmw; Sat, 16 Jul 2022 09:31:17 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 16 Jul 2022 09:32:55 +0800 Subject: Re: [PATCH] mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte To: Axel Rasmussen , Peter Xu CC: Andrew Morton , Mike Kravetz , Muchun Song , Linux MM , LKML References: <20220712130542.18836-1-linmiaohe@huawei.com> <20220713102357.8328614813db01b569650ffd@linux-foundation.org> <402ae708-4c86-8feb-75c4-9339e1deac3b@huawei.com> From: Miaohe Lin Message-ID: <6fecf875-260e-a9c5-df24-9b0d13970057@huawei.com> Date: Sat, 16 Jul 2022 09:32:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 2022/7/16 1:51, Axel Rasmussen wrote: > On Fri, Jul 15, 2022 at 10:39 AM Peter Xu wrote: >> >> On Fri, Jul 15, 2022 at 10:28:44AM -0700, Axel Rasmussen wrote: >>> On Fri, Jul 15, 2022 at 10:07 AM Peter Xu wrote: >>>> >>>> On Fri, Jul 15, 2022 at 09:45:37AM -0700, Axel Rasmussen wrote: >>>>> I agree we should either: >>>>> - Update the UFFD selftest to exercise this case >>>>> - Or, don't allow it, update vma_can_userfault() to also require VM_SHARED >>>>> for VM_UFFD_MINOR registration. >>>>> >>>>> The first one is unfortunately not completely straightforward as Peter >>>>> described. I would say it's probably not worth holding up this fix while we >>>>> wait for it to happen? >>>> >>>> Agreed, Andrew has already queued it. It actually is a real fix since we >>>> never forbid the user running private mappings upon minor faults, so >>>> it's literally a bug in kernel irrelevant of the kselftest. >>>> >>>>> >>>>> I don't really have a strong preference between the two. The second option >>>>> is what I originally proposed in the first version of the minor fault >>>>> series, so going back to that isn't a problem at least from my perspective. >>>>> If in the future we find a real use case for this, we could always easily >>>>> re-enable it and add selftests for it at that point. >>>> >>>> I'd go for fixing the test case if possible. Mike, would it be fine if we >>>> go back to /dev/hugepages path based approach in the test case? >>> >>> One possible alternative, can we use memfd_create() with MFD_HUGE_*? >>> This afaict lets us have an fd so we can create two mappings, >>> without having to mount hugetlbfs, pass in a path to the test, ... >> >> Sounds good. :) We can also rework the shared hugetlb too. Wanna post a >> patch? I can do that too, let me know otherwise. Thanks! > > Sure, I'll take a whack at it. Many thanks for all of your hard work. :) > >> >> -- >> Peter Xu >> > . >