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 C266BC433EF for ; Fri, 15 Jul 2022 17:51:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C38594020D; Fri, 15 Jul 2022 13:51:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 272A19401FB; Fri, 15 Jul 2022 13:51:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18A1B94020D; Fri, 15 Jul 2022 13:51:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 095279401FB for ; Fri, 15 Jul 2022 13:51:54 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CF8CE215BC for ; Fri, 15 Jul 2022 17:51:53 +0000 (UTC) X-FDA: 79690077306.25.C7EE753 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by imf08.hostedemail.com (Postfix) with ESMTP id 40FEB160005 for ; Fri, 15 Jul 2022 17:51:53 +0000 (UTC) Received: by mail-il1-f180.google.com with SMTP id w16so2423724ilh.0 for ; Fri, 15 Jul 2022 10:51:52 -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=8Ib/oWEoGNGAe7E62KsRy28LW0NH5ciDw5Z/ulJeK9w=; b=tK1+WtJdz6cJlCyxtgNS1wI18oypYIQlGknflDLiNCH+xw8kUdINNgFKKm0sdyscsU ha8qV+52x/+QiIPqi7KhkKArzKCc0XA5iWw3Q6ZaR/w7Qfy74sEXpkdk+wgf+rLvFS60 ymUVB+Z5u31zayhCPJgC2Rrak2PA6eIxbbx3AUeytu+n3TX772N5HIx5mfN/0vpukQ+k LDtat6ZoyjAPQOeUjatqEOgurIyszwUl8A6zAzuX+qrJO7k/xBMFIloY/Y0jdcBSrAKw aEOhq0Pj/dpdVkkA0KRAR9mKbxvL3vEP+8DR5p4jqW2HrhU44ch/Epm4/tdtnxgQJ3vb Znhg== 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=8Ib/oWEoGNGAe7E62KsRy28LW0NH5ciDw5Z/ulJeK9w=; b=JIR924kHao99syMgcfxXmA34du9FHWrnpLJvQlim6Eh56dtmtnvdeTmy9PQOWXOvZk nUV941PuwCz5aZlllLeEGy0KsXpGWH3A9wgHcG40pTrItovbB21nuMei4hEEQFfAJG66 yJdPQ4fxrxPbj8A3sfXWg0bI577Aghsei410CXy7tdRYHdnAyjMe2MUqm6jzpVZc+CeC s//ptOkhYnT5uRccqzt2uyOxEszJ7MuMQZC4SRdhaxqFdHWcoJSCXEqVcd+0E6Ozg/Vh M3z2Ejwv9FcE9//Y1Rppo9C24KqE9dMpN+Zd+eoNYy6UARjEnYZpnT9TuxgvHzbEPEl9 HlCA== X-Gm-Message-State: AJIora+FoAR+3pbU1gjyauSSnAuzelbEel7ymhDREycW84aMtnJcV4Kd s2TWAtefgYn3mYfQXG8QDmRIvfqYThSBpEh+DFhlyA== X-Google-Smtp-Source: AGRyM1vjbj4Rr5c3VI89RJFhwTarTUoUUR0HUujz6m8LUxrXbX9MxdKDJ9M/9+Lw5IdM9QDk6cfWrgwM0B3OEz20LrY= X-Received: by 2002:a05:6e02:1885:b0:2dc:5ede:8537 with SMTP id o5-20020a056e02188500b002dc5ede8537mr7729954ilu.275.1657907512419; Fri, 15 Jul 2022 10:51:52 -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:51:16 -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=1657907513; a=rsa-sha256; cv=none; b=NzWRFqGbKxiBiLKlXnEIbQi2ez33meqX4AdQlZHkMEiA6kTjV7HVB2QuIxOo7Pc8g3oz2m vY9hTRWiB3DispsI4mJY/xzBKqrFilEa9TkT/JPTs97TAkti0tDf0VP2w1hqdIMWLkogYl iyS+ubF8bOorlR5h0ZLeevUXylmjKlg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tK1+WtJd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.180 as permitted sender) smtp.mailfrom=axelrasmussen@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657907513; 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=8Ib/oWEoGNGAe7E62KsRy28LW0NH5ciDw5Z/ulJeK9w=; b=t2G6T6lOE4ndQbuw4yyWbapzemkn+jymr4QX//XnsZo5AcQtBSOzx97yZDiPZ16+GYMmaa kSa4nYU5CE6y+a0LF7q8MbcQIsodAR8j4FhTPDVz1qDhuz/IPoHg7Oow3yddZr8rocCFMO XyNr1xbYVND82gc3+4ayBwxt34+sJTo= X-Stat-Signature: kjti47ya737kszw7y7y1ffqp6hs97wm9 X-Rspam-User: X-Rspamd-Queue-Id: 40FEB160005 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tK1+WtJd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of axelrasmussen@google.com designates 209.85.166.180 as permitted sender) smtp.mailfrom=axelrasmussen@google.com X-Rspamd-Server: rspam11 X-HE-Tag: 1657907513-887197 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: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. > > -- > Peter Xu >