Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp573932rwb; Thu, 27 Jul 2023 18:10:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcQ4jdH/4d/URNU4+PNCrHHNVifL9Rt+SRyStt+VuDKjIYYMiTQHoLjAUUmeaK8oMI3z4c X-Received: by 2002:aa7:db4a:0:b0:51d:91ef:c836 with SMTP id n10-20020aa7db4a000000b0051d91efc836mr403265edt.32.1690506601229; Thu, 27 Jul 2023 18:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690506601; cv=none; d=google.com; s=arc-20160816; b=NYm5NqBTfgrh1i3A5Xw8lETAdO0ISaeLySOsfz2G4OSgBUz5MQ0Ke/4+crpJzi0Qvd D0gOnoGhRybEvS01K3cSzGSyDdKIpOLQcCSC30JQ43w2hQZIigA9T2b47ocAAdijbZYe L+wYuoImFfxRJWDvtxempdTWdK811yF443ziF/70xjOEmRm02DF24awfXxRz8VR/7ge6 aRz1kDuuh3/Y/hDWKCthznbvpAgUNeSGub6soSFze4p1war7iygz4pi9Vv/bRANEyU/v SGD+NegYsZtj8hO6ziQtK9lA2UVh1GkoSZoF6PR8p58scAyN5fA50k19Mno9z6ILW98+ 3U+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=IiJgWH/Vklb2Fwrpc3NwHVwHxoibOOL+7d3Gq6GDxKc=; fh=eyNzMsE5ZFhwKO0u2xDlTc/rT5+oePRMYYuZBAyflS8=; b=cEy56PxIf9YJ5tWO/s2NYcheg1OZxiSc/T9FhlYs+IEbGOSUERO/L5DjyS4vUQGjAA I0NnTJKzrS42VNiJRWZk7wq1yh61AZ5ukq5Ro8wVP4pvVvJ08x5O187R4HOSWYUjDI3z bYtc5NQWlV++9Rt7PGOv46pEXZjvZPLdO6K/KHHi7iw6n1b7DyP8Qoy3fA2hU32tFsef UC1eePD5/9A3/bZoh7ODafN2R1/yzDUWeSaNNaQWAE+pV3dECsHDfHdvewflAaZBkv3h 7qtTkscJBrODTNKGdRzFORZAZTwtOD1h5D1hEQRCCpD9LOTXUUdjBI/0SYqoFSqSociJ 9Ydg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=MTY7LkC7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=canb.auug.org.au Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc8-20020a056402204800b00522464a048asi1802285edb.478.2023.07.27.18.09.37; Thu, 27 Jul 2023 18:10:01 -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; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=MTY7LkC7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=canb.auug.org.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231234AbjG1AVS (ORCPT + 99 others); Thu, 27 Jul 2023 20:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjG1AVR (ORCPT ); Thu, 27 Jul 2023 20:21:17 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 402102D7E; Thu, 27 Jul 2023 17:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canb.auug.org.au; s=201702; t=1690503662; bh=IiJgWH/Vklb2Fwrpc3NwHVwHxoibOOL+7d3Gq6GDxKc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MTY7LkC7ot+2uKXHQAJO2vOXp0hOPSXtKIJ6M0vfV22VoAn2/VikjE8WOXDJ2FDBW vAorMM9cE6w2sFXmrmZPAxx+aOcVt318IF3TTAikL+kDZu6hojaYLCRdqteCST4F0J WTKZ/UX3mOLx3paiMid1PaZroI6k0enDzDYeSgwijhtFC7Ev2/z6rx9foNCVWkXEj7 Ff+ftlE+t32wiHfoBtACRBRzJsoaIqVUkzMgRyiJByGgaH5vp6l3W6D2Ex+CY9LXw8 swrUc/MjcZtehSShOn+9TW759FSeCAKySSgT+1GmCYEgVujtB/e7SA/uHR8+sw8bJ7 C/W7rLubIbM4g== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4RBpFp1146z4wqX; Fri, 28 Jul 2023 10:21:01 +1000 (AEST) Date: Fri, 28 Jul 2023 10:21:00 +1000 From: Stephen Rothwell To: Matthew Wilcox Cc: Andrew Morton , Jann Horn , Linus Torvalds , Linux Kernel Mailing List , Linux Next Mailing List , Suren Baghdasaryan Subject: Re: linux-next: manual merge of the mm tree with Linus' tree Message-ID: <20230728102022.7593856b@canb.auug.org.au> In-Reply-To: References: <20230728091849.7f32259d@canb.auug.org.au> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_//yb.j3cI08T_=Y6OSsroN5f"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --Sig_//yb.j3cI08T_=Y6OSsroN5f Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Matthew, On Fri, 28 Jul 2023 00:49:50 +0100 Matthew Wilcox wro= te: > > On Fri, Jul 28, 2023 at 09:18:49AM +1000, Stephen Rothwell wrote: > > diff --cc mm/memory.c > > index ca632b58f792,271982fab2b8..000000000000 > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@@ -5392,32 -5597,18 +5597,21 @@@ retry > > if (!vma) > > goto inval; > > =20 > > - /* Only anonymous and tcp vmas are supported for now */ > > - if (!vma_is_anonymous(vma) && !vma_is_tcp(vma)) > > - /* find_mergeable_anon_vma uses adjacent vmas which are not locked */ > > - if (vma_is_anonymous(vma) && !vma->anon_vma) > > -- goto inval; > > -- > > if (!vma_start_read(vma)) > > goto inval; > > =20 > > + /* > > + * find_mergeable_anon_vma uses adjacent vmas which are not locked. > > + * This check must happen after vma_start_read(); otherwise, a > > + * concurrent mremap() with MREMAP_DONTUNMAP could dissociate the VMA > > + * from its anon_vma. > > + */ > > - if (unlikely(!vma->anon_vma && !vma_is_tcp(vma))) > > - goto inval_end_read; > > -=20 > > - /* > > - * Due to the possibility of userfault handler dropping mmap_lock, a= void > > - * it for now and fall back to page fault handling under mmap_lock. > > - */ > > - if (userfaultfd_armed(vma)) > > ++ if (unlikely(vma_is_anonymous(vma) && !vma_is_tcp(vma))) > > + goto inval_end_read; > > + =20 >=20 > No, this isn't right. It should be: >=20 > if (unlikely(vma_is_anonymous(vma) && !vma->anon_vma)) > goto inval_end_read; Yeah, see my second attempt. > I'm not sure about the userfaultfd_armed() clause. My patch wasn't > intended to affect that. That was removed by commit 69f6bbd1317f ("mm: handle userfaults under VMA lock") in the mm branch. --=20 Cheers, Stephen Rothwell --Sig_//yb.j3cI08T_=Y6OSsroN5f Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAmTDCewACgkQAVBC80lX 0Gzg1AgAnPCQs1b/arFmUhcj5LO5Ij0Y9b77pBV0zyN7e6Zy+ddaRWzgbLbEKBsI oFkaa3aBs58Q4uhYiKCXBEskdKMZP4Q0nEQRaSJ8/IFuM/1gt5Wcl8Y/08zenSWE NxkcBmhpRctyLh6t4giPlqXpmfL5ZQnCb9aHCcJXmDSmMs9DCY8ab5nifB+o4k6+ ohzVzKz11VjRt56jBJvjgIP4WPv+Ozm3BJTd/QHG4ZZLiecXc2E21P5KM3hJgJLj pKUyH01514hK/YhvQ/PugEaaylifxzt3x3W6gWB8iOWB1NyI3YgQz71nQ6xyKuBd yMOALy7ml+K7aVX00aJXts8MmWZW8A== =z7G/ -----END PGP SIGNATURE----- --Sig_//yb.j3cI08T_=Y6OSsroN5f--