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 9E873C433EF for ; Fri, 15 Jul 2022 17:29:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C30BB940208; Fri, 15 Jul 2022 13:29:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB9B99401FB; Fri, 15 Jul 2022 13:29:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5A49940208; Fri, 15 Jul 2022 13:29:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 912DF9401FB for ; Fri, 15 Jul 2022 13:29:21 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 658F32EBA4 for ; Fri, 15 Jul 2022 17:29:21 +0000 (UTC) X-FDA: 79690020522.25.38C43F3 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by imf07.hostedemail.com (Postfix) with ESMTP id F070E40051 for ; Fri, 15 Jul 2022 17:29:20 +0000 (UTC) Received: by mail-io1-f45.google.com with SMTP id y2so4350041ior.12 for ; Fri, 15 Jul 2022 10:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CKhjo8KG4zeKmBRRqGulQXfTOE6loy/w65MUvp5iYC4=; b=ApnumN/uO+q8VfK0eOjR1IyrQRBVSvV4Y9KtuhuDw1CHNQ1Bt6qAOT7Dh6G4KKDIYm j+HkYUlfKykcFB/h+chNUe06pdJ8QSFcoyQCDNBwJJt+PNAQxFZCHVWrLP+LRSTf8NDq JNudYxyLyyTYJOCS8ibyybJbzfOZ9krq8CN8A2wpqKql+hooOwyV6DtpkcMbgthW1/ZV C8XfCq4dCr+TEI3WJar57TNEVzoi2a/8dxyknMgTSYsjfQB/q4aVKsPbsXdfZ/+MXgPo Md/QFbr+NrUbHYPV12axpepy0F0jI5eT3YgFPjk79G4xLVN+iq6aL4LVFmAd7ZILHG1y HFow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CKhjo8KG4zeKmBRRqGulQXfTOE6loy/w65MUvp5iYC4=; b=S1ET9SrEQONcuLSDDsw7w3IaezmJEw90LTLLgTJ5UssaSHyvZ/UJK7dL/mewmO8bcZ 6JGdrA8vEpeVxZ/EdVFvJ/Hf6wn6pW442SFz52NHw7eO42CdTsd2XhdVv0pSmEreVqRT RZiImT7/7fbLMg6MHxgA4NdpnLIhUw4DjMgWvu8cjxCgRn9CBkZE475vNyaKd6LaesN7 uK1UqyzDC1LiHQebrLaWMQjBDvKQJmyO3V6PGzRpNefujZ3ZQVkDZX+wn6zeFSpryjF4 K9lnkdktNM14Js+HU+Nag75KnKclrAGnnHqhAFH9BHgK/0jS7jaqWSSalDB/RsMDNMkY hiBA== X-Gm-Message-State: AJIora894oqetOVASXNv4C6g7GkMByeSNp5gxahMCe0Ee65QrMerOvO8 phyfzSvNsnbV4MnIUTbBM/EHPjXwoVOXTtavoX/Iew== X-Google-Smtp-Source: AGRyM1su4lMmzs+An9cEt4lDrZEMXE242gj1D3aPbBm6VaURSzClhzRMpyhB82dU/VnX2nUVQqii0+gdAXi6+f+2p38= X-Received: by 2002:a05:6602:2f03:b0:678:9c7c:97a5 with SMTP id q3-20020a0566022f0300b006789c7c97a5mr7537079iow.32.1657906160115; Fri, 15 Jul 2022 10:29:20 -0700 (PDT) MIME-Version: 1.0 References: <20220712130542.18836-1-linmiaohe@huawei.com> <20220713102357.8328614813db01b569650ffd@linux-foundation.org> <402ae708-4c86-8feb-75c4-9339e1deac3b@huawei.com> In-Reply-To: From: Axel Rasmussen Date: Fri, 15 Jul 2022 10:28:44 -0700 Message-ID: Subject: Re: [PATCH] mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte To: Peter Xu Cc: Miaohe Lin , Andrew Morton , Mike Kravetz , Muchun Song , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657906161; a=rsa-sha256; cv=none; b=MbmfOC1vKIBIorj/JST/clKdSzTdGZmf4hQJVgc6U06HWJpzwtGAiiidjEA74O5Kf+zBet 0dH5arRYsTR2i5b1fMptQDwIyuEIvTJp5QzDa9hIKY+WrX55b+czBkOeV4HeTXqZ2PGI4b YSB0ZckAsaXOB0PTXbvAEHptauiayM0= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="ApnumN/u"; spf=pass (imf07.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.45 as permitted sender) smtp.mailfrom=axelrasmussen@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657906161; 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=CKhjo8KG4zeKmBRRqGulQXfTOE6loy/w65MUvp5iYC4=; b=pPp4u9ctKBpTfIiYiHYpssivIAH3K6fTqAVOpVF/np+4CgY8MBZO4ktaWxgrLQj+cpuN3U V7+xFhLAPeem7PCQowtALrSfA63JWpbSgzdflfiRikwEMq5I9ou6SRtOYxpnkZBF4NFKP9 Wyal4pxj3qgLDxraGUoBw6VRnNcwOh8= X-Rspam-User: X-Rspamd-Queue-Id: F070E40051 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="ApnumN/u"; spf=pass (imf07.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.45 as permitted sender) smtp.mailfrom=axelrasmussen@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam04 X-Stat-Signature: yudu5q1zesshqys7tfdzijjqxqh76566 X-HE-Tag: 1657906160-427368 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: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, ... > > > Thanks, > > -- > Peter Xu >