Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp572825rwb; Thu, 27 Jul 2023 18:08:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlHm1orJc063tSlakJqEyrM9v6UKQlAuT0ltNA5GNKVgSKEFYmhzOTz+L3A8AWv88ZZ54AJk X-Received: by 2002:a17:906:32d6:b0:99b:56f1:3002 with SMTP id k22-20020a17090632d600b0099b56f13002mr604160ejk.61.1690506525169; Thu, 27 Jul 2023 18:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690506525; cv=none; d=google.com; s=arc-20160816; b=C3vvRCrcJcLH3RlkrvgbfpEr3hEWvtqaWSVcfWZuxlW8ekhPwaTCbVcK3nNBAQ7SC5 yMDu62lvHu3Y/jsRRIiQ2vmG87ncXHs5KoOeSDO30Z0an0UZZO7xizKj1OeqROwRNXFx wOPuxQ7/yOcfjIZqSK7qwrY35Y1W6kYzAO0ylBAp50Oa91mnexyIsfrpbDe9Kr6rdEat uZ2hEp5FZIUMcniQH101XnFOwq5JE1nuDNltedhadT7qtFdxRerwKRx0/6O4u1Y2zl3G xdEQ8Bob1xDCG/Zv2Aazw+KhQ+RDEhXjflOpGbDsN4H0ESpjMi/fFXvH2g9QWMZ1H0CL DbtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kcj+3z3CVbuBGBRuj/7fCoy99WoBx7sCuEmut4Zlw60=; fh=WCgduryURHIBC+E8dHlKe4kNk/bz9ohR/Q9a12eiA1o=; b=ZDNRCgeRwF2952yOljKjJo68IURqyZ6Jzu8bcFIHYbiF27Oqcc1dJxxIEpQOzT2TP+ FalOBTgU7hmJ/vyWcoEHvPHw0vFQbH3tyvSbj0viLqYObj2xw5vT6mz5fUudeWw1kYmG FN3v5NqXTq7NTcyykIyMV8cIi+ftCMqRNY8i9wwF8DC0bH7/0cUlbNgGmIHWwcahRK/C D8lg1wK3NOHX8zSlbJjhZChAza/aPlGteckPaXS7C8tiveKnDY2YLnfFnpcDsQ3WyRCS n1F8e4NJpNB6d77ZbCJTznk8s1SvQBq9nuwNWGBgLvp6sbswgj1aAFOvoUgJroor5tfL Qefg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=r7Tn0Ouq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020a17090668cd00b00997eac101c7si1723358ejr.980.2023.07.27.18.08.21; Thu, 27 Jul 2023 18:08:45 -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=@google.com header.s=20221208 header.b=r7Tn0Ouq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjG1AX7 (ORCPT + 99 others); Thu, 27 Jul 2023 20:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjG1AX6 (ORCPT ); Thu, 27 Jul 2023 20:23:58 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FBF5BF for ; Thu, 27 Jul 2023 17:23:57 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-bcb6dbc477eso1378029276.1 for ; Thu, 27 Jul 2023 17:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690503836; x=1691108636; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kcj+3z3CVbuBGBRuj/7fCoy99WoBx7sCuEmut4Zlw60=; b=r7Tn0OuqEg5YHM7yqlrrqTuTizuHUxv4h/N9Z98HzU/PBy1sCY5dhKtMklIIy5qvGP OS94Ifwgj8OGqExfZODklFgrf4GV4yLQtRP5S6CJWiW7P9r6lenJGMHtewsL7EFy2gRv 7e+N1S3sWYB13slekvOVfKgg2dfyXGZfHlr/F/CbSO6IkrabsRqiaS/NwX5RKuo+AgT/ lIPNha+WwO43X5Xt/ykaBQe/+OKixR+YW3ZBjnoBx4jiT9PYlLn9G+asQpRUch5sSjls dLSyEjSQtHrbBBJRQGgzMrDNrN9Kx2HFwdYs/cDcPC0mFAY3SjSO1eBbOyn5zT05if2O delw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690503836; x=1691108636; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kcj+3z3CVbuBGBRuj/7fCoy99WoBx7sCuEmut4Zlw60=; b=k+S/wJDcbWDCTRgwCO3yBT2Cs8vB0X6LL3WiOsohHyH9suv6rCRs+xv6TGfH3sWVwJ EpaMCFtALUjXNCr1MrB1W+3GKYJ9Hl2BoGhXvPPKqxAs0cm7ZGjXAepDfIVOA5QbrqF5 Ea8otuTi2YcfUA2AGoXG8ud4IOovgi7ci0ECxgWt+M5xys9iOcSq4lWr8kSrGJTpvN18 hNV1bDuQDWWGow0KXYNBL+TAAgv+ZIxih9LgxjyV/KZuQma90AYyn7Jq5PTbqWpA9WZi O7p+ajqGeL8BKy8ThXfV0v/WCvU0Ngz88vCV+pobRiQe30ZJ1kbbvJTi4CmH8tSwFc+j ZMLw== X-Gm-Message-State: ABy/qLaBTdHHDNmJxRDLXc4mtoLZGyKAfoVOn256wR9qdBIh7BrJbD0f JZgUyAB3ScUuPoiLBqykCke7whFVb4vtT2NbqyI5/Q== X-Received: by 2002:a25:c512:0:b0:c5d:1407:f2bc with SMTP id v18-20020a25c512000000b00c5d1407f2bcmr221118ybe.17.1690503836119; Thu, 27 Jul 2023 17:23:56 -0700 (PDT) MIME-Version: 1.0 References: <20230728091849.7f32259d@canb.auug.org.au> <20230728102022.7593856b@canb.auug.org.au> In-Reply-To: <20230728102022.7593856b@canb.auug.org.au> From: Suren Baghdasaryan Date: Thu, 27 Jul 2023 17:23:45 -0700 Message-ID: Subject: Re: linux-next: manual merge of the mm tree with Linus' tree To: Stephen Rothwell Cc: Matthew Wilcox , Andrew Morton , Jann Horn , Linus Torvalds , Linux Kernel Mailing List , Linux Next Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Thu, Jul 27, 2023 at 5:21=E2=80=AFPM Stephen Rothwell wrote: > > Hi Matthew, > > On Fri, 28 Jul 2023 00:49:50 +0100 Matthew Wilcox w= rote: > > > > 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; > > > > > > - /* 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 locke= d */ > > > - if (vma_is_anonymous(vma) && !vma->anon_vma) > > > -- goto inval; > > > -- > > > if (!vma_start_read(vma)) > > > goto inval; > > > > > > + /* > > > + * find_mergeable_anon_vma uses adjacent vmas which are not locke= d. > > > + * 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; > > > - > > > - /* > > > - * Due to the possibility of userfault handler dropping mmap_lock= , avoid > > > - * it for now and fall back to page fault handling under mmap_loc= k. > > > - */ > > > - if (userfaultfd_armed(vma)) > > > ++ if (unlikely(vma_is_anonymous(vma) && !vma_is_tcp(vma))) > > > + goto inval_end_read; > > > + > > > > No, this isn't right. It should be: > > > > 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. Hmm. 657b5146955e ("mm: lock_vma_under_rcu() must check vma->anon_vma under vma lock") should be adding a "inval_end_read" label. At least I see it in https://lore.kernel.org/all/20230726214103.3261108-3-jannh@google= .com/ and will check Linus' tree in a min. I don't see that label in your patch... I also misspoke in my previous message. The patches in mm tree remove some code from that function, so it's easier to apply them first and then the one from Linus' tree. > > -- > Cheers, > Stephen Rothwell