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 1CCAAC433EF for ; Fri, 15 Jul 2022 17:39:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B22C094020B; Fri, 15 Jul 2022 13:39:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD4119401FB; Fri, 15 Jul 2022 13:39:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99D2594020B; Fri, 15 Jul 2022 13:39:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8B3DC9401FB for ; Fri, 15 Jul 2022 13:39:13 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5DC7A35A2C for ; Fri, 15 Jul 2022 17:39:13 +0000 (UTC) X-FDA: 79690045386.10.687915D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id DFA141A0080 for ; Fri, 15 Jul 2022 17:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657906752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=okIHgoCNos0gJ1ltx/Qs4rJoOZ4S1PC829YaSz7zsCM=; b=J/PoAG7ul/vRBHc6ypS+BlfNWk5a1wwX1qXTUkjUKS7AgPLltN+OM/hzs8W/KtA1R1BNJN Gs5+PnERooZ5bnjSuOvSInsjIJczYlDN1xX+wlrXwKdmDN72FojiQzL6mIx9Fk83qYafTF z41mLYyYwfj0qDIcHQ4ttuUqV4/6l1M= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-193-ipUVzvyRNjCpaMkaQy6tyw-1; Fri, 15 Jul 2022 13:39:11 -0400 X-MC-Unique: ipUVzvyRNjCpaMkaQy6tyw-1 Received: by mail-qk1-f200.google.com with SMTP id de4-20020a05620a370400b006a9711bd9f8so3896951qkb.9 for ; Fri, 15 Jul 2022 10:39:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=okIHgoCNos0gJ1ltx/Qs4rJoOZ4S1PC829YaSz7zsCM=; b=k3yhYADOwdtip97LUsmouPPp0HBzsClHhkevYrNbZq1VgscdasfEASo5Lo2UaCrCZB CfWpAUAAiPkOKAvs26Qce/XbZ05GKC4rUGztuNHbkB8BYAvwSF/ti9U7oZXtZ/teZVPC IAJ/Zm9+vGWoMwOt8CE9nce3EriuAYq0Gd9qrx3wEmdwxU7/VEN3IcJHbqaNOzjpkKi6 g9zFRxr87L+PNk+ZI4iRx+ct0u0MzDiXSlwqAXdRf9IfkGGDJEdeGpHopvJyKhRH7OYp E5IyMR/shxfefUSgmyv/cB3iVdFaNmhh3aq0tFHgBrYKJoaRWA6B1OpozEtlI60O4Q9G dxRg== X-Gm-Message-State: AJIora9+BnQfZdLa1rFzaV80rayB7RNzVwwwBJOJu/SnzN8atYhlV3Sy Pzd4dfkpmTP73x/mm8NFIfm3NkzcaXE0bHxAoBW/IGExVoISYZKun6I3Q1y+i35YDUZx2vZL/IR p1SU6BRTpUVI= X-Received: by 2002:a05:620a:4107:b0:6b5:c5a8:b563 with SMTP id j7-20020a05620a410700b006b5c5a8b563mr5431797qko.583.1657906750323; Fri, 15 Jul 2022 10:39:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ttfm79EV4yyQ/OZ1KZGLrBE/4IghOIlt/6k6zahvulyR583FbGQND3x5DinIQUrP2enpN1PA== X-Received: by 2002:a05:620a:4107:b0:6b5:c5a8:b563 with SMTP id j7-20020a05620a410700b006b5c5a8b563mr5431779qko.583.1657906750035; Fri, 15 Jul 2022 10:39:10 -0700 (PDT) Received: from xz-m1.local (bras-base-aurron9127w-grc-37-74-12-30-48.dsl.bell.ca. [74.12.30.48]) by smtp.gmail.com with ESMTPSA id fu27-20020a05622a5d9b00b0031eb5fa4b50sm3842236qtb.39.2022.07.15.10.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 10:39:09 -0700 (PDT) Date: Fri, 15 Jul 2022 13:39:08 -0400 From: Peter Xu To: Axel Rasmussen Cc: Miaohe Lin , Andrew Morton , Mike Kravetz , Muchun Song , Linux MM , LKML Subject: Re: [PATCH] mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte Message-ID: References: <20220712130542.18836-1-linmiaohe@huawei.com> <20220713102357.8328614813db01b569650ffd@linux-foundation.org> <402ae708-4c86-8feb-75c4-9339e1deac3b@huawei.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657906753; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=okIHgoCNos0gJ1ltx/Qs4rJoOZ4S1PC829YaSz7zsCM=; b=GkCZJjUNa0bejDPvAeP0VELihRnDoejl94mEGcQ/r2P5xhdLOaI28fNz3bHWTi3zsOrCg3 Oe4cBXEvfrX5P3eKATTjAAkNpm5YRfpTFH8W6QPEnLee67Ota+p21hD/0899nHyah7kv3R JHEsygpb/LRLltPljZD/c7NhUYJWWGM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657906753; a=rsa-sha256; cv=none; b=zl0yb1SJDP+wNk5UWzoerZFKA8tF6S8BFZtjYQYvNJgF5sOSKrPw3sYqbCJNrHwRVRfc8K VVpuMWjjGRU2TgSiB1GS0ywaNUw/UCiwwEHDopUVXGFl3jVAcA7ib0DZ9ZZdCh7Mr0z4wO V/Kc3wQjO3dumbqbyfw6B0OKn7zchXk= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="J/PoAG7u"; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="J/PoAG7u"; spf=none (imf19.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Queue-Id: DFA141A0080 X-Stat-Signature: j6ddh66b47ngjjmk9bwy63kcpyu4yo3b X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1657906752-376494 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 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! -- Peter Xu