Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27797rwd; Wed, 17 May 2023 14:06:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hgbvkRN7LFu65fqZY9sIVJDiJd6g1EtNuxQls0VOKGco4qUca+ONieOyxTQUd3OAZuOit X-Received: by 2002:a05:6a20:394b:b0:103:e813:77a1 with SMTP id r11-20020a056a20394b00b00103e81377a1mr4368047pzg.15.1684357613632; Wed, 17 May 2023 14:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684357613; cv=none; d=google.com; s=arc-20160816; b=RsDmuiNj7lKNQzQ3DbBmVdfEZuOHh5ScstgeHXcQokPkL7lYOflEFF/hFniJ9FGZr/ Z1QPWhlKUM//+Ge0A6xrO+73VYrnfwidN7lVhMvy8Awh6ynn240ywIzYlJO3+scQn/dH tuqW3VLDv0Fo6kwAoJagS+ZVqiU5wqFffxArg1USbGqqnPKnawG3Bjb2eAwlR9n8vHfX VYPf8quNoF7/ZMD7m+READ5U0/FQByLw8G8ttPabEV5tz5TL1FGyV5qHmProsrU0m+lJ 5cNwFLfLJLpKYZxq43aujkgn9deNEZ606tD64Oi9ejo4x2Ak1ei2sOcmNSC2E8X6qN9s u5oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qw24q3koBCTGhsyK/A9UxnFtqmKPlaJqCG9HtlLgPFU=; b=AVVh1tj25BJG7qnhO9/aiw1WxELVPIU4hRM7Jo+K6xB61OkZgZenMkHp83ZNCI0GLD qeGWCf3CW0xzwUKbN140oOJbyqw90tIdRudLguWGZMnGZN6s5unBo9N7VhMLPlXuvTI8 B1wYKBWg0yHcdc5Gczo9MaOdtBtBsPQpWbYuvoqwxfjjs9EuMZkob4EFAMM2UTJS4dCJ ovjBHW1h+AmnKN5U6fZXQvLoiLpWw0FUiFqK91u1Lk0gj2GG0m3rXA45GtHXJHGeaizy Pji51TYLJ1l5qugyLlEarwW/A7BVja1MLT9kYIOgwetBLSyFuQ5V7/ahAuwXCRxcdvv4 mQlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IVOiLRQa; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o19-20020a637313000000b0051b37c000dcsi16600986pgc.81.2023.05.17.14.06.39; Wed, 17 May 2023 14:06:53 -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=@redhat.com header.s=mimecast20190719 header.b=IVOiLRQa; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjEQUiA (ORCPT + 99 others); Wed, 17 May 2023 16:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjEQUh4 (ORCPT ); Wed, 17 May 2023 16:37:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0629B0 for ; Wed, 17 May 2023 13:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684355831; 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=qw24q3koBCTGhsyK/A9UxnFtqmKPlaJqCG9HtlLgPFU=; b=IVOiLRQaRNb7Pq6JUuLR4hrmtaCm/hnihRAMsAw+J4VG2z0u/ZdL6G8LRBWfz/NLEMrENQ y01YgBJkNBM98ly3KeaBBqHxwDakKQpBgkYV4ly0h4bHY+Vf74nX5SGea352Egmstd7Wah HZFJjRQhz3ly3OHaci6m8dJLbZQyPvo= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-0-d8Rm3sN0KmBZypC24Y8A-1; Wed, 17 May 2023 16:37:10 -0400 X-MC-Unique: 0-d8Rm3sN0KmBZypC24Y8A-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-621189941cdso1566086d6.1 for ; Wed, 17 May 2023 13:37:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684355830; x=1686947830; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qw24q3koBCTGhsyK/A9UxnFtqmKPlaJqCG9HtlLgPFU=; b=f70LS7/chnwR7r/RTm3ZZiHxGS4Yg4I4m+6iEyUJwGV8Tf2FDxzWvY9BXnIJRC1JRh 0lNgeml8pi4tzD2T2CtwgJjwPALhJWnoSNi07+fU6hECH3gPN7kXMcU4k6Oc4poXNGIS SimZRcY4K0oIe/+Y4GX377l8oXfmODDoOodLKt4giueWJU+pm0BCovVokO/72SgFEu9i fMZhAkf4cPpcVL0NBqHpFdmyOQscZEfKsSbiR/ALp9P+LSuWMVrNlTM2hOcM4HeMiD/Q ZeqoQRZDkAYX/p+lv4pWEWv+06HEC48XlMIONq4wnZs7hj/qBmzsr9W2xSaCDipluWNx +h4w== X-Gm-Message-State: AC+VfDyaF2vxeliC2a/BiVPCB0AdSES52zj0Nb+w2C4hI4om6nFK7pnn ljx3D5XwzXNGtAxCfSnxTJwndNttw7wC+KXqogzWjxbgtv0wxS+15WT3vuYJe0IGzMnXKdutlWj 22fEznrvmjMb2m6OV/z1pg8Mm X-Received: by 2002:a05:6214:cc8:b0:61b:6b8e:16e0 with SMTP id 8-20020a0562140cc800b0061b6b8e16e0mr7457827qvx.1.1684355830162; Wed, 17 May 2023 13:37:10 -0700 (PDT) X-Received: by 2002:a05:6214:cc8:b0:61b:6b8e:16e0 with SMTP id 8-20020a0562140cc800b0061b6b8e16e0mr7457800qvx.1.1684355829864; Wed, 17 May 2023 13:37:09 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-62-70-24-86-62.dsl.bell.ca. [70.24.86.62]) by smtp.gmail.com with ESMTPSA id p19-20020a0cf553000000b00621430707f7sm1585qvm.83.2023.05.17.13.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 13:37:09 -0700 (PDT) Date: Wed, 17 May 2023 16:37:08 -0400 From: Peter Xu To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Alexander Viro , "Liam R . Howlett" , Andrea Arcangeli , Mark Rutland , Lorenzo Stoakes , linux-stable Subject: Re: [PATCH v2 1/2] mm/uffd: Fix vma operation where start addr cuts part of vma Message-ID: References: <20230517190916.3429499-1-peterx@redhat.com> <20230517190916.3429499-2-peterx@redhat.com> <20230517132321.2466ef1ccde9e8d05436e3f2@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230517132321.2466ef1ccde9e8d05436e3f2@linux-foundation.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, May 17, 2023 at 01:23:21PM -0700, Andrew Morton wrote: > On Wed, 17 May 2023 15:09:15 -0400 Peter Xu wrote: > > > It seems vma merging with uffd paths is broken with either > > register/unregister, where right now we can feed wrong parameters to > > vma_merge() and it's found by recent patch which moved asserts upwards in > > vma_merge() by Lorenzo Stoakes: > > > > https://lore.kernel.org/all/ZFunF7DmMdK05MoF@FVFF77S0Q05N.cambridge.arm.com/ > > > > It's possible that "start" is contained within vma but not clamped to its > > start. We need to convert this into either "cannot merge" case or "can > > merge" case 4 which permits subdivision of prev by assigning vma to > > prev. As we loop, each subsequent VMA will be clamped to the start. > > > > This patch will eliminate the report and make sure vma_merge() calls will > > become legal again. > > > > One thing to mention is that the "Fixes: 29417d292bd0" below is there only > > to help explain where the warning can start to trigger, the real commit to > > fix should be 69dbe6daf104. Commit 29417d292bd0 helps us to identify the > > issue, but unfortunately we may want to keep it in Fixes too just to ease > > kernel backporters for easier tracking. > > > > Cc: Lorenzo Stoakes > > Cc: Mike Rapoport (IBM) > > Cc: Liam R. Howlett > > Reported-by: Mark Rutland > > Reviewed-by: Lorenzo Stoakes > > Reviewed-by: Liam R. Howlett > > Fixes: 29417d292bd0 ("mm/mmap/vma_merge: always check invariants") > > Fixes: 69dbe6daf104 ("userfaultfd: use maple tree iterator to iterate VMAs") > > I don't know how -stable maintainers are to handle more than a single > Fixes: target, given that Fixes: means "kernels which have that patch > need this one". Can we narrow this down to a single commit for this > purpose? Please just keep: Fixes: 69dbe6daf104 ("userfaultfd: use maple tree iterator to iterate VMAs") I just noticed 29417d292bd0 is only in rc1 so no backport needed anyway. We definitely need 69dbe6daf104 marked Fixes for backport till 6.1+. Thanks, -- Peter Xu