From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65455C43334 for ; Sat, 16 Jul 2022 01:33:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9548C8E000E; Fri, 15 Jul 2022 21:33:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9038E8E0009; Fri, 15 Jul 2022 21:33:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F29D8E000E; Fri, 15 Jul 2022 21:33:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6DAE78E0009 for ; Fri, 15 Jul 2022 21:33:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 359C33448C for ; Sat, 16 Jul 2022 01:33:00 +0000 (UTC) X-FDA: 79691239320.15.4779207 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf07.hostedemail.com (Postfix) with ESMTP id 14B624004E for ; Sat, 16 Jul 2022 01:32:58 +0000 (UTC) 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657935179; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9L6/VNTn9uVJgbv1Ui6Zpbbkfn3iuntmjTygnc2P9Es=; b=qv5kP+XUQwpqQzbOfGRj1EZtgv998ksxb17PbJCnwgmwpaHNOGLsN8LxOOPPfo0TS5rHSs P5XbR/C67fobavsWgiwYNchIKEdxLKAoOIV8TzsX/RC9+AHAu62ACYMKOjM5uykuCljxJa Sz+4c1SLKmQm7BxNRztryONfZtDPBp8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657935179; a=rsa-sha256; cv=none; b=GXshwz2fNV44Jyjy5uHEvLP7xaruDbPj40IvnUEXD4nzdaBrixS/1uNDTuF9Rlh+UIlvOv IU7klUd6xQzV5QTF2DmAM9ZKp0hGZ6HO/ueZ2gUPLrPXv6uaqwSJG6pOOkHc6l/8QDjSZi 5WLwj0rTv/q+eEK4SBa+JouA9QJrlhc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam05 Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: hz6qptabb9sdowdbypi3mc6ymxkzuy5y X-Rspamd-Queue-Id: 14B624004E X-HE-Tag: 1657935178-627126 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 >> > . >